Ok, I tried this: .data? hInstance HINSTANCE ? CommandLine LPSTR ? wc WNDCLASSEX <> msg MSG <> hWnd HWND ? uMsg UINT ? wParam WPARAM ? lParam LPARAM ? .... WinMain proc ;nothing here ;get rid of LOCALS ...works fine... WndProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM ...works fine... I change that to: WndProc proc ;nothing here and it compiles ok but no window comes up. I'm using ICZ Tut3 for sample. I think it has something to do with the way that the data is setup Any help would be apprecieated
Posted on 2001-05-27 19:38:00 by Kenny
You can learn and try this.. ..and forget about WndProc..just copy&paste! You will work with MainMessages only! Good luck


MainMessages    DD      WM_COMMAND, OnCommand
                DD      WM_CREATE, OnCreate
                DD      WM_DESTROY, OnDestroy
                DD      WM_PAINT, OnPaint
nMessages       DD      $-MainMessages


WndProc   PROC		;
          mov   eax, nMessages	;u
          mov   ecx, offset MainMessages ;v
          shr   eax, 3  ;u get number of messages to do
          mov   edx,    	;v get uMsg in edx
WndProc_1:			;
          dec   eax	        ;u
          jl    DefWindowProc	;v l=message not found
          cmp   ,edx ;u see if its the correct message
          jnz   WndProc_1	;v no
          push  esp	        ;u save registers as required by Windows

          push  ebp     ;v
          push  ebx     ;u
          push  edi     ;v
          push  esi     ;u
          call  dword ptr  ;v
;call correct procedure for the message
;now =hwnd,=umsg,=wparam,=lparam
           pop   esi	;u
           pop   edi	;v
           pop   ebx	;u
           pop   ebp	;v
           pop   esp    ;u
           jc    DefWindowProc ;v nc=don't call DefWindowProcA eax=exit code
           pop   edx	;u
           pop   ecx	;v
           pop   ebx	;u
           pop   ecx	;v
           pop   ebx	;u
           push  edx	;v
           ret          ;ret 16
WndProc	ENDP            ;
Posted on 2001-05-27 20:31:00 by buliaNaza
I can't seem to get it working so I'm just gonna settle with local for now until I understand windows a little better :)
Posted on 2001-05-28 14:05:00 by Kenny
The hWnd in

    hWnd HWND ?

    WndProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
are two different data areas. Although the assembler and linker are aware of the hWnd in .data?, Windows isn't. The data known as wParam and lParam are sent to your WndProc on the stack, and .data? does not contain stack data. In fact, with the original WndProc PROC declaration, the assembler will convert hWnd to DWORD PTR , uMsg to DWORD PTR , wParam to DWORD PTR , and lParam to DWORD PTR . This message was edited by tank, on 5/29/2001 8:33:58 PM
Posted on 2001-05-29 20:33:00 by tank