flat assembler
Message board for the users of flat assembler.

Index > Windows > Passing polymorphic types to procedures?

Author
Thread Post new topic Reply to topic
bitshifter



Joined: 04 Dec 2007
Posts: 796
Location: Massachusetts, USA
bitshifter 23 Jan 2009, 17:09
Hello, i am trying to pass data from my window procedure off to
a message handling function and need to know how.

In the WindowProc...
Code:
...
   .wmcreate:
      stdcall OnCreate,[hwnd],[lparam]
      jmp .finish
...
    


The message handler...
Code:
proc OnCreate hwnd,lpCreateStruct
...
ret
endp
    


Now how does lpcs point to the CREATESTRUCT?
Post 23 Jan 2009, 17:09
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 23 Jan 2009, 17:19
Code:
proc OnCreate hwnd,lpCreateStruct
; Lets make it a 4:3 window
mov eax, [lpCreateStruct]
mov edx, [eax+CREATESTRUCT.cx]
lea edx, [edx*3]
shr edx, 2
mov [eax+CREATESTRUCT.cy], edx
ret
endp    

(The code could not be doing what the comment says Razz)
Post 23 Jan 2009, 17:19
View user's profile Send private message Reply with quote
bitshifter



Joined: 04 Dec 2007
Posts: 796
Location: Massachusetts, USA
bitshifter 23 Jan 2009, 18:29
So to get the CREATESTRUCT::HINSTANCE i can do it like this?
Code:
proc OnCreate hwnd,lpCreateStruct
   mov eax,[lpCreateStruct]
   mov edx,[eax+CREATESTRUCT.hInstance]
   ; edx now contains HINSTANCE ?
ret
endp
    
Post 23 Jan 2009, 18:29
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 23 Jan 2009, 18:32
That is correct, edx now contains lpCreateStruct->hInstance.
Post 23 Jan 2009, 18:32
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.