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.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
wParamandlParamhave 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 usingintwhere it should be usingHWND,HANDLE, or something else. Converting these will greatly help with #9 on this list.hPrevInstanceis useless. Make sure it’s not used.TCHARs, but means you better replaceOpenFile,_lopen, and_lcreatwithCreateFile, to name the obviousLibMainis nowDllMain, and the entire library format and export conventions are differentGlobalAlloc,LocalAlloc,GlobalFree, andLocalFreeshould be replaced with more modern equivalents. When done, clean up calls toLocalLock,LocalUnlockand friends; they’re now useless. Not that I can imagine your app doing this, but make sure you don’t depend onWM_COMPACTINGwhile you’re there.SendMessageorPostMessageto 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.SendMessageand wait for the message to be processed. That may be a bad idea now. Consider whetherPostMessageisn’t a better option.inttoDWORDand 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.