Path: utzoo!utgpu!watserv1!watmath!att!dptg!ulysses!andante!mit-eddie!media-lab!snorkelwacker!usc!elroy.jpl.nasa.gov!ncar!mephisto!mcnc!rti!bcw From: bcw@rti.rti.org (Bruce Wright) Newsgroups: comp.windows.ms Subject: Re: MessageBox problem Summary: MessageBox problems Message-ID: <4060@rtifs1.UUCP> Date: 10 Sep 90 05:30:04 GMT References: <1990Sep9.224303.10981@bdmrrr.bdm.com> Organization: Research Triangle Institute, RTP, NC Lines: 40 In article <1990Sep9.224303.10981@bdmrrr.bdm.com>, davis@bdmrrr.bdm.com (Arthur Davis x4675) writes: > Someone mentioned having a problem with garbled strings in a > MessageBox call; i.e. MessageBox (hDlg, "abc", "xyz", MB_OK) > produces garbage on the display. > > [...] > > Try this: > > MessageBox (hDlg, (LPSTR) "abc", (LPSTR) "xyz", MB_OK); > > This will force the pass of a FAR or long address and should solve your > problem. If you are using the Microsoft SDK, the windows.h file defines MessageBox as: int FAR PASCAL MessageBox (HWND, LPSTR, LPSTR, WORD); Unless your C compiler has some serious problems with parameter definitions, you shouldn't need to use the (LPSTR) in the call to MessageBox. It's possible that the strings are getting clobbered by a runaway pointer in another part of the program. But the fact that the MessageBox call is using an hDlg handle makes me wonder if the original author was calling this from a dialog box window. If so, one of the first things to look for would be to see if a MakeProcInstance call was made for the dialog box procedure, and if the procedure itself was exported in the .DEF file. Failure to do either of these can cause serious problems that can sometimes show up in flakey ways. Also check for whether the application has any memory or resource leaks (allocating memory or resources without releasing them); this can also sometimes cause funny behavior (including screen garbage, depending on what the application is doing and the mode Windows was started in). Bruce C. Wright