Pelles C forum

Assembly language => Assembly discussions => Topic started by: Vortex on April 26, 2025, 09:35:57 PM

Title: Revisited COM examples
Post by: Vortex on April 26, 2025, 09:35:57 PM
With thanks to Pelle, here are some COM examples rebuilt with Poasm Version 13.

SetWallPaper.zip : Example changing the wallpaper
SaveClipbToBitmap.zip : Command-line application saving the clipboard to a bitmap file
Title: Re: Revisited COM examples
Post by: TimoVJL on April 27, 2025, 12:41:50 PM
An example to create interface STRUCTS for INC-file

EDIT: An example was broken
EDIT: New example using msvcrt.dll  remove define USE_MSVCRT for normal use
EDIT: print GUIDs
EDIT: print STRUCTs and UNIONs
EDIT: commandline support
Title: Re: Revisited COM examples
Post by: Vortex on April 27, 2025, 12:49:49 PM
Hi Timo,

Thanks. How to use your tool to create the include file defining the interface IPicture necessary to build the example saving the clipboard?
Title: Re: Revisited COM examples
Post by: TimoVJL on April 27, 2025, 02:44:30 PM
IPicture is at least in StdOle2.tlb

IPicture STRUCT
        ; IUnknown Functions:
        QueryInterface
        AddRef
        Release
        ; IPicture Functions:
        get_Handle
        get_hPal
        get_Type
        get_Width
        get_Height
        Render
        put_hPal
        get_CurDC
        SelectPicture
        get_KeepOriginalFormat
        put_KeepOriginalFormat
        PictureChanged
        SaveAsFile
        get_Attributes
        SetHdc
IPicture ENDS
Title: Re: Revisited COM examples
Post by: Vortex on April 27, 2025, 08:27:49 PM
Hi Timo,

Thanks, the stuctures should define the methods with DWORDs for 32-bit and QWORDs for 64-bit coding.

IPicture STRUCT
        ; IUnknown Functions:
        QueryInterface dd ?
        AddRef        dd ?
        Release        dd ?
        ; IPicture Functions:
        get_Handle    dd ?
        get_hPal      dd ?
.
.
        SaveAsFile    dd ?
        get_Attributes dd ?
        SetHdc        dd ?
IPicture ENDS
Title: Re: Revisited COM examples
Post by: TimoVJL on April 27, 2025, 08:35:52 PM
Just a command line option for ml for static text ?

A poasm accept ptr ?
IPicture STRUCT
        ; IUnknown Functions:
        QueryInterface  ptr ?
        AddRef  ptr ?
        Release ptr ?
        ; IPicture Functions:
        get_Handle      ptr ?
        get_hPal        ptr ?
        get_Type        ptr ?
        get_Width       ptr ?
        get_Height      ptr ?
        Render  ptr ?
        put_hPal        ptr ?
        get_CurDC       ptr ?
        SelectPicture   ptr ?
        get_KeepOriginalFormat  ptr ?
        put_KeepOriginalFormat  ptr ?
        PictureChanged  ptr ?
        SaveAsFile      ptr ?
        get_Attributes  ptr ?
        SetHdc  ptr ?
IPicture ENDS
Title: Re: Revisited COM examples
Post by: Vortex on April 27, 2025, 09:08:00 PM
Hi Timo,

Exactly, the PTR notations works too.
Title: Re: Revisited COM examples
Post by: Vortex on April 28, 2025, 02:42:41 PM
Hi Timo,

Thanks, I had a quick look on your latest tools. Nice job. Back home, I will have more time to focus on the output of the tools.
Title: Re: Revisited COM examples
Post by: TimoVJL on April 28, 2025, 04:33:36 PM
Name for that project could be TLB2poasmInc, as it harly never support masm.
Others can make support for masm too or just similar for masm.
I am not an assembler programmer, so projects goes just in baby steps.
Title: Re: Revisited COM examples
Post by: Vortex on April 28, 2025, 08:10:42 PM
Hi Timo,

TLB2poasmInc looks like a good name, take your time to develop the tool. A modest suggestion, you can instruct the tool to take one command-line paramater, the name of the .tlb file

Your syntax with angle bracket works, I test it :

;CLSID_SpVoice GUID {096749377h,03391h,011D2h,<09Eh,0E3h,000h,0C0h,04Fh,079h,073h,096h>}
sCLSID_SpVoice TEXTEQU <<096749377h,03391h,011D2h,<09Eh,0E3h,000h,0C0h,04Fh,079h,073h,096h>>>
CLSID_SpVoice GUID sCLSID_SpVoice