flat assembler
Message board for the users of flat assembler.
Index
> Windows > how to use OCX in fasm ? Goto page Previous 1, 2 |
Author |
|
Tomasz Grysztar 28 Nov 2004, 04:32
It should be:
Code: DSRCALL eax+soundfx.dsbuffer,DirectSoundBuffer,Release |
|||
28 Nov 2004, 04:32 |
|
madmatt 28 Nov 2004, 14:44
A macro that I invented to use arrays of comobjects, because
the original comcall macro I couldn't get to work correctly with com object arrays, So I modified it slightly and now it works great! Code: ;The macro below that lets you call an array of com-objects ;and there functions macro rcomcall offs,object,proc,[arg] { common if ~ arg eq reverse pushd arg common end if mov eax,[offs+object#.#handle] push eax mov eax,[eax] call [eax+object#.#proc] } ;<<<<< a little example >>>>> ;constants and variables MAXSOUNDS = 64 index dd 0 ;structure of directsound buffer and its data struct pcmsoundtype .dsbuffer DirectSoundBuffer .state dd 0 .rate dd 0 .size dd 0 .id dd 0 ends ;define array of directsound buffer objects soundfx pcmsoundtype times MAXSOUNDS*sizeof.pcmsoundtype db 0 ;calculate offset of com object to call mov [index],25 ;we want to call the 26th com object (NOT 25th!) mov eax,sizeof.pcmsoundtype ;multiply by the size of the sound buffer structure mul [index] mov ecx,eax ;use ecx as the refernce to the object ;call the 25th com object and the function 'Play' rcomcall ecx,soundfx.dsbuffer,Play,0,0,0 ...and thats all there is to it, now you can use arrays of comojects all you want!!!!! MadMatt _________________ Gimme a sledge hammer! I'LL FIX IT! |
|||
28 Nov 2004, 14:44 |
|
vbVeryBeginner 18 Dec 2004, 11:07
hi, privalov,
i could assemble your Small Com Demo but it failed to function whether i click show or hide button, and i wonder what wrong with it? Code: format PE GUI 4.0 entry start include '%fasminc%\win32a.inc' struc GUID d1,d2,d3,d4,d5 { .Data1 dd 0x#d1 .Data2 dw 0x#d2 .Data3 dw 0x#d3 .Data4 db 0x#d4 shr 8,0x#d4 and 0FFh .Data5 db 0x#d5 shr 40,0x#d5 shr 32 and 0FFh,0x#d5 shr 24 and 0FFh,0x#d5 shr 16 and 0FFh,0x#d5 shr 8 and 0FFh,0x#d5 and 0FFh } struc ITaskBarList { .handle dd ? virtual at 0 .QueryInterface dd ? .AddRef dd ? .Release dd ? .HrInit dd ? .AddTab dd ? .DeleteTab dd ? .ActivateTab dd ? .SetActiveAlt dd ? end virtual } CLSCTX_INPROC_SERVER = 0x1 CLSCTX_INPROC_HANDLER = 0x2 CLSCTX_LOCAL_SERVER = 0x4 CLSCTX_INPROC_SERVER16 = 0x8 CLSCTX_REMOTE_SERVER = 0x10 CLSCTX_INPROC_HANDLER16 = 0x20 CLSCTX_INPROC_SERVERX86 = 0x40 CLSCTX_INPROC_HANDLERX86 = 0x80 CLSCTX_ESERVER_HANDLER = 0x100 CLSCTX_NO_CODE_DOWNLOAD = 0x400 CLSCTX_NO_CUSTOM_MARSHAL = 0x1000 CLSCTX_ENABLE_CODE_DOWNLOAD = 0x2000 CLSCTX_NO_FAILURE_LOG = 0x4000 CLSCTX_DISABLE_AAA = 0x8000 CLSCTX_ENABLE_AAA = 0x10000 CLSCTX_FROM_DEFAULT_CONTEXT = 0x20000 ID_EXIT = 0 ID_SHOW = 1 ID_HIDE = 2 IDD_COMDEMO = 1 section '.data' data readable writeable CLSID_TaskbarList GUID 56FDF344,FD6D,11D0,958A,006097C9A090 IID_ITaskbarList GUID 56FDF342,FD6D,11D0,958A,006097C9A090 ShellTaskBar ITaskBarList section '.code' code readable executable start: invoke CoInitialize,NULL invoke CoCreateInstance,\ CLSID_TaskbarList,\ NULL,\ CLSCTX_INPROC_SERVER,\ IID_ITaskbarList,\ ShellTaskBar invoke GetModuleHandle,0 invoke DialogBoxParam,eax,IDD_COMDEMO,HWND_DESKTOP,COMDemo,0 cominvk ShellTaskBar,Release invoke ExitProcess,0 proc COMDemo,hwnd,msg,wparam,lparam push ebx esi edi cmp [msg],WM_INITDIALOG je wminitdialog cmp [msg],WM_COMMAND je wmcommand cmp [msg],WM_CLOSE je wmclose xor eax,eax jmp finish wminitdialog: jmp processed wmcommand: cmp [wparam],BN_CLICKED shl 16 + ID_EXIT je wmclose cmp [wparam],BN_CLICKED shl 16 + ID_SHOW je show cmp [wparam],BN_CLICKED shl 16 + ID_HIDE jne processed hide: cominvk ShellTaskBar,HrInit cominvk ShellTaskBar,DeleteTab,[hwnd] jmp processed show: cominvk ShellTaskBar,HrInit cominvk ShellTaskBar,AddTab,[hwnd] cominvk ShellTaskBar,ActivateTab,[hwnd] jmp processed wmclose: invoke EndDialog,[hwnd],0 processed: mov eax,1 finish: pop edi esi ebx return endp section '.idata' import data readable library kernel, 'KERNEL32.DLL',\ user, 'USER32.DLL',\ ole, 'OLE32.DLL' import kernel,\ GetModuleHandle, 'GetModuleHandleA',\ ExitProcess, 'ExitProcess' import user,\ DialogBoxParam, 'DialogBoxParamA',\ EndDialog, 'EndDialog' import ole,\ CoInitialize, 'CoInitialize',\ CoCreateInstance, 'CoCreateInstance' section '.rsrc' resource data readable directory RT_DIALOG,dialogs resource dialogs,\ IDD_COMDEMO,LANG_ENGLISH+SUBLANG_DEFAULT,comdemo dialog comdemo,'COM demonstration',70,70,170,24,WS_CAPTION+WS_POPUP+WS_SYSMENU+DS_MODALFRAME dialogitem 'BUTTON','Show',ID_SHOW,4,4,45,15,WS_VISIBLE+WS_TABSTOP dialogitem 'BUTTON','Hide',ID_HIDE,54,4,45,15,WS_VISIBLE+WS_TABSTOP dialogitem 'BUTTON','Exit',ID_EXIT,120,4,45,15,WS_VISIBLE+WS_TABSTOP enddialog |
|||
18 Dec 2004, 11:07 |
|
vbVeryBeginner 18 Dec 2004, 13:08
ok, just realise that i am using old window 95 :p
and my Shell32.dll version is 4.00 by the way, anyone who have shell32.dll plez tell me does it work on ur os? Requirements Version 4.71 and later of Shell32.dll |
|||
18 Dec 2004, 13:08 |
|
Goto page Previous 1, 2 < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.