flat assembler
Message board for the users of flat assembler.

Index > Windows > WndProc overhead question ?

Author
Thread Post new topic Reply to topic
Spidark



Joined: 11 May 2005
Posts: 39
Spidark
Hello 2 all.
Another newbie on the block.
I have seen a lot ways to implement your Wndproc function.
But i kinda a like the style below.
My question is does this create to much overhead ( is it bad coding this way ).
Because of the stack frame creation in every message call.
And aslo saving regs in each Message call


And how wil you do it (example please ).
Than you verry much.

Code:
WndProc:
        cmp     dword [esp+8],WM_DESTROY
        je      ON_DESTROY
        cmp     dword [esp+8],WM_CREATE
        je      ON_CREATE
        cmp     dword [esp+8],WM_TIMER
        je      ON_TIMER
        jmp     DEFWIN
        

proc    ON_DESTROY,hWnd,uMsg,wParam,lParam
        invoke   KillTimer,[hWnd],1
        invoke   PostQuitMessage,0
        return
endp

proc    ON_CREATE,hWnd,uMsg,wParam,lParam
        push    edi esi ebx
        invoke  SetTimer,[hWnd],1,2000,0
        pop     ebx esi edi

        return
endp

proc    ON_TIMER,hWnd,uMsg,wParam,lParam
        push    edi esi ebx
        invoke  SendMessage,[hWnd],WM_CLOSE,0,0
        pop     ebx esi edi
        return
endp
proc    DEFWIN,hWnd,uMsg,wParam,lParam
        push    edi esi ebx
        invoke    DefWindowProc,[hWnd],[uMsg],[wParam],[lParam]
        pop     ebx esi edi
        return
endp
    
Post 13 May 2005, 13:36
View user's profile Send private message Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3170
Location: Denmark
f0dder
a small optimization is "mov eax, [esp + parm_msg]", then do the CMPs against EAX. Other than that, it's an okay way of doing things. You can move the most often received messages to the top of the routine for a (mostly theoretical) speed increase.
Post 13 May 2005, 15:05
View user's profile Send private message Visit poster's website Reply with quote
Spidark



Joined: 11 May 2005
Posts: 39
Spidark
f0dder wrote:
a small optimization is "mov eax, [esp + parm_msg]", then do the CMPs against EAX. Other than that, it's an okay way of doing things. You can move the most often received messages to the top of the routine for a (mostly theoretical) speed increase.

Thanks i will optimize it.
Post 13 May 2005, 20:51
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.