• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 219
  • Last Modified:

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.
0
mandybird44
Asked:
mandybird44
  • 13
  • 10
  • 4
  • +2
1 Solution
 
cybsashaCommented:
Try:
AfxMessageBox("Can't Load Image", MB_OK);

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

0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
cybsashaCommented:
Ignored how? Can't compile?Or you don't see message box?
0
 
mandybird44Author Commented:
now it doesnt compile and claims:
none of the 2 overloads can convert parameter 2 from type 'char [8]'
0
 
mandybird44Author Commented:
at your first example the command was ignored and the program went on. here it doesnt compile.
0
 
cybsashaCommented:
Do you include for the second example file Afxwin.h ? Please let me now, if yes , write what what compile says
0
 
mandybird44Author Commented:
now i added it.
it doesnt compile now and says the same thing as before.
0
 
cybsashaCommented:
Try to download source file from www.pole.da.ru  and compile, if you'll have errors let me know
0
 
mandybird44Author Commented:
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)
0
 
cybsashaCommented:
do you use MFC or OWL?
0
 
mandybird44Author Commented:
i think it's mfc. i don't know what owl is....
0
 
leflonCommented:
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
0
 
mandybird44Author Commented:
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.
0
 
wolf_34Commented:
MessageBox( LPCTSTR lpszText, LPCTSTR lpszCaption = NULL, UINT nType = MB_OK );


0
 
leflonCommented:
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.
0
 
cybsashaCommented:
Mandybird444 reject proposed ansewer and give leflon points
0
 
mandybird44Author Commented:
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...
0
 
jaguar_sriCommented:
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


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

0
 
cybsashaCommented:
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 )
0
 
mandybird44Author Commented:
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.
0
 
cybsashaCommented:
Try this is, its work(two points to use API massage box)
::MessageBox(NULL,"Message", "Caution",MB_OK);

0
 
jaguar_sriCommented:
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

0
 
leflonCommented:
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)

0
 
cybsashaCommented:
Sorry jaguar_sri , i pass through you comment I agree with you. You are right
0
 
jaguar_sriCommented:
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
0
 
mandybird44Author Commented:
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?
0
 
mandybird44Author Commented:
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.
0

Featured Post

[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

  • 13
  • 10
  • 4
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now