SmiLe Posted November 13, 2007 Share Posted November 13, 2007 Hi all! Is it possible to update a GUI picture control with an image from the clipboard, instead of using GUICtrlSetImage()? Thank you for your help. Link to comment Share on other sites More sharing options...
Monamo Posted November 13, 2007 Share Posted November 13, 2007 Hi all!Is it possible to update a GUI picture control with an image from the clipboard, instead of using GUICtrlSetImage()?Thank you for your help.Here's a "not necessarily graceful" way to update the control (method requires that you have the Auto3Lib from PaulIA). You could then used some extra error handling to notify when the clipboard content isn't an image:CODE#include <GUIConstants.au3>#include <A3LClipboard.au3>#include <A3LScreenCap.au3>GUICreate("My GUI", 600, 400)GUISetState(@SW_SHOW)$ButtonClipPic = GUICtrlCreateButton("Insert picture from clipboard", 10, 10, 580, 20)$Pic = GUICtrlCreatePic("", 10, 35, 580, 300,$SS_SUNKEN)$tempPicFile = @ScriptDir & "\temp.bmp"While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $ButtonClipPic $clipPic = _ScreenCap_SaveImage($tempPicFile,_Clip_GetData($CF_BITMAP)) If @error Then MsgBox(48,"Error:", "Unable to create temporary file for image.") GUICtrlSetImage($Pic,$tempPicFile) If FileExists($tempPicFile) Then FileDelete($tempPicFile) EndSelectWEnd - MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup] Link to comment Share on other sites More sharing options...
SmiLe Posted November 13, 2007 Author Share Posted November 13, 2007 Thank you for your reply Monamo. This is the method that I use in my script, but I'd like to know if there is another way to update the control without writing the image to a temporary file. Link to comment Share on other sites More sharing options...
Josbe Posted November 14, 2007 Share Posted November 14, 2007 Thank you for your reply Monamo. This is the method that I use in my script, but I'd like to know if there is another way to update the control without writing the image to a temporary file.; Au3Lib is needed #include <A3LGDIPlus.au3> #include <A3LClipboard.au3> If NOT _Clip_IsFormatAvailable($CF_BITMAP) Then MsgBox(0, "Error", "For test purposes, you will need some bitmap data in the clipboard") Exit EndIf Global $hBitmap, $hImage $hGUI = GUICreate("My GUI", 400, 300) GUISetState() ; Initialize GDI+ library _GDIP_Startup() ; You need some bitmap data in you clipboard $hBitmap = _Clip_GetData($CF_BITMAP) $hImage = _GDIP_BitmapCreateFromHBITMAP($hBitmap) $hGraphics = _GDIP_GraphicsCreateFromHWND($hGUI) _GDIP_GraphicsDrawImage($hGraphics, $hImage, 10, 10) do ;_GDIP_GraphicsDrawImage($hGraphics, $hImage, 10, 10) if you graphic disappear :P until GUIGetMsg() = $GUI_EVENT_CLOSE _GDIP_ImageDispose($hImage) _API_DeleteObject($hBitmap) ; Shut down GDI+ library _GDIP_ShutDown() AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta Link to comment Share on other sites More sharing options...
SmiLe Posted November 15, 2007 Author Share Posted November 15, 2007 Very interesting, thank you! (And yes, you're right, the image disappears without the the Do...Until loop.) Link to comment Share on other sites More sharing options...
Zedna Posted November 15, 2007 Share Posted November 15, 2007 Very interesting, thank you! (And yes, you're right, the image disappears without the the Do...Until loop.) Here is improved simpler way without GDI+ and it doesn't dissapear :-) ; Au3Lib is needed #include <A3LClipboard.au3> If NOT _Clip_IsFormatAvailable($CF_BITMAP) Then MsgBox(0, "Error", "For test purposes, you will need some bitmap data in the clipboard") Exit EndIf Global $hBitmap, $hImage $hGUI = GUICreate("My GUI", 400, 300) $pic1 = GUICtrlCreatePic("",0,0,400,300) GUISetState() ; You need some bitmap data in you clipboard $hBitmap = _Clip_GetData($CF_BITMAP) _SetBitmapToCtrl($pic1, $hBitmap) do until GUIGetMsg() = $GUI_EVENT_CLOSE _API_DeleteObject($hBitmap) Func _SetBitmapToCtrl($CtrlId, $hBitmap) Local Const $STM_SETIMAGE = 0x0172 Local Const $IMAGE_BITMAP = 0 Local $hWnd = GUICtrlGetHandle($CtrlId) If $hWnd = 0 Then Return SetError(1, 0, 0) DllCall("user32.dll", "hwnd", "SendMessage", "hwnd", $hWnd, "int", $STM_SETIMAGE, "int", $IMAGE_BITMAP, "int", $hBitmap) If @error Then Return SetError(2, 0, 0) Return 1 EndFunc Nice original example Josbe Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 15, 2007 Moderators Share Posted November 15, 2007 Here is improved simpler way without GDI+ and it doesn't dissapear :-) ; Au3Lib is needed #include <A3LClipboard.au3> If NOT _Clip_IsFormatAvailable($CF_BITMAP) Then MsgBox(0, "Error", "For test purposes, you will need some bitmap data in the clipboard") Exit EndIf Global $hBitmap, $hImage $hGUI = GUICreate("My GUI", 400, 300) $pic1 = GUICtrlCreatePic("",0,0,400,300) GUISetState() ; You need some bitmap data in you clipboard $hBitmap = _Clip_GetData($CF_BITMAP) _SetBitmapToCtrl($pic1, $hBitmap) do until GUIGetMsg() = $GUI_EVENT_CLOSE _API_DeleteObject($hBitmap) Func _SetBitmapToCtrl($CtrlId, $hBitmap) Local Const $STM_SETIMAGE = 0x0172 Local Const $IMAGE_BITMAP = 0 Local $hWnd = GUICtrlGetHandle($CtrlId) If $hWnd = 0 Then Return SetError(1, 0, 0) DllCall("user32.dll", "hwnd", "SendMessage", "hwnd", $hWnd, "int", $STM_SETIMAGE, "int", $IMAGE_BITMAP, "int", $hBitmap) If @error Then Return SetError(2, 0, 0) Return 1 EndFunc Nice original example JosbeI'm sure you did, but I want to ask... did you confirm this working first... because I get nothing. 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. Link to comment Share on other sites More sharing options...
Zedna Posted November 15, 2007 Share Posted November 15, 2007 (edited) I'm sure you did, but I want to ask... did you confirm this working first... because I get nothing.It's really working fine on my machine.Note: For Auto3Library you must run it under release version 3.2.8.1 (not latest beta)EDIT: Does original example from Josbe works OK on your machine?and notice you must have some bitmap in clipboard before you run this script Edited November 15, 2007 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 16, 2007 Moderators Share Posted November 16, 2007 It's really working fine on my machine.Note: For Auto3Library you must run it under release version 3.2.8.1 (not latest beta)EDIT: Does original example from Josbe works OK on your machine?and notice you must have some bitmap in clipboard before you run this scriptI was running 3.2.8.1>Running:(3.2.8.1)And yes Josbe's worked... (Used print screen before running ) 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. Link to comment Share on other sites More sharing options...
Malkey Posted May 1, 2008 Share Posted May 1, 2008 Updated example to run on v3.2.10.0 and v3.2.11.10 (beta). Zedna example to load bitmap from clipboard to Control without using GDI+ expandcollapse popup; #include <Clipboard.au3> #include <WinAPI.au3> #include <GuiConstants.au3> If Not _ClipBoard_IsFormatAvailable ($CF_BITMAP) Then MsgBox(0, "Error", "For test purposes, you will need some bitmap data in the clipboard") Exit EndIf Global $hBitmap, $hImage $hGUI = GUICreate("My GUI", 400, 300) $pic1 = GUICtrlCreatePic("", 0, 0, 400, 300) GUISetState() ; You need some bitmap data in you clipboard $hBitmap = _ClipBoard_GetData ($CF_BITMAP) _SetBitmapToCtrl($pic1, $hBitmap) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE _WinAPI_DeleteObject ($hBitmap) Func _SetBitmapToCtrl($CtrlId, $hBitmap) Local Const $STM_SETIMAGE = 0x0172 Local Const $IMAGE_BITMAP = 0 Local $hWnd = GUICtrlGetHandle($CtrlId) If $hWnd = 0 Then Return SetError(1, 0, 0) DllCall("user32.dll", "hwnd", "SendMessage", "hwnd", $hWnd, "int", $STM_SETIMAGE, "int", $IMAGE_BITMAP, "int", $hBitmap) If @error Then Return SetError(2, 0, 0) Return 1 EndFunc ;==>_SetBitmapToCtrloÝ÷ Ø,mç±jjezÚ%¡§[Ù¥úèÉb¥ºÛhB.²)à2ëºÚ"µÍÂÚ[ÛYH ÐÛØ]LÉÝÂÚ[ÛYH ÑÝZPÛÛÝ[Ë]LÉÝÂÚ[ÛYH ÕÚ[TK]LÉÝÂÚ[ÛYH ÑÑTË]LÉÝÂYÝÐÛØÒÑÜX]]Z[XH ÌÍÐÑÐUPT H[SÙÐÞ ][ÝÑÜ][ÝË ][ÝÑÜÝÜÙË[ÝHÚ[YYÛÛYH]X]H[HÛØ ][ÝÊBQ^][YÛØ[ ÌÍÚ]X ÌÍÚ[XYÙBÌÍÚÕRHHÕRPÜX]J ][ÝÓ^HÕRI][ÝË Ì BÕRTÙ]Ý]J BÈ[]X[^HÑJÈXBÑÑTT×ÔÝ BÈ[ÝHYYÛÛYH]X]H[[ÝHÛØÌÍÚ]XHÐÛØÑÙ]]H ÌÍÐÑÐUPT BÌÍÚ[XYÙHHÑÑTT×Ð]XÜX]QÛRUPT ÌÍÚ]X BÌÍÚÜXÜÈHÑÑTT×ÑÜXÜÐÜX]QÛRÓ ÌÍÚÕRJBÑÑTT×ÑÜXÜÑ]Ò[XYÙH ÌÍÚÜXÜË ÌÍÚ[XYÙKLL BÂN×ÑÑTÑÜXÜÑ]Ò[XYÙJ ÌÍÚÜXÜË ÌÍÚ[XYÙKLL HY[ÝHÜXÈØXÛÝYKÚY[[ÕRQÙ]ÙÊ HH ÌÍÑÕRWÑUSÐÓÔÑBÑÑTT×Ò[XYÙQÜÜÙH ÌÍÚ[XYÙJBÕÚ[TWÑ[]SØXÝ ÌÍÚ]X BÈÚ]ÝÛÑJÈXBÑÑTT×ÔÚ]ÝÛ Don't forget to put a bitmap on clipboard. You can do as SmOke_N did, use print screen before running. Link to comment Share on other sites More sharing options...
Malkey Posted May 1, 2008 Share Posted May 1, 2008 A modified Josbe script. Runs on v3.2.11.10 (beta) and I think v3.2.11.8 (beta) or you can add the _GDIPlus_DrawImagePoints() function from http://www.autoitscript.com/forum/index.ph...st&p=495862Adding the _GDIPlus_DrawImagePoints() function would make it current version v3.2.10.0 compatiable.The difference with this example is that the bitmap auto-resizes with the GUI resize. It's slow to exit though.expandcollapse popup; ; Run on v3.2.11.10 (beta) or previous Beta Version ; Must have _GDIPlus_DrawImagePoints()function or add to this script from ; http://www.autoitscript.com/forum/index.php?s=&showtopic=66993&view=findpost&p=495862 #include <WindowsConstants.au3> #include <Clipboard.au3> #include <GuiConstants.au3> #include <WinAPI.au3> #include <GDIPlus.au3> Local $WPos, $hBitmap, $hImage, $hGraphics, $Flag = 0 Opt("PixelCoordMode", 0) If Not _ClipBoard_IsFormatAvailable ($CF_BITMAP) Then Send("{PRINTSCREEN}") EndIf $hGUI = GUICreate("My GUI", 400, 300, -1, -1, $WS_SIZEBOX) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $GUI_EVENT_RESIZED Or $Flag = 0 $WPos = WinGetPos("") $Flag = 1 $hBitmap = _ClipBoard_GetData ($CF_BITMAP) _GDIPLUS_Startup () $hImage = _GDIPLUS_BitmapCreateFromHBITMAP ($hBitmap) $hGraphics = _GDIPLUS_GraphicsCreateFromHWND ($hGUI) _GDIPlus_DrawImagePoints ($hGraphics, $hImage, 0, 0, $WPos[2], 0, 0, $WPos[3]) _GDIPLUS_ImageDispose ($hImage) _WinAPI_DeleteObject ($hBitmap) _GDIPlus_GraphicsDispose ($hGraphics) _GDIPLUS_ShutDown () EndSwitch WEnd Link to comment Share on other sites More sharing options...
ProgAndy Posted May 1, 2008 Share Posted May 1, 2008 This should be extended (Delete the old Bitmap) Func _SetBitmapToCtrl($CtrlId, $hBitmap) Local Const $STM_SETIMAGE = 0x0172 Local Const $IMAGE_BITMAP = 0 Local $hWnd = GUICtrlGetHandle($CtrlId) If $hWnd = 0 Then Return SetError(1, 0, 0) Local $oldBmp = DllCall("user32.dll", "hwnd", "SendMessage", "hwnd", $hWnd, "int", $STM_SETIMAGE, "int", $IMAGE_BITMAP, "int", $hBitmap) If @error Then Return SetError(2, 0, 0) If $oldBmp[0] <> 0 Then DllCall("GDI32.dll", "int", "DeleteObject", "int", $oldBmp[0]) Return 1 EndFunc ;==>_SetBitmapToCtrl *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
smashly Posted May 1, 2008 Share Posted May 1, 2008 A modified Josbe script. Runs on v3.2.11.10 (beta) and I think v3.2.11.8 (beta) or you can add the _GDIPlus_DrawImagePoints() function from http://www.autoitscript.com/forum/index.ph...st&p=495862 Adding the _GDIPlus_DrawImagePoints() function would make it current version v3.2.10.0 compatiable. The difference with this example is that the bitmap auto-resizes with the GUI resize. It's slow to exit though. ..................oÝ÷ Ûú®¢×¢·¹Ç=Kbì!zzÞv¶°x-è¦j¨ªÞ²,Þz÷§·Í5ÓG)ºÊbê'*%w^÷åjh§^»§)à¶nÞr^Õ.r¥vf²mé^j÷åºÊîx§bëazÇ+b±§-÷¢Ë^iÚ²Ö«¶)àjwl¶ixåºÊ'z÷«ÉëÞÐ,àj̨º¶ÝÊh²)àýº¶«zÊ.Ǭmçèç+y«b§{ Þ²«qëazr¢}ý¶ØbH¥¹h¶¦zj+ÊÚ&¹Èv1¬zë¶0ð59¬eEè"²×«2È-¢·¬-è)àèx-ÚØb zÛ+Ú¶¦ë)H§ëzȳyëÞÛ¶Ø^¶¶zß¡ù¢)ìm©òºÆ y«¢+Ø¥¹±Õ±Ðí]¥¹½ÝÍ ½¹ÍѹÑ̹ÔÌÐì(¥¹±Õ±Ðí ±¥Á½É¹ÔÌÐì(¥¹±Õ±ÐíÕ¥ ½¹ÍѹÑ̹ÔÌÐì(¥¹±Õ±Ðí]¥¹A$¹ÔÌÐì(¥¹±Õ±Ðí%A±Õ̹ÔÌÐì()±½°ÀÌØí¡ÉÁ¡¥Ì°ÀÌØí¡ ¥ÑµÀ°ÀÌØí¡%µ°ÀÌØí¡ÉÁ¡¥Ì()%9½Ð} ±¥Á ½É}%ͽɵÑÙ¥±± ÀÌØí } %Q5@¤Q¡¸(M¹ ÅÕ½ÐííAI%9QM I9ôÅÕ½Ðì¤)¹%(ÀÌØí¡ ¥ÑµÀô} ±¥Á ½É}ÑÑ ÀÌØí } %Q5@¤()}%A1UM}MÑÉÑÕÀ ¤(ÀÌØí¡%µô}%A1UM} ¥ÑµÁ ÉÑɽµ! %Q5@ ÀÌØí¡ ¥ÑµÀ¤((ÀÌØí¡U$ôU% ÉÑ ÅÕ½Ðí5äU$ÅÕ½Ðì°ÐÀÀ°ÌÀÀ°´Ä°´Ä°ÀÌØí]M}M%i =`¤)U%I¥ÍÑÉ5Í ÀÌØí]5}A%9P°ÅÕ½Ðí]5}A%9PÅÕ½Ðì¤)U%MÑMÑÑ ¤()]¡¥±Ä(MÝ¥Ñ U%Ñ5Í ¤($% ÍÀÌØíU%}Y9Q} 1=M(}%A1UM}%µ¥ÍÁ½Í ÀÌØí¡%µ¤(}]¥¹A%}±Ñ=©Ð ÀÌØí¡ ¥ÑµÀ¤($$%}%A1UM}M¡Õѽݸ ¤(á¥Ð($% ͱÍ($$$ìììì(%¹MÝ¥Ñ )]¹()Õ¹]5}A%9P ÀÌØí¡]¹°ÀÌØí5ͤ(}]¥¹A%}IÉÝ]¥¹½Ü ÀÌØí¡]¹°À°À°ÀÌØíI]}UAQ9=¤(%1½°ÀÌØí]A½Ìô]¥¹ÑA½Ì ÀÌØí¡U$¤($ÀÌØí¡ÉÁ¡¥Ìô}%A1UM}ÉÁ¡¥Í ÉÑɽµ!]9 ÀÌØí¡U$¤(}%A±ÕÍ}ÉÁ¡¥ÍÉÝ%µIÐ ÀÌØí¡ÉÁ¡¥Ì°ÀÌØí¡%µ°À°À°ÀÌØí]A½ÍlÉt°ÀÌØí]A½ÍlÍt¤(%}%A±ÕÍ}ÉÁ¡¥Í¥ÍÁ½Í ÀÌØí¡ÉÁ¡¥Ì¤(}]¥¹A%}IÉÝ]¥¹½Ü ÀÌØí¡]¹°À°À°ÀÌØíI]}Y1%Q¤(IÑÕɸÀÌØíU%}IU95M)¹Õ¹ PS this code would need beta autoit v3.2.11.X to run due to using "_GDIPlus_GraphicsDrawImageRect()" function. It would work with autoit 3.2.10.0 if you swap the "_GDIPlus_GraphicsDrawImageRect()" function for _GDIPlus_DrawImagePoints() instead. (as you've already said) Cheers Link to comment Share on other sites More sharing options...
Malkey Posted May 1, 2008 Share Posted May 1, 2008 Well done smashly, brilliant - Must Better.Now, with ProgAndy's solution to putting an image onto clipboard @http://www.autoitscript.com/forum/index.ph...st&p=514764Your script, Zedna, and Josbe scripts can get an image off clipboard. That's handy. Link to comment Share on other sites More sharing options...
Zedna Posted May 1, 2008 Share Posted May 1, 2008 (edited) This should be extended (Delete the old Bitmap) Func _SetBitmapToCtrl($CtrlId, $hBitmap) Local Const $STM_SETIMAGE = 0x0172 Local Const $IMAGE_BITMAP = 0 Local $hWnd = GUICtrlGetHandle($CtrlId) If $hWnd = 0 Then Return SetError(1, 0, 0) Local $oldBmp = DllCall("user32.dll", "hwnd", "SendMessage", "hwnd", $hWnd, "int", $STM_SETIMAGE, "int", $IMAGE_BITMAP, "int", $hBitmap) If @error Then Return SetError(2, 0, 0) If $oldBmp[0] <> 0 Then DllCall("GDI32.dll", "int", "DeleteObject", "int", $oldBmp[0]) Return 1 EndFunc ;==>_SetBitmapToCtrl Yes you are right. I will incorporate this into my next resources UDF This function comes from there (original from Larry) Edited May 1, 2008 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Zedna Posted May 1, 2008 Share Posted May 1, 2008 (edited) To reduce CPU time when redrawing the image on a resize event (80% ~ 100% cpu spike on my old 1.73Ghz laptop when running the above code) 1) You could maybe leave _GDIPlus running while the script is active, instead of starting and stopping _GDIPlus on every event. As long as your disposing of the resources before creating a new resource then I don't think gdi will blow out the memory to much. 2) Maybe use the WM_PAINT msg with GUIRegisterMsg to redraw the gdi image. Doing those 2 things gets rid of the cpu spiking on resize events at the trade off of minimal extra memory usage.expandcollapse popup#include <WindowsConstants.au3> #include <Clipboard.au3> #include <GuiConstants.au3> #include <WinAPI.au3> #include <GDIPlus.au3> Global $hGraphics, $hBitmap, $hImage, $hGraphics If Not _ClipBoard_IsFormatAvailable ($CF_BITMAP) Then Send("{PRINTSCREEN}") EndIf $hBitmap = _ClipBoard_GetData ($CF_BITMAP) _GDIPLUS_Startup () $hImage = _GDIPLUS_BitmapCreateFromHBITMAP ($hBitmap) $hGUI = GUICreate("My GUI", 400, 300, -1, -1, $WS_SIZEBOX) GUIRegisterMsg($WM_PAINT, "WM_PAINT") GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE _GDIPLUS_ImageDispose ($hImage) _WinAPI_DeleteObject ($hBitmap) _GDIPLUS_ShutDown() Exit Case Else ;;;; EndSwitch WEnd Func WM_PAINT($hWnd, $Msg) _WinAPI_RedrawWindow($hWnd, 0, 0, $RDW_UPDATENOW) Local $WPos = WinGetPos($hGUI) $hGraphics = _GDIPLUS_GraphicsCreateFromHWND ($hGUI) _GDIPlus_GraphicsDrawImageRect($hGraphics, $hImage, 0, 0, $WPos[2], $WPos[3]) _GDIPlus_GraphicsDispose ($hGraphics) _WinAPI_RedrawWindow($hWnd, 0, 0, $RDW_VALIDATE) Return $GUI_RUNDEFMSG EndFuncoÝ÷ Øô+¡×°¢é]çmëZjëhÛ÷Û]W¶îÛ¶¬x*ºFåºÁ«jbrÀëk&jyËjº_ºw-È· .Ü(®L"¶®¶ßmtÒ'ò¢ë0jaz«¨´`È>[¬¶©',¶°"f y¶«¨µû§rبú+2묨>§¶È§²×u«2¢íý½æ¥æÊÆ¢t(^z»?ªê-xKÞj+zËn}÷·©ºÚ.¶Ö0ð56®¶sb6æ6ÇVFRfÇCµvæF÷w46öç7FçG2æS2fwC°¢6æ6ÇVFRfÇC´6Æ&ö&BæS2fwC°¢6æ6ÇVFRfÇC´wV6öç7FçG2æS2fwC°¢6æ6ÇVFRfÇCµväæS2fwC°¢6æ6ÇVFRfÇC´tDÇW2æS2fwC° ¤vÆö&Âb33c¶w&72Âb33c¶&FÖÂb33c¶ÖvP ¤bæ÷Bô6Æ&ö&Eô4f÷&ÖDfÆ&ÆRb33c´4eô$DÔFVઠ6VæBgV÷C·µ$åE45$TTçÒgV÷C²¤VæD`¢b33c¶&FÖÒô6Æ&ö&EôvWDFFb33c´4eô$DÔ ¢b33c¶uTÒuT7&VFRgV÷C´×uTgV÷C²ÂCÂ3ÂÓÂÓÂb33cµu5õ4¤T$õ¤uT6WE7FFR ¥ôtDÅU5õ7F'GWª b33c¶w&72ÒôtDÅU5ôw&747&VFTg&öÔtäBb33c¶uT¢b33c¶ÖvRÒôtDÅU5ô&FÖ7&VFTg&öÔ$DÔb33c¶&FÖ ¤uT&Vv7FW$×6rb33cµtÕõåBÂgV÷CµtÕõåBgV÷C² ¥vÆRª 7vF6uTvWD×6rª 66Rb33c´uTôUdTåEô4Äõ4Pª ôtDÇW5ôw&74F7÷6Rb33c¶w&72ª ôtDÅU5ôÖvTF7÷6Rb33c¶ÖvRª õväôFVÆWFTö&¦V7Bb33c¶&FÖª ôtDÅU5õ6WDF÷v⪠W@ª 66RVÇ6Pª ³³³°ª VæE7vF6¥tVæ@ ¤gVæ2tÕõåBb33c¶væBÂb33c´×6rª õväõ&VG&uvæF÷rb33c¶væBÂÂÂb33cµ$EuõUDDTäõrª Æö6Âb33cµu÷2ÒvävWE÷2b33c¶uTª ôtDÇW5ôw&74G&tÖvU&V7Bb33c¶w&72Âb33c¶ÖvRÂÂÂb33cµu÷5³%ÒÂb33cµu÷5³5Òª õväõ&VG&uvæF÷rb33c¶væBÂÂÂb33cµ$EuõdÄDDRª &WGW&âb33c´uTõ%TäDTdÕ4p¤VæDgVæ0 Edited May 1, 2008 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
smashly Posted May 1, 2008 Share Posted May 1, 2008 Hi Zedna, Problem..>Running:(3.2.11.9):C:\Program Files\AutoIt3\beta\autoit3.exe "C:\AutoIt Stuff\werry.au3" !>23:14:48 AutoIT3.exe ended.rc:-1073741819 >Exit code: -1073741819 Time: 6.155I gather that's because your puting$hGraphics = _GDIPLUS_GraphicsCreateFromHWND ($hGUI)oÝ÷ Ù§íz¶®¶sduT&Vv7FW$×6rb33cµtÕõåBÂgV÷CµtÕõåBgV÷C²oÝ÷ Ù©Ýjëh×6_GDIPlus_GraphicsDrawImageRect($hGraphics, $hImage, 0, 0, $WPos[2], $WPos[3]) is calling $hGraphics before it's been generated. Cheers Link to comment Share on other sites More sharing options...
smashly Posted May 1, 2008 Share Posted May 1, 2008 (edited) I also noticed moving the "$hGraphics = _GDIPLUS_GraphicsCreateFromHWND ($hGUI)" outside of the WM_PAINT function seems to make the image not scale to the screen correctly when you resize, that's why I had it and the _GDIPlus_GraphicsDispose ($hGraphics) inside the WM_PAINT function. Cheers Edited May 1, 2008 by smashly Link to comment Share on other sites More sharing options...
Zedna Posted May 1, 2008 Share Posted May 1, 2008 @smashly: I noticed that too and I corrected my script before your posts already Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
smashly Posted May 1, 2008 Share Posted May 1, 2008 (edited) Hi again Zedna But from the modification you've done it still is buggy. When you resize the window the image doesn't strech to the windows edges. Also from moving the GUIRegisterMsg($WM_PAINT, "WM_PAINT") to after the GUISetState() then the image isn't displayed till the window is tampered with. I think the way I had it to start with is more compatable (even though the code layout is ugly). But to each his own. Cheers Edited May 1, 2008 by smashly 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