Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

message box

Posted on 1999-08-01
31
Medium Priority
?
218 Views
Last Modified: 2013-11-20
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
Comment
Question by:mandybird44
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 13
  • 10
  • 4
  • +2
31 Comments
 
LVL 1

Expert Comment

by:cybsasha
ID: 1312209
Try:
AfxMessageBox("Can't Load Image", MB_OK);

0
 

Author Comment

by:mandybird44
ID: 1312210
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
 
LVL 1

Expert Comment

by:cybsasha
ID: 1312211
Or:
MessageBox("Message", "Caution",MB_OK);

0
Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

 
LVL 1

Expert Comment

by:cybsasha
ID: 1312212
Ignored how? Can't compile?Or you don't see message box?
0
 

Author Comment

by:mandybird44
ID: 1312213
now it doesnt compile and claims:
none of the 2 overloads can convert parameter 2 from type 'char [8]'
0
 

Author Comment

by:mandybird44
ID: 1312214
at your first example the command was ignored and the program went on. here it doesnt compile.
0
 
LVL 1

Expert Comment

by:cybsasha
ID: 1312215
Do you include for the second example file Afxwin.h ? Please let me now, if yes , write what what compile says
0
 

Author Comment

by:mandybird44
ID: 1312216
now i added it.
it doesnt compile now and says the same thing as before.
0
 
LVL 1

Expert Comment

by:cybsasha
ID: 1312217
Try to download source file from www.pole.da.ru  and compile, if you'll have errors let me know
0
 

Author Comment

by:mandybird44
ID: 1312218
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
 
LVL 1

Expert Comment

by:cybsasha
ID: 1312219
do you use MFC or OWL?
0
 

Author Comment

by:mandybird44
ID: 1312220
i think it's mfc. i don't know what owl is....
0
 
LVL 7

Expert Comment

by:leflon
ID: 1312221
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
 

Author Comment

by:mandybird44
ID: 1312222
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
 

Expert Comment

by:wolf_34
ID: 1312223
MessageBox( LPCTSTR lpszText, LPCTSTR lpszCaption = NULL, UINT nType = MB_OK );


0
 
LVL 7

Expert Comment

by:leflon
ID: 1312224
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
 
LVL 1

Expert Comment

by:cybsasha
ID: 1312225
Mandybird444 reject proposed ansewer and give leflon points
0
 

Author Comment

by:mandybird44
ID: 1312226
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
 

Expert Comment

by:jaguar_sri
ID: 1312227
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
 

Author Comment

by:mandybird44
ID: 1312228
sorry guys, but nothing u say make this idiotic program open this window.
0
 
LVL 7

Expert Comment

by:leflon
ID: 1312229
could you once again post the code you are using right now?
0
 

Author Comment

by:mandybird44
ID: 1312230
sure.
MessageBox(NULL,"dialog","title",MB_OK);

0
 
LVL 1

Expert Comment

by:cybsasha
ID: 1312231
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
 

Author Comment

by:mandybird44
ID: 1312232
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
 
LVL 1

Accepted Solution

by:
cybsasha earned 40 total points
ID: 1312233
Try this is, its work(two points to use API massage box)
::MessageBox(NULL,"Message", "Caution",MB_OK);

0
 

Expert Comment

by:jaguar_sri
ID: 1312234
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
 
LVL 7

Expert Comment

by:leflon
ID: 1312235
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
 
LVL 1

Expert Comment

by:cybsasha
ID: 1312236
Sorry jaguar_sri , i pass through you comment I agree with you. You are right
0
 

Expert Comment

by:jaguar_sri
ID: 1312237
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
 

Author Comment

by:mandybird44
ID: 1312238
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
 

Author Comment

by:mandybird44
ID: 1312239
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] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question