AutoHotkey Community

It is currently May 27th, 2012, 10:12 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 83 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6
Author Message
 Post subject:
PostPosted: July 19th, 2011, 1:49 pm 
Offline

Joined: March 11th, 2006, 12:44 pm
Posts: 341
Location: Munich, Germany
Code:
#Include, Gdip.ahk     ;Thanks to Tic   http://www.autohotkey.com/forum/topic32238.html

Gdip_Startup_with_Token()
SetTitleMatchMode, 2
WinGet, hwnd, ID, Dispositivo(IP_Camera) - Google Chrome
WinSet, Transparent, 0, Dispositivo(IP_Camera) - Google Chrome


pBitmap:=Gdip_BitmapFromHWND(hwnd)
Gdip_SetBitmapToClipboard(pBitmap)
Gdip_DisposeImage(pBitmap)
Gdip_Shutdown_and_ExitApp()


just add 2 functions to the gdip.ahk (hint to TIC to extend gdip.ahk)
Gdip_Startup_with_Token() which generates the token and stores it globally.
and
Gdip_Shutdown_and_ExitApp() which uses this global token, and also calles ExitApp, so we save one line of code in the end of the Script.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 19th, 2011, 2:09 pm 
Offline

Joined: March 11th, 2006, 12:44 pm
Posts: 341
Location: Munich, Germany
if you want to send the screenshot to a "real printer" here is the theoretical part in the MSDN-Library , explaining the GDIP-Functions.

MSDN-Link for using Print

the interessint part is here:
Code:
 
get printername:
   // Get the printer name.
   if(!GetDefaultPrinter(buffer, &size))


HDC hdcPrint = CreateDC(NULL, TEXT("\\\\printserver\\print1"), NULL, NULL);

 StartDoc(hdcPrint, &docInfo);
  bitblit( Screenshot => hdcPrint ) ?     
 EndDoc(hdcPrint);  => causes printer to actually print the buffer


this will create a DeviceContext (DC) for the "real" Printer.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 3rd, 2012, 12:01 pm 
Hi all,

I have a problem, while press Win+v key I have the following error:
---------------------------
GDIplus Test
---------------------------
Error in GDIplus_GetEncoderCLSID (UnknownImageFormat: ) 0
---------------------------
OK
---------------------------

Exe file that i download from page #1 works without error.

Could anybody please help me?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 3rd, 2012, 12:34 pm 
Offline

Joined: March 11th, 2006, 12:44 pm
Posts: 341
Location: Munich, Germany
@cholya89: maybe the ahk version is not compatible anymore with the script. this would explain that the exe version is working. also the exe might be an other version than the latest .ahk script. which version of windows do you use ? winxp, vista, win7, win8 ? in winxp it should work fine. maybe you are missing the gdip.ahk file ?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 8th, 2012, 3:46 pm 
i have same problem, exe works but when i try to run the script i get the error "Error in GDIplus_GetEncoderCLSID (UnknownImageFormat: ) 0 " im running windows 7 64bit


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 8th, 2012, 4:02 pm 
just like to add that i have the gdip.ahk file GDIPlusHelper.ahk, and have even tried downloading the gdiplus.dll and putting it in the same folder as the gdip topic says, just to see if that file is not on windows 7


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 8th, 2012, 7:58 pm 
Offline

Joined: March 11th, 2006, 12:44 pm
Posts: 341
Location: Munich, Germany
seems to be a problem related to windows 7, as it works on windows xp.
in general in vista and i think also in windows 7 the rendering is not directly on the screen anymore but handled as buffers and then the 3d-engine in your graphics card renders all at once. so "windows" are similar to textures in opengl. so if you use gdip they will be translated into this buffers etc. and something seems not to work here maybe. tldr; gdip works differently on xp and windows 7.

there is also discussion here about a similar problem with gdip.
http://www.autohotkey.com/forum/topic32238-495.html

if ahk is complied into exe then maybe the linking to the dll is different ?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 8th, 2012, 10:56 pm 
Offline

Joined: March 11th, 2006, 12:44 pm
Posts: 341
Location: Munich, Germany
holomind wrote:
seems to be a problem related to windows 7, as it works on windows xp.
in general in vista and i think also in windows 7 the rendering is not directly on the screen anymore but handled as buffers and then the 3d-engine in your graphics card renders all at once. so "windows" are similar to textures in opengl. so if you use gdip they will be translated into this buffers etc. and something seems not to work here maybe. tldr; gdip works differently on xp and windows 7.

there is also discussion here about a similar problem with gdip.
http://www.autohotkey.com/forum/topic32238-495.html

if ahk is complied into exe then maybe the linking to the dll is different ?


i think its not related to windows7 at all. the "wonder" thing that the exe works and the ahk not, is cause by changes in the gdip.ahk include file provided by TIC. i used an older version to compile the ahk into an exe.

if you use the gdip library which is provided in the first post of this thread then it should work.


the problem is here: these definitions are missing in TICs "new" version of the gdip-helper.ahk.

the errormessage is that this variable is not defined, and then the program is stopped.

you could also just use
image/png
instead of #GDIplus_mimeType_PNG
but there are more of this #.. constants for naming.

then it maybe would also work with tics version of the gdip-helper library.

even putting this at the beginning of your .ahk file should be a quickfix.
main problem is if you use Gdip.ahk from TIC then you are missing all the constants: which are defined in GDIPlusHelper.ahk

look at the section:
;#Include DllCallStruct.ahk

Code:
#GDIplus_mimeType_BMP = image/bmp
#GDIplus_mimeType_JPG = image/jpeg
#GDIplus_mimeType_GIF = image/gif
#GDIplus_mimeType_PNG = image/png
#GDIplus_mimeType_TIF = image/tiff


Hope this gets you running on "windows 7" or better said in 2012, using a script from Thu Aug 24, 2006 (when the first post was created), amazing this still runs in windows 7. (using the correct includes, or using the exe).


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 83 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6

All times are UTC [ DST ]


Who is online

Users browsing this forum: specter333, XX0 and 23 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