In general, what needs to be done to convert a 16 bit Windows program to Win32? I'm sure I'm not the only person to inherit a codebase and be stunned to find 16-bit code lurking in the corners.
The code in question is C.
wParam
and lParam
have changed in many places. I strongly encourage you to be paranoid and convert as much as possible to use message crackers. They will save you no end of headaches. If there is only one piece of advice I could give you, this would be it.STRICT
. It'll help you catch the Win16 code base using int
where it should be using HWND
, HANDLE
, or something else. Converting these will greatly help with #9 on this list.hPrevInstance
is useless. Make sure it's not used.TCHAR
s, but means you better replace OpenFile
, _lopen
, and _lcreat
with CreateFile
, to name the obviousLibMain
is now DllMain
, and the entire library format and export conventions are differentGlobalAlloc
, LocalAlloc
, GlobalFree
, and LocalFree
should be replaced with more modern equivalents. When done, clean up calls to LocalLock
, LocalUnlock
and friends; they're now useless. Not that I can imagine your app doing this, but make sure you don't depend on WM_COMPACTING
while you're there.SendMessage
or PostMessage
to send pointers to out-of-process windows. You'll need to switch to a more modern IPC mechanism, such as pipes or memory-mapped files.SendMessage
and wait for the message to be processed. That may be a bad idea now. Consider whether PostMessage
isn't a better option.int
to DWORD
and so on where applicable.EDIT: As @ChrisN points out, the official guide for porting Win16 apps to Win32 is available archived, and both fleshes out and adds to my points above.