4ggr35510n 0 Posted July 30, 2010 (edited) Hi, I was wondering is it possible to create on desktop movable and "actionable" image/picture, from which I could start main gui-windows or functions of my program? My curiosity starts with this code: #include <misc.au3> #include <GUIConstantsEx.au3> Opt("GUIOnEventMode", 1) Local $x = 1, $y = 1 GuiCreate("") $a = GUICreate("") $pic = GUICtrlCreatePic("gif.gif",$x,$y, 101, 129) GuiSetState() GUICtrlSetOnEvent($pic, "MoveIt") Func MoveIt() $start = GUIGetCursorInfo($a) While _IsPressed("01") $array = GUIGetCursorInfo($a) GUICtrlSetPos ($pic, $x + $array[0] - $start[0], $y + $array[1] - $start[1]) Sleep(10) WEnd $x += $array[0] - $start[0] $y += $array[1] - $start[1] EndFunc While True Sleep(1000) WEnd(u should have any image in script folder, rename "gif.gif" as u want) In this code, u can move "gif.gif" over whole main gui window. So I'm asking: Is it possible to create something like this (i.e. movable picture) indepentdent from gui OR create fully invisible picture-size gui window? Edited July 30, 2010 by 4ggr35510n Share this post Link to post Share on other sites
DarkAngel 0 Posted July 30, 2010 Hi, I was wondering is it possible to create on desktop movable and "actionable" image/picture, from which I could start main gui-windows or functions of my program? My curiosity starts with this code: #include <misc.au3> #include <GUIConstantsEx.au3> Opt("GUIOnEventMode", 1) Local $x = 1, $y = 1 GuiCreate("") $a = GUICreate("") $pic = GUICtrlCreatePic("gif.gif",$x,$y, 101, 129) GuiSetState() GUICtrlSetOnEvent($pic, "MoveIt") Func MoveIt() $start = GUIGetCursorInfo($a) While _IsPressed("01") $array = GUIGetCursorInfo($a) GUICtrlSetPos ($pic, $x + $array[0] - $start[0], $y + $array[1] - $start[1]) Sleep(10) WEnd $x += $array[0] - $start[0] $y += $array[1] - $start[1] EndFunc While True Sleep(1000) WEnd (u should have any image in script folder, rename "gif.gif" as u want) In this code, u can move "gif.gif" over whole main gui window. So I'm asking: Is it possible to create something like this indepentdent from gui OR create fully invisible picture-size gui window? You cant really add a gif in the script and expect it to act like an animated gif. There are some UDFs though that somewhat makes that possible. Run a search in the forum. And u can always set transparency to ur GUi. Use WinSetTrans() >> Look in the Help file for details. $GUI = GUICreate("GUI_Title", 394, 242, -1, -1) ;$i = anything from 0 to 255 ;0=fully transparent ;255=fully opaque WinSetTrans($GUI, "", $i) Hope this helps. Share this post Link to post Share on other sites
4ggr35510n 0 Posted July 30, 2010 (edited) No, sorry, it makes whole window invisible, including the pic. I'm looking for final effect similar to this: It's a screenshot of Microsoft Agent.Its a definable picture, u can move all around the screen and access to context menu threw it.How should I do something like this? Edited July 30, 2010 by 4ggr35510n Share this post Link to post Share on other sites
kaotkbliss 146 Posted July 30, 2010 (edited) Here is a zoom tool that I was making for a game (modified from others found on the forums), it should have features in it you can use to make what you want. It creates a boarderless gui that uses a screenshot of the current mouse position (enlarged) and you can click through it. Press "z" to start and "esc" to exit. The code should be pretty easy to modify to not enlarge the screenshot and instead of crosshairs you can use your image... expandcollapse popup#include <Misc.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> #include <WinAPIEx.au3> $dll = DllOpen("user32.dll") Global $hParent, $hForm, $Pos, $hBitmap = 0, $Go = 1, $XPrev = MouseGetPos(0), $YPrev = MouseGetPos(1) Global $hDC, $hMemDC, $hSv, $pBlend, $tBlend, $pSize, $tSize, $pSource, $tSource, $hWnd,$iX,$iY,$iHeight Global $scope = 0 ;$Cursor="E:\Shawns_Stuff\Terisi_PF\data\cross_l.cur" ;$CursorBack = 'E:\Shawns_Stuff\Terisi_PF\data\arrow_m.cur' $hParent = GUICreate('', -1, -1, -1, -1, -1, BitOR($WS_EX_LAYERED,$WS_EX_TOOLWINDOW,$WS_EX_TRANSPARENT )) $hForm = GUICreate('', 150, 150, $XPrev + 25, $YPrev + 25, BitOR($WS_DISABLED, $WS_POPUPWINDOW), BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST,$WS_EX_TRANSPARENT ), $hParent) GUISetState(@SW_HIDE, $hForm) While 1 If _IsPressed("1B", $dll) Then ;$cDll = DllCall($dll, "hwnd", "LoadCursorFromFile", "str", $CursorBack) ;DllCall($dll, "int", "SetSystemCursor", "int", $cDll[0], "int", 32512) DllClose($dll) Exit (1) EndIf If _IsPressed("5A", $dll) And $scope = 0 Then ;$cDll = DllCall($dll, "hwnd", "LoadCursorFromFile", "str", $Cursor) ;DllCall($dll, "int", "SetSystemCursor", "int", $cDll[0], "int", 32512) $scope = 1 Sleep(500) EndIf If _IsPressed("5A", $dll) And $scope = 1 Then ;$cDll = DllCall($dll, "hwnd", "LoadCursorFromFile", "str", $CursorBack) ;DllCall($dll, "int", "SetSystemCursor", "int", $cDll[0], "int", 32512) $scope = 0 GUISetState(@SW_HIDE, $hForm) Sleep(500) EndIf If $scope = 1 Then GUISetState(@SW_SHOWNOACTIVATE, $hForm) $Pos = MouseGetPos() If ($Go) Or ($Pos[0] <> $XPrev) Or ($Pos[1] <> $YPrev) Then WinMove($hForm, '', $Pos[0] - 75, $Pos[1] - 75) _Capture($Pos[0] - 25, $Pos[1] - 25, 50, 50) $XPrev = $Pos[0] $YPrev = $Pos[1] $Go = 0 EndIf _Capture($Pos[0] - 25, $Pos[1] - 25, 50, 50) EndIf WEnd Func _Capture($iX, $iY, $iWidth, $iHeight) Local $tRect, $hDC, $hMemDC, $hScreenshort = _ScreenCapture($iX, $iY, $iWidth, $iHeight) _WinAPI_FreeObject($hBitmap) $hBitmap = _WinAPI_FitToBitmap($hScreenshort, 150, 150) _WinAPI_FreeObject($hScreenshort) $hDC = _WinAPI_GetDC($hForm) $hMemDC = _WinAPI_CreateCompatibleDC($hDC) _WinAPI_SelectObject($hMemDC, $hBitmap) _WinAPI_SelectObject($hMemDC, _WinAPI_GetStockObject($NULL_BRUSH)) _WinAPI_SelectObject($hMemDC, _WinAPI_GetStockObject($DC_PEN)) _WinAPI_SetDCPenColor($hMemDC, 0xA00000) $aMiniSize = WinGetClientSize($hForm) $aMyMiniDC = DLLCall($dll,"int","GetDC","hwnd",$hForm) DLLCall("gdi32.dll","int","Arc", "hwnd", $aMyMiniDC[0], _ "int", 0, "int", 0, "int", $aMiniSize[0], "int", $aMiniSize[1], _ "int", 0, "int", $aMiniSize[1]/2, "int", 0, "int", $aMiniSize[1]/2) DLLCall("gdi32.dll","int","MoveToEx", "hwnd", $aMyMiniDC[0], "int", 0, "int", $aMiniSize[1]/2, "ptr", 0) DLLCall("gdi32.dll","int","LineTo", "hwnd", $aMyMiniDC[0], "int", $aMiniSize[0], "int", $aMiniSize[1]/2) DLLCall("gdi32.dll","int","MoveToEx", "hwnd", $aMyMiniDC[0], "int", $aMiniSize[0]/2, "int", 0, "ptr", 0) DLLCall("gdi32.dll","int","LineTo", "hwnd", $aMyMiniDC[0], "int", $aMiniSize[0]/2, "int", $aMiniSize[1]) _WinAPI_DrawLine($hMemDC, 150, 75, -150, 75) _WinAPI_DrawLine($hMemDC, 75, 150, 75, -150) _WinAPI_DrawLine($hMemDC, 70, 65, 80, 65) _WinAPI_DrawLine($hMemDC, 85, 70, 85, 80) _WinAPI_DrawLine($hMemDC, 70, 85, 80, 85) _WinAPI_DrawLine($hMemDC, 65, 70, 65, 80) _WinAPI_DrawLine($hMemDC, 65, 50, 85, 50) _WinAPI_DrawLine($hMemDC, 100, 65, 100, 85) _WinAPI_DrawLine($hMemDC, 65, 100, 85, 100) _WinAPI_DrawLine($hMemDC, 50, 65, 50, 85) _WinAPI_DrawLine($hMemDC, 60, 35, 90, 35) _WinAPI_DrawLine($hMemDC, 115, 60, 115, 90) _WinAPI_DrawLine($hMemDC, 60, 115, 90, 115) _WinAPI_DrawLine($hMemDC, 35, 60, 35, 90) _WinAPI_ReleaseDC($hForm, $hDC) _WinAPI_DeleteDC($hMemDC) _SetBitmap($hForm, $hBitmap, 254) EndFunc ;==>_Capture Func _ScreenCapture($iX, $iY, $iWidth, $iHeight) Local $hWnd, $hDC, $hMemDC, $hBitmap $hWnd = _WinAPI_GetDesktopWindow() $hDC = _WinAPI_GetDC($hWnd) $hMemDC = _WinAPI_CreateCompatibleDC($hDC) $hBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $iWidth, $iHeight) _WinAPI_SelectObject($hMemDC, $hBitmap) _WinAPI_BitBlt($hMemDC, 0, 0, $iWidth, $iHeight, $hDC, $iX, $iY, $MERGECOPY) _WinAPI_ReleaseDC($hWnd, $hDC) _WinAPI_DeleteDC($hMemDC) Return $hBitmap EndFunc ;==>_ScreenCapture Func _SetBitmap($hWnd, $hBitmap, $iOpacity) $hDC = _WinAPI_GetDC($hWnd) $hMemDC = _WinAPI_CreateCompatibleDC($hDC) $hSv = _WinAPI_SelectObject($hMemDC, $hBitmap) $tSize = _WinAPI_GetBitmapDimension($hBitmap) $pSize = DllStructGetPtr($tSize) $tSource = DllStructCreate($tagPOINT) $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate($tagBLENDFUNCTION) $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, 'Alpha', $iOpacity) DllStructSetData($tBlend, 'Format', 0) _WinAPI_UpdateLayeredWindow($hWnd, $hDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA) _WinAPI_ReleaseDC($hWnd, $hDC) _WinAPI_SelectObject($hMemDC, $hSv) _WinAPI_DeleteDC($hMemDC) EndFunc ;==>_SetBitmap Edited July 30, 2010 by kaotkbliss 010101000110100001101001011100110010000001101001011100110010000001101101011110010010000001110011011010010110011100100001My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueekWe're gonna need another Timmy! Share this post Link to post Share on other sites