• Please review our updated Terms and Rules here

Obscure MessageBox Window

MMoeller

Experienced Member
Joined
Aug 19, 2011
Messages
70
Hi guys,

I currently developing an Windows application which prints various system informations. (Maybe you remember the Thread 'CPU detection utility').

One development aim is, that it even runs under Windows 1.x.

At the beginning the Application should show a MessageBox with text 'test' and the Window title 'test' and a OK/Cancel button.
When I try to run the Application under Windows 2.03, it shows a obscure MessageBox !
Also tried the SetDlgItemText function on a static control and it also prints an obscure string !

The application was compiled with Microsoft C 4.0 (which is the compiler intended for the 1.03 SDK) and the 1.03 SDK.
I have tested it under Windows 3.1, and yes, ..., it works fine
Here a shot: winsyin.jpg

Somebody has a reason for this ??
If someone needs the source code, I will upload it, of course !

With regards,
Martin
 
Here's the source+binary: http://marm.homepage.t-online.de/files/WINSYSIN.zip

The binary is called winsysin.exe. To compile the source, type: nmake sysinfo
If your compiler is not called msc, you need to replace it in the sysinfo Makefile. Maybe replace msc with 'cl -c' works !

Hope this helps, and thanks in advance,
Martin
 
You probably should post at least some of the code. I would have to do some research because it has been a long time since I last wrote code for Windows 2. I did however pull out my Win 2 SDK and Win 3 SDK but I didn't see anything obvious that suggested MessageBox changing in a way that impacts text.

Can you modify your code and have it write the MessageBox string variables to a file just before you call the MessageBox? I suspect that the issue involves changes in memory management.

Are you defining default fonts in your code? That is the only other thing I can think of that would prevent display since Win 2 would be totally confused by the new Win 3 fonts.
 
I have posted a link to the source+binary just before your posting !

What do you mean with writing the string variables to a file ? Do you mean defining the strings in a string table in the resource script ?
It seems that Version 1.03 of the Windows SDK doesn't allows you to define a different font in the resource script for a dialog box, through the FONT keyword.

Just another thing: If I call MessageBox before the call to DialogBox, it displays the Message correctly !?!?!
Don't understand this.

If you have some time, would you please compile the App with the Win 2.0 SDK (or better: would you send me copy of the SDK) ?
 
I noticed the file you posted and have glanced at it. I guess I will have to track down the various diskettes and install an early Windows development environment. I don't want to suggest changes to code unless those are actually problems. The problems with not working with something for 20 years means it is all stored someplace and I don't remember where. Maybe someone else has a early SDK setup and will help. I'd welcome it.

I also see that you have text literals embedded in the MessageBox so those strings should not be in memory that the program isn't correctly accessing. Lot of errors though. I need to think through what they mean. It doesn't look like any of the problems I have seen that caused boxes to display instead of text applies in this case.

The following is a bad technique but I have used it before to debug under Windows 2 when Codeview and the required second monochrome monitor wasn't available:

Given a string that I am not sure is correctly set, I would write it to WIN.INI with WriteProfileString
It is an ugly technique and the number of entries in WIN.INI is limited but much simpler than creating a new file. Glancing at WIN.INI would at least show if I am using the proper handle or if unlocked memory moved out of place.
 
Finally got it working by playing a bit with the compiler switches.
Used the following switches: -Gsw -Os -W2 -Zpe -D LINT_ARGS
Here's a screenshot of the working program: winsysin2.jpg

If i'm ever finished with the complete program, i will post the binary+source here in this forum !!

@krebizfan: Thanks for fast replies.
 
Back
Top