flat assembler
Message board for the users of flat assembler.

Index > Windows > how to use OCX in fasm ?

Goto page 1, 2  Next
Author
Thread Post new topic Reply to topic
Nguga



Joined: 07 Nov 2003
Posts: 4
Nguga 07 Nov 2003, 03:12
well i´m a NASM user but FASM is ok Smile i just want some help on using OCX

i´m traing to use this OCX :

Hauppauge WinTV? OCX

http://www.hauppauge.com


and i want to use some METHODS :

GeneralMethods
CopyToClipboard
PrintImage
SaveToDisk
SaveToDiskEx
ShowAboutBox
ShowAudioControlBox
ShowChannelExplorer
ShowColorControlBox
ShowVideoControlBox
WinTV Control Methods
ChannelUp
ChannelDown
ToggleFreezeVideo
ToggleMute
SurfStart
SurfEnd
VolumeUp
VolumeDown



but this OCX only exports this:

DllCanUnloadNow
DllGetClassObject
DllRegisterServer
DllUnregisterServer

then what the f*ck is a GUI ?

for example this one:

/Hauppauge WinTV OCX
//Version: 11.17
hcwWinTVControl;
GUID = {2B143B63-055B-11D2-A96D-00A0C92A2D0F};
Dispatch _hcwWinTVocx;
GUID = {AEB1C2D7-3312-11D4-8147-00A0C9B03BA8};

what is a GUI in real assembly ?


for example if i want to use directdraw in NASM using NaGoA macros i just do this :

..start:
sectiondata
lpDD dd 0
sectioncode
call DirectDrawCreate,NULL,lpDD,NULL
or eax,eax
jne near goError1
call MessageBoxA,0,"DirectDrawCreated OK !","directdraw",MB_ICONHAND | MB_OK
goOn:
sectiondata
DDSetCooperativeLevel equ 80
DDSCL_NORMAL equ 8
sectioncode
CALLCOM lpDD,DDSetCooperativeLevel,0,DDSCL_NORMAL
or eax,eax
jne near goError2
goOut2:
call MessageBoxA,0,"SetCooperativeLevel OK !","comcall",MB_ICONHAND | MB_OK
sectiondata
SetDisplayMode equ 84
sectioncode
CALLCOM lpDD,SetDisplayMode,640,480,8
or eax,eax
jne near goError3
call MessageBoxA,0,"SetDisplayMode OK !","comcall",MB_ICONHAND | MB_OK
jmp goOut
goOut:
call ExitProcess,0
ret
goError1:
call MessageBoxA,0,"DirectDrawCreate Error.. !","comcall",MB_ICONHAND | MB_OK
jmp goOut
goError2:
call MessageBoxA,0,"SetCooperativeLevel Error.. !","comcall",MB_ICONHAND | MB_OK
jmp goOut
goError3
call MessageBoxA,0,"SetDisplayMode Error.. !","comcall",MB_ICONHAND | MB_OK
jmp goOut




i post that becouse i think OCX is + - like COM i think ...


so please how can i use a OCX in FASM or NASM ... Smile

can any one post a litle simple example ?
Thanks !


Nguga
Post 07 Nov 2003, 03:12
View user's profile Send private message Reply with quote
XtcC



Joined: 04 Nov 2003
Posts: 2
XtcC 07 Nov 2003, 03:53
there is alot of includes and shit in OCX´s, like CLSID,typelib and more..
ive seen some example made in Masm by Jophet i think.. its called AsmCtrl and shows up a property tab in windows "property" of files..

_________________
/be there you want to be.
Post 07 Nov 2003, 03:53
View user's profile Send private message Reply with quote
Nguga



Joined: 07 Nov 2003
Posts: 4
Nguga 07 Nov 2003, 04:02
not that one ...

i want just a simple example just calling one method from a OCX

just that Smile .

thanks !
Post 07 Nov 2003, 04:02
View user's profile Send private message Reply with quote
scientica
Retired moderator


Joined: 16 Jun 2003
Posts: 689
Location: Linköping, Sweden
scientica 07 Nov 2003, 05:26
Nguga wrote:
then what the f*ck is a GUI ?

for example this one:

