Link to home
Start Free TrialLog in
Avatar of mandybird44
mandybird44

asked on

message box

message boxes does not work for me.
i use it like that"
message_box(NULL,"dialog","title",MB_OK);
it's being ignored without any comment.
Avatar of cybsasha
cybsasha

Try:
AfxMessageBox("Can't Load Image", MB_OK);

Avatar of mandybird44

ASKER

it's completely ignored just like the first.
(btw - i don't know mfc very well so u can say things that seem trivial)
Or:
MessageBox("Message", "Caution",MB_OK);

Ignored how? Can't compile?Or you don't see message box?
now it doesnt compile and claims:
none of the 2 overloads can convert parameter 2 from type 'char [8]'
at your first example the command was ignored and the program went on. here it doesnt compile.
Do you include for the second example file Afxwin.h ? Please let me now, if yes , write what what compile says
now i added it.
it doesnt compile now and says the same thing as before.
Try to download source file from www.pole.da.ru  and compile, if you'll have errors let me know
i get linking errors:
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex

i tried to add libcmt32.lib to my libraries but it shouted even more about other things (such as malloc)
do you use MFC or OWL?
i think it's mfc. i don't know what owl is....
Avatar of leflon
if you get this error check your project settings and set
General\Microsoft Foundation Classes to
    using mfc in shared dll
or
   using mfc in static lib
leflon was right.
now it compiles just fine (no warnings) and opens a window
and every time i click the window it openes message says caution.
MessageBox( LPCTSTR lpszText, LPCTSTR lpszCaption = NULL, UINT nType = MB_OK );


hey wolf.
what kind of answer is this.
haven't read any of the comments.
the problem is already solved.

you are new to ee. so remember don't take other peoples comments and make them your answer. not a very fine move.
Mandybird444 reject proposed ansewer and give leflon points
wait, i said that now your program works, but not mine...
and wolf_34 : if i wanted that kind of an answer, i wouldn't ask here...
Mandy bird I think you already have a solution
Just use AfxMessageBox()//requires afxwin.h && MFC in shared dll

or  CWnd:: MessageBox() //member function of CWnd

If you are not using MFC but SDK try
   ::MessageBox(hWnd//handle to the parent
                 text,title,buttons)
The above one is similar to the one
  message_box(NULL,"dialog","title",MB_OK);
 so I think you should use this version of messagebox.
THERE IS NO FUNCTION message_box in MFC so Look what software you are using


sorry guys, but nothing u say make this idiotic program open this window.
could you once again post the code you are using right now?
sure.
MessageBox(NULL,"dialog","title",MB_OK);

Why you don't wnat to try like this: MessageBox("Message", "Caution",MB_OK);
Why MessageBox(NULL,"Message", "Caution",MB_OK)? I'm not sure but you cant compile you command(because MessageBox takes only 3 parametrs, and )
1.i tried all of that combinations.i tried everything that was said.none works.
2.it compiles.appearently there is more then one messagebox.
ASKER CERTIFIED SOLUTION
Avatar of cybsasha
cybsasha

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hey Mandy bird if you are evaluating cybsasha's answer
then I had already given you the solution on August 4th
Look at what i jhave written
I gave you all three ways of getting a messagebox
LOOK AT THE THIRD ONE
"If you are not using MFC but SDK try
   ::MessageBox(hWnd//handle to the parent
                 text,title,buttons) ..."
I think you havent read my answer

correct me if i'm wrong.
your code compiles but the messagebox never shows up.

what is the return code of the messagebox func?
if its 0 (failure) then try GetLastError() and check what caused the error.

jaguar - keep cool. its just a proposed answer, so mandybird can't do anything about it. (besides it was a comment not ananswer)

Sorry jaguar_sri , i pass through you comment I agree with you. You are right
is your problem solved mandybird44 by following CYBSASHA's
answer?
If it is not please give us some code to analyze the problem
ofcourse LEFLON has given you the way to find out the error
which may be the problem?
Keep in touch
I really apreciate your tries to help me.
I tried what u said. the function (both with :: and without)
and the return code was 1.
now i paid attention that whenever the window is supposed to be opened there is this annoying cling (like when u get a windows error window).
does it have something to do with it?
hi everybody.
the problem is solved.
it was that i had an earlier window which was defined main window.
after i dropped it, it finally works.
told u i didn't know the subject very well...

10x alot.