well i made this litle test and i get always
an error at Setcooperativelevel ....


i just made a macro for COM calling

this one:

;-----------------------------------
; macro comcall
;----------------------------------
; comcall interface , method , VAR1...,VARn
;-----------------------------------
; interface is the COM Object
; method is the COM function
;-----------------------------------
%macro comcall 2-*
mov edi,[%1] ;edi = COM OBJECT interface VALUE
mov edi, ;edi = VTable VALUE
mov edi, ;edi = VALUE

%rep %0-1
%rotate -1
push dword %1
%endrep

CALL edi
or eax,eax
jz %%noerrmsg
stdcall MessageBoxA,0,"ERROR!","COMCALL ERROR",MB_ICONHAND | MB_OK

%%noerrmsg:

%endmacro
;-------------------------------
; comcall END
;-------------------------------




and here is the program that gives that error
at setcooperativelevel ....

:(

;============================================
%include "\lab\vasm\inc\nagoa.inc"




..start:

; if is not in nagoa.obj uncomment the line above
; import DirectDrawCreate ddraw.dl l

CONST lpDD, dd 0
stdcall DirectDrawCreate,NULL,lpDD,NULL
or eax,eax
jnz near goError

goOn:
CONST SetCooperativeLevel , equ 80
CONST DDSCL_NORMAL , equ 8
comcall lpDD,SetCooperativeLevel,0,DDSCL_NORMAL

or eax,eax
jnz near goError2

goOut2:
stdcall MessageBoxA,0,"SetCooperativeLevel OK !","comcall",MB_ICONHAND | MB_OK
CONST SetDisplayMode , equ 84
comcall lpDD,SetDisplayMode,640,480,8
or eax,eax
jnz near goError3


goOut:
stdcall ExitProcess,0
ret

goError:
stdcall MessageBoxA,0,"DirectDrawCreate Error.. !","comcall",MB_ICONHAND | MB_OK
jmp goOut


goError2:
stdcall MessageBoxA,0,"SetCooperativeLevel Error.. !","comcall",MB_ICONHAND | MB_OK
jmp goOut

goError3
stdcall MessageBoxA,0,"SetDisplayMode Error.. !","comcall",MB_ICONHAND | MB_OK
jmp goOut
;==============================================
Posted on 2002-05-31 21:01:36 by Nguga
;================================================================
; CALLCOM or callcom for COM calling
;================================================================
; USAGE :
;================================================================
; callcom ptObject,ptMethod,var1,...,var_n
;================================================================
%macro CALLCOM 2-*
%define object %1
%define method %2
push esi
%rep %0-1
%rotate -1
push dword %1
%endrep
pop esi
mov eax,
mov ebx,
push eax
CALL
pop esi
%endmacro


%macro callcom 2-*
%define object %1
%define method %2
push esi
%rep %0-1
%rotate -1
push dword %1
%endrep
pop esi
mov eax,
mov ebx,
push eax
CALL
pop esi
%endmacro

;================================================================
Posted on 2002-06-08 14:10:59 by Nguga