/Hauppauge WinTV OCX
//Version: 11.17
hcwWinTVControl;
GUID = {2B143B63-055B-11D2-A96D-00A0C92A2D0F};
Dispatch _hcwWinTVocx;
GUID = {AEB1C2D7-3312-11D4-8147-00A0C9B03BA8};

what is a GUI in real assembly ?

GUI is short for Graphical User Interface, an dit's the gaphical layer of an application.
But a GUID is something else, iirc it stands for Global Unique IDentifier (not sure thougt), it's intended to be an unique ID, used in COM for instance.

_________________
... a professor saying: "use this proprietary software to learn computer science" is the same as English professor handing you a copy of Shakespeare and saying: "use this book to learn Shakespeare without opening the book itself.
- Bradley Kuhn
Post 07 Nov 2003, 05:26
View user's profile Send private message Visit poster's website Reply with quote
MazeGen



Joined: 06 Oct 2003
Posts: 977
Location: Czechoslovakia
MazeGen 08 Nov 2003, 20:48
Nguga wrote:
...

i want just a simple example just calling one method from a OCX

just that Smile .

thanks !


could it help you how is it in MASM?

Ocx in masm

_________________
x86asm.net
Post 08 Nov 2003, 20:48
View user's profile Send private message Visit poster's website Reply with quote
Nguga



Joined: 07 Nov 2003
Posts: 4
Nguga 22 Nov 2003, 03:15
well i asked for help on acessing the functions that are not exported in dll and ocx , nobody helped me so i found my self a NASM way Smile

using NAGOA



%include '\lab\vasm\inc\nagoa.inc'

STRUC GUID
.Data1 resd 1
.Data2 resw 1
.Data3 resw 1
.Data4 resb 8
ENDSTRUC

CLSCTX_INPROC_SERVER equ 1



[segment data USE32]

DIALOG_ID equ 100

;================================================
; we can see methods as functions inside a dll or ocx that are not exported
; ================================================
; Declaration of VTable that includes the pointers to the
; methods. Note that it always includes 3 methods of IUnknown
; In fact, all the COM interfaces are built like this.
; ================================================
STRUC ITaskBarList
;==This are pointers to IUnknown interface
.QueryInterface resd 1
.AddRef resd 1
.Release resd 1
;==This are pointers to Methods (functions) of ITaskbarlist

.HrInit resd 1
.AddTab resd 1
.DeleteTab resd 1
.ActivateTab resd 1
.SetActiveAlt resd 1
ENDSTRUC
;================================================





;=== CLSID_TaskbarList '56FDF344-FD6D-11D0-958A-006097C9A090'

CLSID_TaskbarList:
ISTRUC GUID
AT GUID.Data1 , dd 56FDF344h
AT GUID.Data2 , dw 0FD6Dh
AT GUID.Data3 , dw 11D0h
AT GUID.Data4 , db 95h,8Ah,0,60h,97h,0C9h,0A0h,90h
IEND

;=== IID_ITaskbarList '56FDF342-FD6D-11D0-958A-006097C9A090'

IID_ITaskbarList:
ISTRUC GUID
AT GUID.Data1 , dd 56fdf342h
AT GUID.Data2 , dw 0FD6Dh
AT GUID.Data3 , dw 11D0h
AT GUID.Data4 , db 95h,8Ah,0,60h,97h,0C9h,0A0h,90h
IEND





[segment code USE32]

..start:
call GetModuleHandleA, NULL
CONST hInst , dd 0
mov [hInst], eax
call DialogBoxParamA, [hInst],DIALOG_ID, 0,DialogProc, 0
call ExitProcess, [hInst]


; ============ [ MAIN DIALOLOG PROC ] =====

proc DialogProc,hdlg,msg,wParam,lParam

cmp dword [msg],WM_INITDIALOG
je wm_inidialog
cmp dword [msg],WM_COMMAND
je near wm_command
;cmp dword [msg],WM_PAINT
;je near wm_paint
cmp dword [msg],WM_CLOSE
je near wm_close
return FALSE

;; =============
wm_inidialog:

return TRUE

;; =============
wm_command:

cmp dword [wParam], 1002 ; show on taskbar ?

