The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: ragdog on November 09, 2006, 06:27:01 PM

Title: i seach a string macro
Post by: ragdog on November 09, 2006, 06:27:01 PM
Hi @all  :bg

I look for macro for this:

invoke messagesbox,hwnd, "string1", "string2",0

since I do not point like the name is for the macro point I not where after I to search is!

thank you in forward

ragdog
Title: Re: i seach a string macro
Post by: Vortex on November 09, 2006, 06:36:32 PM
.386
.model flat,stdcall
option casemap:none

include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc
include \masm32\macros\macros.asm

includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib

.code

start:

fn MessageBox,0,"Hello world!","Win32asm",MB_OK
fn ExitProcess,0

END start
Title: Re: i seach a string macro
Post by: ragdog on November 09, 2006, 06:42:37 PM
thx!

is the this algo?

  ; -----------------------------------------------------------
  ; This macro replaces quoted text with a DATA section OFFSET
  ; and returns it in ADDR "name" format. It is used by other
  ; macros that handle optional quoted text as a parameter.
  ; -----------------------------------------------------------
    reparg MACRO arg
      LOCAL nustr
        quot SUBSTR <arg>,1,1
      IFIDN quot,<">            ;; if 1st char = "
        .data
          nustr db arg,0        ;; write arg to .DATA section
        .code
        EXITM <ADDR nustr>      ;; append name to ADDR operator
      ELSE
        EXITM <arg>             ;; else return arg
      ENDIF
    ENDM
Title: Re: i seach a string macro
Post by: Vortex on November 09, 2006, 07:01:01 PM
Yes, you are right :

; ----------------------------------------------------------------
  ; invoke enhancement. Add quoted text support to any procedure
  ; or API call by using this macro instead of the standard invoke.
  ; LIMITATION : quoted text must be plain text only, no ascii
  ; values or macro reserved characters IE <>!() etc ..
  ; use SADD() or chr$() for requirements of this type.
  ; ----------------------------------------------------------------
    fn MACRO FuncName:REQ,args:VARARG
      arg equ <invoke FuncName>         ;; construct invoke and function name
      FOR var,<args>                    ;; loop through all arguments
        arg CATSTR arg,<,reparg(var)>   ;; replace quotes and append arg
      ENDM
      arg                               ;; write the invoke macro
    ENDM
Title: Re: i seach a string macro
Post by: ragdog on November 09, 2006, 07:10:51 PM
thx :bg