|
In the OnInitDialog() method, remove the call to UpdateData() . It is hardly, if ever, needed.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
David/John,
I just wanted to bring closure to this thread. The problem is fixed, although I'm not exactly sure how. In the end I deleted the member variable and four controls I had created (two static bitmaps and two static labels). I then added them back to the dialog. This time I added a member variable first to one of the label controls. It compiled and ran without any errors at all. I then began adding member variables to the rest of the controls, again with no errors.
One thing I did differently. Instead of creating the bitmap and associating it with the bitmap led resource, I left it blank. I then created a class variable of HBITMAP type and set it to the led resource. Then used the control's member variable to 'set bitmap' to the HBITMAP.
I'm not sure if those changes were the answer or just deleting and re-adding the controls. Anyway, this vague problem is fixed and it runs in debug mode without assertion failures.
Thanks again for all the help. Jim
|
|
|
|
|
Hi,
I have a MFC/COM exe application which loads the DLL, which is a separate component DLL and not included in main MFC/COM exe project workspace. I want to debug the function calls made by exe on DLL(I have the DLL code).
I built both exe and DLL in Debug mode, registered the DLL and tried to debug. But when the DLL interface call comes the exe not stepping into that DLL call, instead stepping over that DLL call and continuing rest of the execution in the exe.
If someone help me how to debug this DLL call from exe, I will appreciate that.
|
|
|
|
|
I would think the problem is that the debugger can not find the source files for the dll. You could try add the path to the dll files to the directories searched by VS. In VS6 it is Tools->Options->Directories. I am sorry I am not sure where it is in VS7.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
Thanks a lot. It helped me to findout the problem.
|
|
|
|
|
Babto wrote: not included in main MFC/COM exe project workspace
can you put it into that workspace?
if not, open the DLL's workspace, go to Project / Settings / Debug and give the path to your MFC app in the "Executable for debug session" field. then 'run' your DLL. it will launch your app, and you can set breakpoints in your DLL code (but not in your app's code).
putting the DLL in your app's workspace (even if just temporarily) is really the best way to do it, though.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
I have a application in which i need a timer event
to fire at some regular interval say 1 to 10 seconds.
But durint this interval other Buttons on the Dialogbox
are not responing .
So i want a method were i can call this timer function by
which it runs on non UI thread.
any idea
thank you
|
|
|
|
|
You can use CreateWaitableTimer. It will create a timer that uses events.
|
|
|
|
|
I Guess using CreateWaitableTimer with SetTimer and WaitForSingleObject may block ur thread !
Cause is my effort;
Effect is God's effort
|
|
|
|
|
You can't use WaitForSingleObject you have to use MsgWaitForMultipleObjects then Dispatch the message to the other controls while you wait on the timer.
|
|
|
|
|
If you feel teh timer function takes alot of time .then You can do this .
Wherever_Timer_creation_required
{
setTimer(X,Y,MULL)
pthread=AfxCreateThread();
}
OnTimer()
{
pthread->PostThreadMessage(Message)
}
Now you can handle that message in pthread .
Cause is my effort;
Effect is God's effort
|
|
|
|
|
Use SetTimer() and OnTimer()
Danny
The stupidity of others amazes me!
|
|
|
|
|
SetTimer will work just fine. Pass NULL as the HWND and specify a TimerProc callback function.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
Thanks
but i have already tried the SetTimer
i have only one option that i didnot wanted
to opt that is create a thread.
|
|
|
|
|
Ok, I misunderstood your question. I thought you were wondering how to set up a timer in a non-ui thread that did not have a window available to handle the WM_TIMER message.
If your timer function is so lengthy that it interferes with the responsiveness of the UI then your only option is to use a seperate thread for it.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
How will I going to know if a thread is already done on its process? bec what I use is to put a AfxMessageBox at the end of the threaded function.
How will I terminate it prematurely, without waiting for it to finish its task?
--thanks
|
|
|
|
|
benjnp wrote: How will I going to know if a thread is already done on its process?
Right before the secondary thread is about to end, have it post a message to the primary thread. Having the primary thread periodically poll the secondary thread is not a good idea and goes against being asynchronous.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
can you show me a snippet of sending a message from the secondary thread to the primary thread?
|
|
|
|
|
PostThreadMessage(PrimaryThreadId, MyThreadMessage, 0, 0);
|
|
|
|
|
where can I get this PrimaryThreadID? is PrimaryThread ur talking to is my class who calls the secondary worker thread?
what is the possible MyThreadMessage? will it be "NULL"
-thanx
|
|
|
|
|
Yes, the primary thread ID is the main thread of your application.
You can call GetCurrentThreadID from the main application thread to determine its identifier.
I usually use RegisterWindowMessage() to get a unique message identifier to share between threads, unless I need a know one ast compile time to use in a switch statement.
|
|
|
|
|
See these two links:
http://flounder.com/workerthreads.htm
http://flounder.com/uithreads.htm
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
You can call GetExitCodeThread on the thread's handle. If it returns STILL_ACTIVE as the code then the thread is still running.
You can also use WaitForSingleObject on the thread's handle to wait until the thread is finished.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
is it like this?
CWinThread *myThread = AfxBeginThread....
while(GetExitCodeThread(myThread) == STILL_ACTIVE)
{
....
}
|
|
|
|
|
No. First off you are using GetExitCodeThread wrong, look it up in MSDN. Second, as David said above, constantly polling the thread is not a good thing to do.
Stops the caller thread until the new thread finishes:
CWinThread *myThread = AfxBeginThread(...
WaitForSingleObject(myThread->m_hThread, INFINITE);
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|