AutoHotkey Community

It is currently May 26th, 2012, 2:26 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: January 21st, 2009, 3:13 pm 
Offline

Joined: January 20th, 2009, 9:35 pm
Posts: 16
I am trying to grab a window screenshot and paste it into a GUI picture control. This is the code im using below. Could someone tell me what I am doing wrong?

#Include, Gdip.ahk
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.

Gui, +AlwaysOnTop -Disabled -SysMenu +Owner ; +Owner avoids a taskbar button.
Gui, Show, w640 h480 NoActivate, GuiWindow ; NoActivate avoids deactivating the currently active window.
Gui, Add, Picture, w640 h480 0xE vBackdrop

guicontrolGet, hCnt, hwnd, Backdrop

hBM := CreateDIBSection(Width, Height)
hDC := CreateCompatibleDC()
oBM := SelectObject(hdc, hbm)
dllcall("PrintWindow", "Uint", winexist("Semele"), "Uint", hDC)
pBitmap := Gdip_CreateBitmapFromHBITMAP(hbm)
hBitmap := Gdip_CreateHBITMAPFromBitmap(pBitmap)
SetImage(hCnt, hBM)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 22nd, 2009, 12:23 am 
Offline

Joined: January 20th, 2009, 9:35 pm
Posts: 16
figured this out.
this code actually works, but i just forgot to startup gdi via gdi_startup()


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: G. Sperotto, poserpro, Yahoo [Bot] and 15 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group