Jump to content
Sign in to follow this  

Need help with OleCreatePictureIndirect

Recommended Posts

Seems I am doing something wrong with OleCreatePictureIndirect but I cant pin it down , Tried Autoit debugger and Olly Debugger ut cant seem to catch this function.

dim $myPicObject
; Screenshot via Dll

$hwnd = DllCall("user32.dll","hwnd","GetDesktopWindow") 
; get handle to entire screen 

$DC = DllCall("user32.dll","ptr","GetWindowDC","hwnd",$hwnd[0]) 
; get device context for picture information

$lpRect = DllStructCreate("int;int;int;int") 
; create DllStruct for GetWindowRect call

; get coordinates from upper-left and lower-right corner

$cDC = DllCall("gdi32.dll","ptr","CreateCompatibleDC","ptr",$DC[0]) 
; create compatible DC

$hbmp = DllCall("gdi32.dll","hwnd","CreateCompatibleBitmap","ptr",$DC[0],"int",DllStructGetData($lpRect,3),"int",DllStructGetData($lpRect,3))
; create compatible bitmap

; select bitmap to device context

; copy picture information from the screen to device context in memory

; break for doing anything on screen

; restore previous saved screen

DllCall("user32.dll","int","ReleaseDC","hwnd",$hwnd[0],"ptr",$cDC[0]); release device context for use by other apps

DllCall("user32.dll","int","ReleaseDC","hwnd",$hwnd[0],"ptr",$DC[0]); release device context for use by other apps

$myPic = DllStructCreate ( "uint;uint;uint;uint;uint")
DllStructSetData($myPic,3, $hbmp)

$myIID = DllStructCreate ( "uint;ushort;ushort;ubyte;ubyte;ubyte;ubyte;ubyte;ubyte;ubyte;ubyte")

DllStructSetData ($myIID , 1 , 0x20400 )        
DllStructSetData ( $myIID , 4 ,0xC0 )
DllStructSetData ( $myIID , 11 , 0x46 )
DllCall ( "olepro32.dll" , "int" , "OleCreatePictureIndirect" , "ptr" , DllStructGetPtr($myPic) , "ptr" , DllStructGetPtr($myIID) , "int" , 1 , "ptr" , $myPicObject )
DllCall ( "oleaut32.dll" , "uint" , "OleSavePictureFile" , "ptr" , $myPicObject , "wstr" , "MYBMPFILE.BMP" )

Any help would be appricatied ;)

Firefox's secret is the same as Jessica Simpson's: its effortless, glamorous style is the result of — shhh — extensions!

Share this post

Link to post
Share on other sites

I could have swore I've seen this code already once today... We use int for uint... and you'll want to check other syntax as well.



Not quite sure what you were trying to accomplish with Olly Debugger though.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Create New...