-
March 3rd, 2000, 12:30 PM
#1
How can I *simulate* an AfxMessageBox?
I have a bug that is fixed by simply putting in an AfxMessageBox message. However, I don't want the message box window to pop up and be visible to the user. How can I make Windows / the app / whatever think that an AfxMessageBox just popped up WITHOUT actually showing one?
I've tried InvalidateRect, ActivateFrame, Activate... What else can I try? What messages get posted when an AfxMessageBox gets posted?
(and I don't want to pop up the box then hide it-- from my experience, the user can still see the message box for a split second)
Thank You
-
March 3rd, 2000, 12:43 PM
#2
Re: How can I *simulate* an AfxMessageBox?
I and almost any other competent Windows programmer would not call what you did a "bug fix". You really have not fixed anything, except do a hack which may not work on other systems.
Instead of fighting with the Windows OS (the AfxMessageBox is a call to the API ::MessageBox() function, whicn in turn can be modal, system modal, application modal, and the dialog goes in a closed message loop, etc. etc.) why not tell us what the real problem is that you were having before resorting to this? Maybe someone can help you with that problem first.
Regards,
Paul McKenzie
-
March 3rd, 2000, 01:48 PM
#3
Re: How can I *simulate* an AfxMessageBox?
Thanks Paul. Yah, I know it's a hack, and it is a *last* resort. I've just spent way too much time on the problem.
Thanks again
-
March 3rd, 2000, 01:56 PM
#4
Re: How can I *simulate* an AfxMessageBox?
Why don't you tell something about your bug. If not fixed, it will haunt you all the time. How many AfxMe....() box you will put to satisfy all the bugs.
regards.
-
March 3rd, 2000, 02:09 PM
#5
Re: How can I *simulate* an AfxMessageBox?
Well you haven't told us what the bug is. Just let us know, and people here can give you suggestions on what you may be doing wrong.
As I stated, putting the AfxMessageBox is not the "last resort" and is just voodoo that you discovered. If you plan on deploying the application to other users, expect calls from them letting you know that your program fails. Then you'll say to yourself "I don't understand, the AfxMessageBox was supposed to fix that". You'll feel like the Dutch boy trying to stop the dam from leaking.
Regards,
Paul McKenzie
-
June 7th, 2012, 05:13 AM
#6
Re: How can I *simulate* an AfxMessageBox?
Have the same "bug fixing" And i also need to simulate AfxMessageBox
"Tell us what the problem is"
Okay
In OnCreate of MainFrame I have a function call that connected with two other custom classes (children of view and dialog), one of them connected with hardware.
I have calling this function in 2 other places.
And two types of starting program: with hardware connected/hardware disconnected
In first type of start everything is fine
In second type of start function works properly everythere except OnCreate.
-
June 7th, 2012, 07:25 AM
#7
Re: How can I *simulate* an AfxMessageBox?
So why wouldn't you call your function somewhat later but not in OnCreate? Try OnCreateClient.
Best regards,
Igor
-
June 7th, 2012, 07:44 AM
#8
Re: How can I *simulate* an AfxMessageBox?
Originally Posted by 330xi
Have the same "bug fixing" And i also need to simulate AfxMessageBox
"Tell us what the problem is"
Okay
In OnCreate of MainFrame I have a function call that connected with two other custom classes (children of view and dialog), one of them connected with hardware.
I have calling this function in 2 other places.
And two types of starting program: with hardware connected/hardware disconnected
In first type of start everything is fine
In second type of start function works properly everythere except OnCreate.
A 12 year old thread. I think that may be a record.
-
June 8th, 2012, 04:44 AM
#9
Re: How can I *simulate* an AfxMessageBox?
Originally Posted by Igor Vartanov
So why wouldn't you call your function somewhat later but not in OnCreate? Try OnCreateClient.
my function connected with a plenty of initialization commands and variables that exist only in OnCreate. I've tried but it cause a tree of run-time errors.
But on this exact topic, if in next 12 years someone choose such idea:
In my case any dialog is suitable to make my program run as I want it to. It must be visible for 100 ms. So:
A new class CDialog
in OnInitDialog:
in OnTimer:
Code:
EndModalLoop(IDOK);
in callPlace:
Code:
Safe s;
s.DoModal();
In Resaurces set feature "Transparent" - true.
-
June 8th, 2012, 07:44 AM
#10
Re: How can I *simulate* an AfxMessageBox?
Actually it sounds like this is a windows message loop problem.
By calling show dialog the dialog is setting up its one message loop which pumps the window's messages around.
The hardware access (sorry - is it though a 3rd party library) might use windows message loops in its operation (SendMessage and the like).
Maybe you're initialisation of the hardware might be better inside of a button click ?
Darwen.
-
June 13th, 2012, 04:18 AM
#11
Re: How can I *simulate* an AfxMessageBox?
Originally Posted by darwen
Actually it sounds like this is a windows message loop problem.
By calling show dialog the dialog is setting up its one message loop which pumps the window's messages around.
The hardware access (sorry - is it though a 3rd party library) might use windows message loops in its operation (SendMessage and the like).
Maybe you're initialisation of the hardware might be better inside of a button click ?
Darwen.
oh, thanks!) At least I know the general form of my problem now. I'm sure it helps me to find other people experience in solving it and explore it better.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|