unknown12 Posted February 12, 2007 Share Posted February 12, 2007 Here is my code (using it in windows Vista):#RequireAdmin $p = DllStructCreate("dword;bool") DllStructSetData($p, 1, DllStructGetSize($p)) ;make the DllCall $ret = DllCall("dwmapi.dll","int","DwmGetColorizationColor","int",DllStructGetPtr($p)) if Not $ret[0] Then MsgBox(0,"DllCall Error","DllCall Failed") exit EndIf ;get the returned values $n1 = DllStructGetData($p,1) $n2 = DllStructGetData($p,2) ;free the struct $p =0 msgbox(0,"","Colour: " & $n1 & @CRLF & "Opacity: " & $n2 )Any ideas as to why it doesn't return colour and opacity? (only returns 0 for both).Here is the MSDN page: http://msdn2.microsoft.com/en-gb/library/aa969513.aspx Link to comment Share on other sites More sharing options...
lod3n Posted February 12, 2007 Share Posted February 12, 2007 (edited) I think you want two DllStructCreates, not one. I don't have Vista, so no idea if this works:expandcollapse popup#RequireAdmin HRESULT DwmGetColorizationColor( DWORD *pcrColorization, BOOL *pfOpaqueBlend ); $crColorization = DllStructCreate("dword") $pfOpaqueBlend = DllStructCreate("bool") DllStructSetData($crColorization,1,0) DllStructSetData($pfOpaqueBlend,1,False) ;make the DllCall $ret = DllCall("dwmapi.dll","int","DwmGetColorizationColor","ptr",DllStructGetPtr($crColorization),"ptr",DllStructGetPtr($pfOpaqueBlend)) Select case @error = 0 msgbox(0,"","Dll call success" & @crlf) Case @error = 1 msgbox(0,"","unable to use the DLL file" & @crlf) Case @error = 2 msgbox(0,"",'unknown "return type"' & @crlf) Case @error = 3 msgbox(0,"",'"function" not found in the DLL file.' & @crlf) endselect if Not isArray($ret) Then msgbox(0,"","Dll did not return an array" & @crlf) EndIf ;get the returned values $n1 = DllStructGetData($crColorization,1) $n2 = DllStructGetData($pfOpaqueBlend,1) msgbox(0,"","Colour: " & $n1 & @CRLF & "Opacity: " & $n2 ) Edited February 13, 2007 by lod3n [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] Link to comment Share on other sites More sharing options...
unknown12 Posted February 12, 2007 Author Share Posted February 12, 2007 Thanks, just tried it and got "DllCall Failed". Link to comment Share on other sites More sharing options...
lod3n Posted February 12, 2007 Share Posted February 12, 2007 Try again, I've updated the code. [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] Link to comment Share on other sites More sharing options...
unknown12 Posted February 12, 2007 Author Share Posted February 12, 2007 Unfortunately still get "DLL Call Failed" Link to comment Share on other sites More sharing options...
lod3n Posted February 12, 2007 Share Posted February 12, 2007 (edited) Well, I dunno then. Keep playing around with it. I think it's closer than before. I modified your error trap, rather than just quitting, better to see exactly what the error is, and try and return the results anyway. Edited February 12, 2007 by lod3n [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] Link to comment Share on other sites More sharing options...
unknown12 Posted February 12, 2007 Author Share Posted February 12, 2007 Not really sure what to change, its my first attempt with DLL calls Link to comment Share on other sites More sharing options...
unknown12 Posted February 12, 2007 Author Share Posted February 12, 2007 Ok, i've got Lod3n's working by changing int to bool, but they both still return 0. Any ideas? Link to comment Share on other sites More sharing options...
unknown12 Posted February 13, 2007 Author Share Posted February 13, 2007 bump Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now