News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

'chaining' a splash screen and the main window

Started by bonobo, July 28, 2006, 10:26:11 PM

Previous topic - Next topic

bonobo

Hello,

I have an application that launches a dialog box on start (that's what I call splash screen)
and when it closes, the application crashes before calling winMain.

(DialogBoxParam returns to some place in user32)




.586
.model flat,stdcall
option casemap:none

.CODE

start:
invoke GetModuleHandle, NULL
mov hInstance,eax
invoke GetCommandLine
mov CommandLine,eax

;******splash screen******
INVOKE DialogBoxParam,hInstance,IDD_SPLASH,NULL,ADDR SplashProc,NULL

;******WinMain******
invoke WinMain,hInstance,NULL,CommandLine, SW_SHOWDEFAULT
invoke ExitProcess, eax

SplashProc proc uses esi edi ebx hWnd:DWORD,uMsg:DWORD,wParam:DWORD,lParam:DWORD
.IF uMsg == WM_COMMAND
    mov eax,wParam
    mov edx,eax
    shr edx,16
    and eax,0FFFFh
    .if edx==BN_CLICKED
        .if eax==SPLASH_CLOSE
            invoke EndDialog,hWnd,NULL
            push 0
            call ExitProcess
        .elseif eax==SPLASH_CONTINUE
            invoke EndDialog,hWnd,NULL
        .endif
    .endif
.ELSEIF uMsg == WM_CLOSE
    invoke SendMessage,hWnd,WM_COMMAND,SPLASH_CLOSE,0
.ENDIF
    mov eax, FALSE
ret ;here returns to user32
SplashProc endp

WndProc proc uses esi edi ebx hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
WndProc endp

WinMain proc hInst:HINSTANCE,hPrevInst:HINSTANCE,CmdLine:LPSTR,CmdShow:DWORD
WinMain endp

end start


The message handling works fine (clicks on buttons are triggered) and the WinMain works fine when the splash screen is not there.

thanks for any help

MichaelW

I can't test this, but I suspect the problem is the call to ExitProcess in SplashProc.
eschew obfuscation

bonobo

Quote from: MichaelW on July 28, 2006, 11:42:17 PM
I can't test this, but I suspect the problem is the call to ExitProcess in SplashProc.

I can't see why it would be a problem?
The exit button works fine. It's on ly when I press continue that it crashes.
The program exits the .IF/.ENDIF and when it reaches the last RET, it crashes.