je show


return TRUE

;; =============
show:
invoke ShowOnTaskbar,[hdlg]
return FALSE
;; =============

wm_close:
call ExitProcess,0
return FALSE
;------------
endproc ; ===[ MAIN DIALOGPROC END ] ========





; ---------[ ShowOnTaskbar ] ------------------------
proc ShowOnTaskbar,hWin
sectiondata
ShellTaskBar resb ITaskBarList_size
sectioncode
call CoInitialize,NULL
call CoCreateInstance,CLSID_TaskbarList,NULL,CLSCTX_INPROC_SERVER,IID_ITaskbarList,ShellTaskBar
callcom ShellTaskBar,ITaskBarList.HrInit
callcom ShellTaskBar,ITaskBarList.AddTab,[hWin]
callcom ShellTaskBar,ITaskBarList.ActivateTab,[hWin]
endproc
; ---------[ ShowOnTaskbar END ] ---------------------


Smile thanks any way !
Post 22 Nov 2003, 03:15
View user's profile Send private message Reply with quote
LiuGuoHua(Chinese)



Joined: 26 Sep 2003
Posts: 25
LiuGuoHua(Chinese) 18 Apr 2004, 08:31
Really good !
I 'd search for a way to use ocx1
but i still want one to do it in fasm
because i don't know how to do "callcom"
Post 18 Apr 2004, 08:31
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8359
Location: Kraków, Poland
Tomasz Grysztar 18 Apr 2004, 10:01
Code:
format PE GUI 4.0
entry start

include 'win32a.inc'

