flat assembler
Message board for the users of flat assembler.
Index
> Windows > comcall |
Author |
|
JohnFound 18 Jun 2003, 16:59
Hm, bad written macro, I think. Probably it allows only absolute address (label) as first parameter.
|
|||
18 Jun 2003, 16:59 |
|
Tomasz Grysztar 18 Jun 2003, 17:53
It only allows a COM object structure as first parameter.
|
|||
18 Jun 2003, 17:53 |
|
asmgges 18 Jun 2003, 18:35
At the moment I made my procedure as this:
Code: proc WriteSurf, NumSurf enter ........ ....... cmp dword[NumSurf],1 jne .lab1 comcall lpDDSBack,GetDC,hdc jmp .lab5 .lab1: cmp dword[NumSurf],2 jne .lab2 comcall lpDDSFond,GetDC,hdc jmp .lab5 .lab2: etc.... .lab5: .... return But I am going to have the other surfaces ....... Friendly....Gges |
|||
18 Jun 2003, 18:35 |
|
Tomasz Grysztar 18 Jun 2003, 20:30
Here's my solution:
Code: proc WriteSurf,Handle enter virtual Surface DirectDrawSurface Surface.handle equ Handle end virtual ; ... ; ... comcall Surface,GetDC,hdc ; ... ; ... return And this is the way how it should be called: Code: stdcall WriteSurf,[lpDDSBack] |
|||
18 Jun 2003, 20:30 |
|
asmgges 19 Jun 2003, 08:08
Hi!
Thanks Tomasz Your solution works but the management of the first parameter of comcall remains very delicate If I make two procedures , work OK Code: stdcall CreateSurfBmp,picture,lpDDSPicture stdcall CopieBmpSurf,[lpDDSPicture] proc CreateSurfBmp,Filename,AdrSurface enter invoke LoadImage,0,[Filename],IMAGE_BITMAP,0,0,LR_CREATEDIBSECTION + LR_LOADFROMFILE mov [hBitmap],eax invoke GetObject,[hBitmap],24,bitmap2 mov [ddsd.dwFlags],DDSD_CAPS+DDSD_WIDTH+DDSD_HEIGHT mov [ddsd.ddsCaps.dwCaps],DDSCAPS_OFFSCREENPLAIN mov eax ,[bitmap2.bmWidth] mov [ddsd.dwWidth],eax mov eax,[bitmap2.bmHeight] mov [ddsd.dwHeight],eax comcall lpDD,CreateSurface,ddsd,[AdrSurface],0 ; return proc CopieBmpSurf,Handle enter virtual Surface DirectDrawSurface Surface.handle equ Handle end virtual invoke CreateCompatibleDC,0 mov [hdcImage],eax invoke SelectObject,[hdcImage],[hBitmap] mov [hbmOld],eax comcall Surface,GetDC,hdc .if eax,e,0 invoke BitBlt,[hdc],0,0,[bitmap2.bmWidth],[bitmap2.bmHeight],\ [hdcImage],0,0,SRCCOPY comcall Surface,ReleaseDC,[hdc] .endif invoke SelectObject,[hdcImage],[hbmOld] invoke DeleteObject,[hBitmap] invoke DeleteDC,[hdcImage] comcall Surface,SetColorKey,DDCKEY_SRCBLT ,ddcolorkey return If I try to merge two procedures , compilation OK but error of execution Code: TEWBMP a causé une défaillance de page dans le module TEWBMP.EXE a 0157:00401396. Registres : EAX=00000000 CS=0157 EIP=00401396 EFLGS=00210246 EBX=00560000 SS=015f ESP=0057fe20 EBP=0057fe28 ECX=c0fb3930 DS=015f ESI=815d55c0 FS=1157 EDX=00000004 ES=015f EDI=00000000 GS=0000 Octets a CS : EIP : 8b 00 ff 50 44 83 f8 00 75 3a 68 20 00 cc 00 6a Etat de la pile : 00000000 00404008 0057ff78 0044c1f8 00402072 00404100 00000000 bff89349 00000000 815d55c0 00560000 74796247 6d627765 58450070 00000045 00000000 stdcall CreateSurfLoadBmp,picture,lpDDSPicture,[lpDDSPicture] proc CreateSurfLoadBmp,Filename,AdrSurface,Handle enter virtual Surface2 DirectDrawSurface ;I changed the name because conflict of name with the other procedures Surface2.handle equ Handle end virtual invoke LoadImage,0,[Filename],IMAGE_BITMAP,0,0,LR_CREATEDIBSECTION + LR_LOADFROMFILE mov [hBitmap],eax invoke GetObject,[hBitmap],24,bitmap2 mov [ddsd.dwFlags],DDSD_CAPS+DDSD_WIDTH+DDSD_HEIGHT mov [ddsd.ddsCaps.dwCaps],DDSCAPS_OFFSCREENPLAIN mov eax ,[bitmap2.bmWidth] mov [ddsd.dwWidth],eax mov eax,[bitmap2.bmHeight] mov [ddsd.dwHeight],eax comcall lpDD,CreateSurface,ddsd,[AdrSurface],0 ; invoke CreateCompatibleDC,0 mov [hdcImage],eax invoke SelectObject,[hdcImage],[hBitmap] mov [hbmOld],eax comcall Surface2,GetDC,hdc .if eax,e,0 invoke BitBlt,[hdc],0,0,[bitmap2.bmWidth],[bitmap2.bmHeight],\ [hdcImage],0,0,SRCCOPY comcall Surface2,ReleaseDC,[hdc] .endif invoke SelectObject,[hdcImage],[hbmOld] invoke DeleteObject,[hBitmap] invoke DeleteDC,[hdcImage] comcall Surface2,SetColorKey,DDCKEY_SRCBLT ,ddcolorkey return But your solution is very acceptable Friendly...Gges |
|||
19 Jun 2003, 08:08 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.