kristo Posted August 11, 2017 Share Posted August 11, 2017 (edited) The following example works: But as soon as I use the line marked with # NOT WORKING instead of the screenCapture it doesn't show the image anymore. Local $hHBmp = _ScreenCapture_Capture("", 0, 0, $iW, $iH) # WORKS ; Local $hHBmp = _GDIPlus_BitmapCreateFromFile( @ScriptDir & "\wallpaper.jpg" ) # NOT WORKING Local $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hHBmp) _WinAPI_DeleteObject($hHBmp) local $hBitmap_Cropped =_GDIPlus_BitmapCloneArea($hBitmap ,0, 0, 200,300, $GDIP_PXF24RGB) Local $hBitmap_Scaled = _GDIPlus_ImageResize($hBitmap_Cropped, 700, 400 * $iH/$iW) Local $hGUI = GUICreate("TEST", $guiW, $guiH, -1, -1) GUISetState(@SW_SHOW) Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI) _GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap_Scaled , 0, 0) Can anyone help me here? Edited August 11, 2017 by kristo Cheap, Fast, Good - Choose any two Link to comment Share on other sites More sharing options...
InnI Posted August 11, 2017 Share Posted August 11, 2017 No need to convert to $hBitmap. It already $hBitmap. ;~ Local $hHBmp = _ScreenCapture_Capture("", 0, 0, $iW, $iH) Local $hBitmap = _GDIPlus_BitmapCreateFromFile( @ScriptDir & "\wallpaper.jpg" ) ;~ Local $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hHBmp) ;~ _WinAPI_DeleteObject($hHBmp) local $hBitmap_Cropped =_GDIPlus_BitmapCloneArea($hBitmap ,0, 0, 200,300, $GDIP_PXF24RGB) Local $hBitmap_Scaled = _GDIPlus_ImageResize($hBitmap_Cropped, 700, 400 * $iH/$iW) Local $hGUI = GUICreate("TEST", $guiW, $guiH, -1, -1) GUISetState(@SW_SHOW) Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI) _GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap_Scaled , 0, 0) 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