flat assembler
Message board for the users of flat assembler.

Index > Windows > how to use OCX in fasm ?

Goto page Previous  1, 2
Author
Thread Post new topic Reply to topic
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7756
Location: Kraków, Poland
Tomasz Grysztar
It should be:
Code:
DSRCALL eax+soundfx.dsbuffer,DirectSoundBuffer,Release    
Post 28 Nov 2004, 04:32
View user's profile Send private message Visit poster's website Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt
Hey, thanks for your help, I got it working now! Whew! Took me all day to figure this one out. I should have used the original one the right way!
DSCALL eax+soundfx.dsbuffer
Post 28 Nov 2004, 06:47
View user's profile Send private message Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt
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!
Post 28 Nov 2004, 14:44
View user's profile Send private message Reply with quote
vbVeryBeginner



Joined: 15 Aug 2004
Posts: 884
Location: \\world\asia\malaysia
vbVeryBeginner
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
    
Post 18 Dec 2004, 11:07
View user's profile Send private message Visit poster's website Reply with quote
vbVeryBeginner



Joined: 15 Aug 2004
Posts: 884
Location: \\world\asia\malaysia
vbVeryBeginner
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
Post 18 Dec 2004, 13:08
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.