macro comcall object,proc,[arg]
 { common
    if ~ arg eq
   reverse
     pushd arg
   common
    end if
    mov eax,[object#.#handle]
    push eax
    mov eax,[eax]
    call [eax+object#.#proc] }

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

        comcall 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:
        comcall ShellTaskBar,HrInit
        comcall ShellTaskBar,DeleteTab,[hwnd]
        jmp     processed
  show:
        comcall ShellTaskBar,HrInit
        comcall ShellTaskBar,AddTab,[hwnd]
        comcall 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 Apr 2004, 10:01
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8359
Location: Kraków, Poland
Tomasz Grysztar 19 Apr 2004, 07:25
Maybe I should even include those COM macros and some example in the official distribution?
Or at least I'll put it into the new "examples" section, when it finally comes to life.
Post 19 Apr 2004, 07:25
View user's profile Send private message Visit poster's website Reply with quote
coconut



Joined: 02 Apr 2004
Posts: 326
Location: US
coconut 19 Apr 2004, 10:54
definately
Post 19 Apr 2004, 10:54
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 19 Apr 2004, 18:52
maybe you could think about some way how to accomplish that COM stuff with non-static interface pointers (like interface pointer that is stored in edi). I wasn't able to do this using your macros.
Post 19 Apr 2004, 18:52
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8359
Location: Kraków, Poland
Tomasz Grysztar 19 Apr 2004, 19:18
Maybe such two macros:
Code:
macro cominvk object,proc,[arg]
 { common
    if ~ arg eq
   reverse
     pushd arg
   common
    end if
    mov eax,[object#.#handle]
    push eax
    mov eax,[eax]
    call [eax+object#.#proc] }

macro comcall handle,object,proc,[arg]
 { common
    if ~ arg eq
   reverse
     pushd arg
   common
    end if
    if handle eqtype ebx | handle eqtype 0
     push handle
     local ..handle
     label ..handle at handle
     mov eax,[..handle]
    else
     mov eax,handle
     push eax
     mov eax,[eax]
    end if
    local ..interface
    virtual
    ..interface object
    end virtual
    call [eax+..interface#.#proc] }    

and then:
Code:
        cominvk ShellTaskBar,HrInit
        cominvk ShellTaskBar,DeleteTab,[hwnd]    

or:
Code:
        comcall [ShellTaskBar],ITaskBarList,HrInit
        comcall [ShellTaskBar],ITaskBarList,DeleteTab,[hwnd]    

or finally:
Code:
        mov     edi,[ShellTaskBar]
        comcall edi,ITaskBarList,HrInit
        comcall edi,ITaskBarList,DeleteTab,[hwnd]    
Post 19 Apr 2004, 19:18
View user's profile Send private message Visit poster's website Reply with quote
metalfishx



Joined: 30 Sep 2004
Posts: 65
Location: Florida, Uruguay
metalfishx 15 Oct 2004, 14:32
Hello!, im needing to execute one com object functions.. but...
The macros are very good and all is working fine thanks to Pivalov... but what about obtain the GUID automaticcaly ussing the name or something?
VC# and others ides when you add a reference shows all the registered ocx; this is the thing, how to find in the system registered ocx or just in the ocx file the GUID and just call the functions? ... i saw some Basic interpreters like Rapid Q that uses a simple way to call a the registered name string and automatically creates one variable with the references of all functions... hack? mmm Smile
Ill try to investigate a little more for my side, but, im newbye, heres lots of masters Smile

Cheers and Thanks!

_________________
---------------------------------------
Roberto A. Berrospe Machin
Ruta Internet, Florida Uruguay
---------------------------------------
Post 15 Oct 2004, 14:32
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8359
Location: Kraków, Poland
Tomasz Grysztar 24 Nov 2004, 17:39
With the latest fasmw update the "cominvk" and "comcall" macros are defined by standard headers (DirectDraw example has been updated to use this new feature). There are still no GUID macros there, as there seems to be no agreed good solution on how to define them.
Post 24 Nov 2004, 17:39
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 27 Nov 2004, 11:12
Hello,
I've tried the new comcall macro, and It gives me an illegal instruction in this line of the macro code:
..interface object
I'd like to be able to call a DirectDraw (com) function by reference:
comcall [eax] , ......
or
comcall [varholdingobjectaddress] , ......
Post 27 Nov 2004, 11:12
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8359
Location: Kraków, Poland
Tomasz Grysztar 27 Nov 2004, 11:58
A few posts above you've got the example of how "comcall" macro should be used.
Post 27 Nov 2004, 11:58
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 27 Nov 2004, 14:25
I was using the standard 'interface' macro to define the interface, looks like you have to use 'struc' to define the inteface instead. All right, I'll try this and see what happens.
Thanks
MadMatt
Post 27 Nov 2004, 14:25
View user's profile Send private message Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt 27 Nov 2004, 14:54
Still having problems, I'm talking about the longer version of the comcall macro above, the one that is supposed to allow you to use a pointer to an object. like:

comcall [eax] , .......
and
comcall [eax+bufferarray.directsoundbuffer] , .......

I'll see what I can cook up with what I have.
MadMatt
Post 27 Nov 2004, 14:54
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8359
Location: Kraków, Poland
Tomasz Grysztar 27 Nov 2004, 15:50
Please post your code to show where you've got the problem.
Post 27 Nov 2004, 15:50
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 27 Nov 2004, 18:20
Code:
;structure for the each wave sound
struct pcmsoundtype
       .dsbuffer DirectSoundBuffer
       .state dd 0
       .rate  dd 0
       .size  dd 0
       .id    dd 0
ends

;structure used for defining an array of directsound buffer objects
soundfx       pcmsoundtype
              times MAXSOUNDS*sizeof.pcmsoundtype db 0


;macro to call DirectSound com object with
;the one that is giving me errors.
macro DSRCALL handle,object,proc,[arg]
 { common
    if ~ arg eq
   reverse
     pushd arg
   common
    end if
    if handle eqtype ebx | handle eqtype 0
     push handle
     local ..handle
     label ..handle at handle
     mov eax,[..handle]
    else
     mov eax,handle
     push eax
     mov eax,[eax]
    end if
    local ..interface
    virtual
    ..interface object
    end virtual
    call [eax+..interface#.#proc] }

;what I would like to be able to do
mov [index],15  ; prepare to release 15th DirectSound buffer
mov eax,sizeof.pcmsoundtype
mul [index]
DSRCALL eax+soundfx.dsbuffer , Release ;<- gives me an illegal instruction right here
    


Hopefully this can be done with just one register (EAX)!

_________________
Gimme a sledge hammer! I'LL FIX IT!
Post 27 Nov 2004, 18:20
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  Next

< 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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.