Jump to content

Recommended Posts

Two things.

1) I want to make a transparent, ontop, window that I can draw on and click through so that I din't have to redraw constantly such as when I use the hwnd/hDC of another window.

2) How can I set an autoit gui as a child of a non-autoit window?

I saw mention of how to do #1 somewhere but I can't find it again.

Share this post

Link to post
Share on other sites

_WinAPI_SetLayeredWindowAttributes() & _WinAPI_SetParent() & look at this >>

Also please don't bump your threads less than 24 hours.

Edited by guinness

UDF List:

_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post

Link to post
Share on other sites

maybe something in here will help? I was working on this to add a gun scope option to a game I was making. it works fine in xp but seems to be having some issue with my win 7 64 bit now. (I haven't touched this code in a long time)

#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
;$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)
  Exit (1)
 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
 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)
 If $scope = 1 Then
  $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
  _Capture($Pos[0] - 25, $Pos[1] - 25, 50, 50)
Func _Capture($iX, $iY, $iWidth, $iHeight)
 Local $tRect, $hDC, $hMemDC, $hScreenshort = _ScreenCapture($iX, $iY, $iWidth, $iHeight)
 $hBitmap = _WinAPI_FitToBitmap($hScreenshort, 150, 150)
 $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)
 _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)
 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)
EndFunc   ;==>_SetBitmap



My Android cat and mouse game

We're gonna need another Timmy!

Share this post

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Similar Content

    • By xYuri
      This simple dllcall gives me error 5, access denied,
      Func _WinAPI_VkKeyScan($__key) _WinAPI_SetLastError(0) $res = DllCall('User32.dll', 'SHORT', 'VkKeyScan', 'CHAR', $__key) _xConsole('res: '&$res) $_LastErr = _WinAPI_GetLastError() If $_LastErr <> 0 Then _xConsole('Err: {' & $_LastErr & '}> ' & _WinAPI_GetLastErrorMessage()) Return $res EndFunc Am i doing something wrong?
      Also tried VkKeyScanA and W
      I want to send `:` via PostMessage() WM_KEYDOWN
    • By nacerbaaziz
      hello sirs
      please i want to use the WinHttp to get the google drive file title using the api
      i searched in the forom but i didn't found any Google drive api UDF
      for that i liked to ask you for that
      i had read the google drive api documentation but i couldn't do it
      please help me
      here is the api doc
      note i've got the apikey and i have the file id
      what i want is to get the title of the file (the file name)
      because i want to download the files from the google drive using the autoit
      please help me for that
      am sorry because i didn't gave you any example or what i tried but all what tried was  failed
      thanks in advance
    • By Sori
      Not going to dump the code down because it's essentially a keylogger.
    • By nacerbaaziz
      hello sirs, please i created a tool witch get the focused control in a window and play a audio file linked with this controls
      e.g buttons, checkBoxes, radios, comboboxes, and others
      i know that their is a function that give us the control focus but it return the classNN
      i want to get the class name to use it with a switch and
      because their are more than class e.g button tbutton timagebutton tnewButton...
      please can any one help me to get the class name not the classnn
      thanks in advance
    • By rcmaehl
      Hi all, 

      Recently my work swapped from Cisco CTIOS to Finesse. This completely threw me off as I had been automating the Win32 application and I had never done IUIAutomation before. As such I've been messing around with the API and will be adding code as I figure it out. While I do have Supervisor access, I will likely not be adding functions for those features yet.
      Currently Available Functions:
      User API - Query and Set User Info
      Dialog API - Query and Set Call and other Dialog Info
      Queue API - Query Assigned Queues
      Team API - Query Users in a Team

  • Create New...