The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: localmotion34 on May 31, 2007, 05:54:23 PM

Title: What is FUNC???
Post by: localmotion34 on May 31, 2007, 05:54:23 PM
i have this code block from source DougieM wrote for a custom control.  I get a "sytax error" at a statement like this:

; select type of background if gif is transparant
  .if FUNC(GetObject,[ebx].backg,0,0) == sizeof LOGBRUSH   <<-------- DIES RIGHT HERE
      invoke FillRect,memdc,addr [ebx].rc,[ebx].backg; if a brush has been sent in backg
  .else                                              ; fill with brush
      invoke CreateCompatibleDC,hdc
      mov backdc,eax
      invoke SelectObject,backdc,[ebx].backg        ; or a bitmap
      push eax                                      ; then copy backg bmp into our memdc
      invoke BitBlt,memdc,0,0,[ebx].rc.right,[ebx].rc.bottom,backdc,0,0,SRCCOPY   
      pop eax
      invoke SelectObject,backdc,eax
      invoke DeleteDC,backdc
  .endif


Why is the compiler dying right here at this point?
Title: Re: What is FUNC???
Post by: ragdog on May 31, 2007, 05:57:04 PM
hi

is a invoke macro



  FUNC MACRO parameters:VARARG
        invoke parameters
        EXITM <eax>
      ENDM


greets
ragdog
Title: Re: What is FUNC???
Post by: Vortex on May 31, 2007, 06:05:59 PM
localmotion34,

Here is a quick example :

mov hModule,FUNC(GetModuleHandle,0)

is equivalent to :

invoke GetModuleHandle,0
mov hModule,eax
Title: Re: What is FUNC???
Post by: localmotion34 on May 31, 2007, 06:25:59 PM
Thanks to you both!!!

i included the macro, and boom, the LIB compiled.  There are so many macros for MASM, i'm having trouble reading much of any code without having to constantly search for macro.inc files. 
Title: Re: What is FUNC???
Post by: ragdog on May 31, 2007, 06:34:02 PM
you must simply search in the board or with google for the appropriate macro!

and it more simply to coding if one macros uses :U

ragdog
Title: Re: What is FUNC???
Post by: Vortex on May 31, 2007, 07:10:59 PM
localmotion34,

Never hesitate to post here your questions. To study the basic principles of MASM macros, have a look at here :

Chapter Nine: Using Macros

http://webster.cs.ucr.edu/Page_TechDocs/MASMDoc/ProgrammersGuide/Chap_09.htm
Title: Re: What is FUNC???
Post by: hutch-- on May 31, 2007, 07:33:27 PM
localmotion34,

Use the existing HELP FILE in masm32 for all of the high leel help. Thats what its there for. MASM is a macro assembler and this is used to simplify much of the code for people leqarning assembler programming.