Click here to Skip to main content
15,506,981 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
AfxMessageBox(_T("A"), MB_ICONERROR);
    return;


this is my code but it doesn't work, box of messageBox doesn't compare

What I have tried:

I tried
AfxMessageBox(_T("A"), MB_OK); 

but it's the same thing
Posted
Updated 6-Dec-21 0:38am
v2
Comments
Richard MacCutchan 6-Dec-21 4:32am    
What do you mean, "messageBox dpesn't compare"?
OriginalGriff 6-Dec-21 4:33am    
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with. Just saying "doesn't compare" means nothing to us because we can't see what actually happened, and have no idea what you expected!

Use the "Improve question" widget to edit your question and provide better information.
OriginalGriff 6-Dec-21 5:03am    
:sigh:
Changing "messageBox doesn't compare" to "but it doesn't work, box of messageBox doesn't compare" isn't helpful: it tells us nothing at all. We can guess that "it doesn't work" because if it did, you wouldn't be asking about it.
But we can't guess *how* it doesn't work - we have no idea what you expected it to do, or what it actually does when you try it. And we have no idea what "doesn't compare" means because messages boxes don't "compare" anything with anything else so at a guess you are using totally the wrong word and we have no idea what word you do mean!

It's like you have gone for a drive, your car has broken down, and you call the garage and say "my thingummy died". When the garage says "what is a thingummy?" you just hang up.
The garage isn't going to be able to get to you and fix your car in a hurry because it doesn't know essential informatioN; Where you are, what make of car it is, what model, what happened when it broke. Is it out of fuel? On fire? rolled down a cliff? Stolen? got a puncture? The garage has no idea - and can't help you until you give them actual information!

We are in the same place: we would like to help, but we have no idea what help you need - so you need to explain in detail instead of trying to type as little as possible ...
Member 14594285 6-Dec-21 5:20am    
I want to tell that my code doesn't execute this row of code:
AfxMessageBox(...)
CHill60 6-Dec-21 5:28am    
Then you need to share the code before that line as you must have some flow that bypasses it

1 solution

Quote:
I want to tell that my code doesn't execute this row of code:
AfxMessageBox(...)

Well, that helps.

The way to tell is to start by using the debugger: MFC Debugging Techniques - Visual Studio (Windows) | Microsoft Docs[^]
Put a breakpoint on the first line of the function containing the AfxMessageBox call and check that it gets that far.
If it doesn't you need to look at the rest of your code to find out why.
If it does, single step the function watching closely to see what happens, and you should see that either that line of code is executed, or not.
If is isn't, the single stepping should tell you why not.
If it is ... then that's unlikely, so you will need to start by looking at environmental factors to work out why as that call is used a lot!

Sorry, but we can't do any of that for you!
 
Share this answer
 
Comments
Member 14594285 6-Dec-21 5:51am    
thanks, I used debug and breakpoint arrives in that point but then program is blocked
OriginalGriff 6-Dec-21 6:06am    
Blocked where?
Seriously, you have to help us here - we can't see your screen at all, and we don't have your code!
merano99 6-Dec-21 11:10am    
Displaying a message box with [Afx] MessageBox is a blocking operation, so it is normal.
Are you sure that the dialog is not behind other Windows, e.g. behind the IDE window?
Member 14594285 6-Dec-21 11:27am    
In fact I thought this
Member 14594285 6-Dec-21 11:19am    
I found out that this code:
<
CRect rect1;
rect1.left = 250;
rect1.top = 10;
rect1.bottom = 530;
rect1.right = 1250;
m_pieChart.Create(L"", rect1, this, 1);
>
block afxMessageBox , if I remove this row ''m_pieChart.Create(L"", rect1, this, 1);''
I can see afxMessageBox

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900