.586
.model flat,stdcall
option casemap:none
;for extcall
include C:\masm32\INCLUDEX\ARGCOUNT.ASM 
include C:\masm32\include\windows.inc
include C:\masm32\includex\user32.inc
include C:\masm32\includex\kernel32.inc
include C:\masm32\includex\gdi32.inc
include C:\masm32\include\masm32.inc
includelib kernel32.lib
includelib user32.lib
includelib gdi32.lib
includelib masm32.lib
iPUSHr4 MACRO val:REQ
    db 68h
    REAL4 val
ENDM
 WM_CASE macro reg,msgs
 irp msg,<msgs>
	cmp reg,WM_&msg
	je @@&msg
 endm
endm

hInstance equ 400000h
Scall MACRO name:REQ,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12, \
                     p13,p14,p15,p16,p17,p18,p19,p20,p21,p22

    ;; ---------------------------------------
    ;; loop through arguments backwards, push
    ;; NON blank ones and call the function.
    ;; ---------------------------------------

    FOR arg,<p22,p21,p20,p19,p18,p17,p16,p15,p14,p13,\
             p12,p11,p10,p9,p8,p7,p6,p5,p4,p3,p2,p1>
      IFNB <arg>    ;; If not blank
        push arg    ;; push parameter
      ENDIF
    ENDM

    call name       ;; call the procedure

ENDM
