News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

CoInvoke where to download

Started by GUAN DE DIO, May 27, 2011, 10:39:38 AM

Previous topic - Next topic

GUAN DE DIO

Hi everybody,

    I'm interesting on using the webbrowser control in MASM.

     I found in GoASM forum an source code using atl.dll. The code seems simple and I was thinking to translate it in MASM.
     The problem is that this code uses CoInvoke to handle the COM object. I have seen this before in gdi+ examples but I never found a link to dowload the macro for MASM.   

      Can Someone give a link to download it?

Thanks in advance,
GUAN

donkey

You can write your own, its a pretty simple macro when using 32 bit, 64 bit is a bit more complicated. If you downloaded the atl demo you probably already have the GoAsm header files, the GoAsm syntax macro can be found in macros.h, translating it to MASM is pretty straight-forward.
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

GUAN DE DIO

Hi,

   In AtlDemo.zip has not GoAsm file. The unique header file is ATLDemo.h and inside it I can see the following includes:

#include "WINDOWS.H"
#include "Commctrl.h"
#include "macros.a"
#include "exdisp.h"
#include "atlbase.h"
#include "ExDispid.h"

I supuse the file that I need is "macros.a" 
Could you tell me a link to download it ?  I don't want to download all GoAsm if I can avoid it.

Best Regards,
GUAN

Vortex

Hi GUAN DE DIO,

Here is a simple coinvoke macro :



coinvoke MACRO ppv:REQ,interface:REQ,member:REQ,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16

    FOR arg,<p16,p15,p14,p13,p12,p11,p10,p9,p8,p7,p6,p5,p4,p3,p2,p1>

        IFNB <arg>

            push arg

        ENDIF

    ENDM

    mov     eax,ppv
    push    eax
    mov     eax,DWORD PTR [eax]
    call    interface.member[eax]

ENDM


Here, you can find a working example :

http://www.masm32.com/board/index.php?topic=15797.0

You can modify the macro to meet your requirements.

MichaelW

I did this a while back for yet another unfinished project. I recall that it passed my preliminary tests, but I can't find my test code so I don't actually know that it works.

==============================================================================

;----------------------------------------------------------------------------
; This is Donkey's 32-bit CoInvoke macro for GoAsm converted to MASM syntax,
; using a double loop arrangement to push the arguments in reverse order.
;----------------------------------------------------------------------------

CoInvoke MACRO pInterface:REQ,Method:REQ,args:VARARG
    N = 0
    ;; count the args
    FOR arg, <args>
      N = N + 1
    ENDM
    IF N
      ;; push the args in right to left order
      I = N
      FOR arg, <args>
        J = 0
        FOR arg2, <args>
          J = J + 1
          IF J EQ I
            push arg
            ;; done with current arg, exit arg2 for loop
            EXITM     
          ENDIF
        ENDM
        I = I - 1
      ENDM

    ENDIF
    push pInterface
    mov eax, pInterface
    mov eax, [eax]
    add eax, Method
    call [eax]
ENDM

;==============================================================================

eschew obfuscation

donkey

Quote from: GUAN DE DIO on May 27, 2011, 05:12:05 PM
Hi,

   In AtlDemo.zip has not GoAsm file. The unique header file is ATLDemo.h and inside it I can see the following includes:

#include "WINDOWS.H"
#include "Commctrl.h"
#include "macros.a"
#include "exdisp.h"
#include "atlbase.h"
#include "ExDispid.h"

I supuse the file that I need is "macros.a" 
Could you tell me a link to download it ?  I don't want to download all GoAsm if I can avoid it.

Best Regards,
GUAN

Hi,

Use one of the MASM macros MichaelW or Vortex posted, the macros.h (formerly macros.a) file is part of the GoAsm headers and is not available for separate download. If you still wish to download it you can find the headers at my website.

Edgar
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

GUAN DE DIO

A lot of Thanks for the support.

Best Regards,
GUAN

GUAN DE DIO

Hi,

     With your suppor,t I have could obtain the translation of AtlDemo sample into MASM32.
     Currently, I'm playing with the property of the component to learn more about it.

      I notice that some changes on the code has not effect, and I don't know why.
      For example

     CoInvoke(pIWebBrowser2,IWebBrowser2.put_AddressBar,VARIANT_FALSE) // Original statement

     CoInvoke(pIWebBrowser2,IWebBrowser2.put_AddressBar,VARIANT_TRUE) //  Changed statement

     With this change, it is suppose  that the addressbar will be shown on the embedded component, but nop, no effect.

     Can Someone tell me what I do wrong?

Thanks,
GUAN