I think the easiest thing for you to do would be to just figure out how many seconds difference there is between the two times, and then convert that back to the proper time format for displaying purposes only. I'm confused about the hour variable. Is this military time that goes from 0-23, or does it go from 1-12? If this is military time, then your life is really easy. You don't even need an hour and minute variable in your Watch class anymore, just a second variable. Use the following as a model for getting your time (you really should have a function in your class which asks this
int hrs, mins, secs;
cout << "enter the hour\n";
cin >> hrs;
Sec = hrs * 3600;
cout << "enter the minute\n";
cin >> mins;
Sec += mins * 60;
cout << "enter the seconds\n"
cin >> secs;
Sec += secs;
There, now you have the time in the exact second of the day that you started. And you can do the same to get the second time...and I hope you can figure out how to find the difference between times...just subtract the seconds. Now, to display your time back in proper format:
I am trying to write a simple Windows program that monitors and logs the memory usage of programs or tasks in Windows. Basically, I want the information that the Task Manager gets so that I can watch for changes, memory leaks, etc... I am experienced in C++ but have yet to write a Windows application. Any help or information regarding how I might go about this project would be greatly appreciated.
i exactly dont remember the title of the book...but its of MS Press by Jeff Prosise for developing Systems internals...Its CD contains..alots of sample code like...Erro look up, SPY, MFC TRACER, MEMORY DETECTOR..thread and process viewer...
If till evening i get the name of the book, PINGO I shall be gald to let u know...
I have a problem. When I want to wait for a thread to finish processing, I use the WaitForSingleObject and pass it the handle to the thread I am waiting on. However, that thread never finishes, so my program just hangs. When I step through it in the debugger, it never seems to go into the function that I am waiting to finish, but I still have a handle to the thread, so I don't believe it has finished.
You have to set up some kind of singnalling system to tell your thread to finish. The usual way is to use an event, which your thread perodically checks and if its singaled, exits - something like this:
The threads handle will still be valid even when the thread has died (until you do a CloseHandle on it). To dermin if it is running or dead do WaitForSingleObject passing in 0 as the timeout - if you get WAIT_OBJECT_0 its dead, or WAIT_TIMEOUT its still running. You can also use GetExitCodeThread which will give you STILL_ACTIVE if the thread is still running - though WaitForSingleObject is generally prefered.
hi all really this site is so powerfull i mean it
well i want to capture an image from a camera the application is a dialog based application and i am using visual c++ 6.0 i wanna the view which camera get appear first and make the position nice then a button called capture when i clicked it it capture the image which in the view then open dialog for saving
Hope anyone help me by any ideas
Thanks man for replaying but wanna another question
i have read some of the article but my question is to capture a picture from a camera did i have to use directshow and PLZ some introductin of the directshow
thanks alot for replaying anyway i got a piece code it talking about a thing called VFW
and yeah man it will be a web cam i have got the sdk of directx but wanna to know is it easy to link it to a visual c++6
byebye for now
Hello, My name is jason.
I am trying to write a program that will track the times and the dates that an employee has worked. I know how to hard code it but, it is the gui that i am having a problem with. Here are my main problems. When the program starts i would like a password screen to appear, where the user or the manager enters her/his password. This part I have accomplished, the password screen. I have placed 9 buttons, when the user clicks on the buttons i record or add to a string, and when the user hits okay, i read the finished string and see if there is an employee. My problem is this, I need to have to different windows, one for a manager, and another for a employee. Meaning, if a manager comes along, types his password, i would like a window appearing where he has the option of looking how has clocked in, how many employees are currently working, total hours ans so forth. When a employee comes along, enters his/her password, i would like them to see when they have started, or if they have not punched in, a punch in button, or a punch out button and so forth..
If anyone could help me out, or give me advice on how to create those two different windows and how to interact or how to dynamilcly pop up those two windows depending on who is entering a password, i would be sooooo happy.
you can email me at firstname.lastname@example.org
Hi Jason how are U man
well man u will create dialogs as u wanna and after handle the button of the manager just inside its function call the dialog which u have make for the manager and in the employee case make a different dialog when the empolyee is chosen after inserting the username and his password call the dialog of the emoplyee and in the two dialogs the one for employees and one for manager make any interface u wanna to make ur times appears
hope that will solve ur problem if ok tell us and if no also tell u
modeonetwo wrote: My problem is this, I need to have to different windows, one for a manager, and another for a employee.
Sounds like you need some sort of designator that denotes manager vs. non-manager. Are you looking in some sort of file/database to verify the user id and password are correct? If so, just add another field.
You would then need to create two dialog templates: one for managers, and one for non-managers. Then in your code, you could have something like:
Thank you both very much, that little bit of code makes a lot of sense, i was thinking of doing just that but did not know if it was possible or smart.. I will look into that and probably do that. Thank you soo much.
I’m trying to learn how to work with CSplitterWnd class.
I create a simple SDI application using MFC Application Wizard.
Classes created are:
I want to have two different views for my document. For the second view, I add a new class to my project – CMySDIView2 class is derived from CView.
I want to have static splitter with two panes. I override OnCreateClient :
// create a splitter with 1 row, 2 columns
if (!m_wndSplitter.CreateStatic(this, 1, 2))
TRACE0("Failed to CreateStaticSplitter\n");
// add the first splitter pane - the default view in column 0
if (!m_wndSplitter.CreateView(0, 0,
RUNTIME_CLASS(CMySDIView), CSize(0, 0), pContext))
TRACE0("Failed to create first pane\n");
// add the second splitter pane - an input view in column 1
if (!m_wndSplitter.CreateView(0, 1,
RUNTIME_CLASS(CMySDIView2), CSize(0, 0), pContext))
TRACE0("Failed to create second pane\n");
When I build the project, I get two errors:
error C2653: 'CMySDIView' : is not a class or namespace name
//RUNTIME_CLASS(CMySDIView), CSize(0, 0), pContext))
error C2653: 'CMySDIView2' : is not a class or namespace name
//RUNTIME_CLASS(CMySDIView2), CSize(0, 0), pContext))
In order for this to work, both of your view classes must support dynamic creation.
The macro 'DECLARE_DYNCREATE' or 'DECLARE_DYNAMIC' must be found at the start of both classes header files. The parameter for the macro is the class name.
Additionally, a macro 'IMPLEMENT_DYNCREATE' or 'IMPLEMENT_DYNAMIC' must be placed near the top of your implementation file (after the headers, but before function definitions). Parameters for this macro are the class name and the name of the base class.
See the MSDN for information about the differences between these macros.
If all macros are correctly placed in your files, then see if the error is caused by missing header files. Your main frame implementation file must have the header files of both view classes. Otherwise an error is generated.
In addition, the way you create the views is a bit dangerous. A more convinient way is to add the headers into the main frame header file, then create two member variables (either static or dynamic), one of each view class. After this, you can create the views, and specify the splitter window as the parent. Using 'CSplitterWnd::IdFromRowCol' allows you to get the identifier of the pane. When you put this identifier as the id of the newly created view window, the view gets placed into inside the pane.
If you use this technique, however, you must be certain that you destroy the views when your program is closing up. You must first destroy the view windows, then destroy the splitter window, and after this, if you used dynamic variables, you can delete the reserved memory.
There is an article in the works about this method. I'm not sure when it will be out, but I bet in the next few months or so..
The definition of impossible is strictly dependant
on what we think is possible.