News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

how to call "DwmExtendFrameIntoClientArea"

Started by knockjoke, February 13, 2011, 11:47:15 PM

Previous topic - Next topic

knockjoke

hey, i tried it like this:


; prototype
DwmExtendFrameIntoClientArea typedef PROTO STDCALL :DWORD,:DWORD
ExtendFrameIntoClientArea equ <(type DwmExtendFrameIntoClientArea) PTR eax>

.data
dwMargins           dd 4 dup(-1)

invoke LoadLibrary, CADD("Dwmapi.dll")
invoke GetProcAddress, eax, CADD("DwmExtendFrameIntoClientArea")
.if eax > 0
invoke ExtendFrameIntoClientArea, hInst, addr dwMargins
.endif


But the window doesnt get transparent like it should be... Did I do something wrong? dwMargins needs to be set to -1 to apply it to the aero glass effect to the whole window.
Or is there another way to achieve an effect like this: http://www.codeproject.com/KB/directx/umvistad3d.aspx
Thanks.

Tedd

Did you give your window the WS_EX_COMPOSITED extended style?

Also, the first parameter to ExtendFrameIntoClientArea should be the window handle, not hInst.
No snowflake in an avalanche feels responsible.

Gunner

Also, if you are getting the proc address, why aren't you using it?

        invoke LoadLibrary, CTEXT("Dwmapi.dll")
    invoke GetProcAddress, eax,CTEXT("DwmExtendFrameIntoClientArea")
.if eax > 0
    push    offset Margin
    push    hWin
    call    eax   
.endif




~Rob (Gunner)
- IE Zone Editor
- Gunners File Type Editor
http://www.gunnerinc.com

lingo

it works for me:  :wink
On_wm_activate:
; Handle window activation.
; Extend the frame into the client area.
mov ecx, [esp+1*4]                    ; ecx->hWnd ; ecx->hwnd
sub esp, sizeof MARGINS
mov [esp].MARGINS.cxLeftWidth,8
mov [esp].MARGINS.cxRightWidth,8
mov [esp].MARGINS.cyTopHeight,36*5
mov [esp].MARGINS.cyBottomHeight,37
invoke DwmExtendFrameIntoClientArea, ecx, esp ; esp->addr MARGINS
add esp, sizeof MARGINS
ret 4*4

knockjoke

Thanks to everyone but I still didnt got it working... :(

MARGINS struct
cxLeftWidth DWORD ?
cxRightWidth DWORD ?
cyTopHeight DWORD ?
cyBottomHeight DWORD ?
MARGINS ends

PMARGINS typedef ptr MARGINS


.ELSEIF eax==WM_ACTIVATE
sub esp, sizeof MARGINS
mov [esp].MARGINS.cxLeftWidth,-1
mov [esp].MARGINS.cxRightWidth,-1
mov [esp].MARGINS.cyTopHeight,-1
mov [esp].MARGINS.cyBottomHeight,-1

invoke LoadLibrary, CADD("Dwmapi.dll")
invoke GetProcAddress, eax, CADD("DwmExtendFrameIntoClientArea")
.if eax > 0
push esp
push hWnd
call eax
.endif


Whats wrong? eax is always > 0 and the hWnd is the one from MainWndProc   PROC hWnd:DWORD,uMsg:DWORD,wParam:DWORD,lParam:DWORD

dedndave

see if it's loading the library correctly
what OS are you using ?

MichaelW

If the library did not load correctly, then GetProcAddress should be failing. What is the return value from the called function?
eschew obfuscation

knockjoke

Ah, got it working now.. I passed a wrong param to another function...
Thank you guys. :bg