Re: Windows XP: message box with no other GUI does not work
- Posted by petelomax Feb 22, 2011
- 1633 views
I know Matt has already comitted a fix by invoking InitCommonControlsEx(), but since this came up again... though I hesitate to send anyone off on a pointless wild goose chase...
Last week I stumbled across some code I added to my copy of arwen last September:
if 01 then -- PL 05/09/2010 (the demo program edita/f.exw failed under exw -- apparently because it didn't open_dll("shell32.dll")... ???) createWindowParams = {dwExStyle, -- extended style lpszClassName, -- window class name lpszWindowName, -- window caption or Button text etc.. dwStyle, -- window style x, -- initial x position y, -- initial y position nWidth, -- initial x size nHeight, -- initial y size pHwnd, -- parent window handle NULL, -- window menu handle OR user id for child windows NULL, -- program instance handle - Legacy of Win16 apps. 0 will work too. NULL} -- creation parameters --?createWindowParams ePrev = 0 while 1 do hwnd = c_func(xCreateWindowEx, createWindowParams) if hwnd!=NULL then exit end if -- ERROR_TLW_WITH_WSCHILD = 1406, -- ERROR_CANNOT_FIND_WND_CLASS = 1407, -- ERROR_CLASS_DOES_NOT_EXIST = 1411, eCode = c_func(xGetLastError,{}) if ePrev=0 and (eCode=ERROR_CANNOT_FIND_WND_CLASS or eCode=ERROR_CLASS_DOES_NOT_EXIST) then ePrev = eCode if not registerClass(classname,0,WndProcCallBack,NULL,NULL,COLOR_BTNFACE+1) then -- (the [2] is just so you know it's this message not the one above) FatalErr("Registration[2] of new window class: "& classname &" failed.") end if else printf(1,"Control creation routine failed with error code %d.\n",eCode) return 0 end if end while else -- old code: hwnd = c_func(xCreateWindowEx, { dwExStyle, -- extended style lpszClassName, -- window class name lpszWindowName, -- window caption or Button text etc.. dwStyle, -- window style x, -- initial x position y, -- initial y position nWidth, -- initial x size nHeight, -- initial y size pHwnd, -- parent window handle NULL, -- window menu handle OR user id for child windows NULL, -- program instance handle - Legacy of Win16 apps. 0 will work too. NULL}) -- creation parameters --?hwnd if hwnd=NULL then --?getLastError() ?9/0 WarnErr("Control creation routine failed.") return 0 end if end if
so if I get an ERROR_CANNOT_FIND_WND_CLASS or ERROR_CLASS_DOES_NOT_EXIST (=1411), I now try registering the unknown class and re-try the CreateWindowEx, at most once.
I cannot see how this could apply to msgbox.e, but someone else might.
Of course I fully accept that precious time is usually better spent fixing things that are still broken
Pete