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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By nacerbaaziz
      hello guys, please i need your help
      am trying to work with CreateWindowEx api, i created the window with it controls, also i setup the call back function
      i'am using WinMSGLoop to focus with the keyboard.
      here i have a problem, i hope that you can help me.
      on the controls i used the UDF that comme with the autoit, such as _GUIButton_Create, _GUIListBox_Create....
      but i can't find a STATIC control UDF, for that i used this

      local $h_ssrvlbl = _WinAPI_CreateWindowEx(0, "STATIC", "الخادم", BitOr($WS_VISIBLE, $WS_CHILD, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN), 250, 10, 100, 20, $hWnd)
      as you can see here, there is an arabic text, so here is the problem, the arabic text isn't show normally, what is the problem here?
      also i have  an other question about keyboard focus, when i used WinMSGLoop, it worked, but if i press alt+tab to switch windows or focus an other window and return back to my window, the focus of control is kill.
      can any one help me to solve that please?
      my code will be as file here with the include files
      i hope can any one help me here
      thanks in advance
      speed Test win.zip
    • 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

      Support for this UDF can be obtained in my Discord Server
    • By MASKED
      hi guys
      i am using imagesearch2015 library. (used another one before)
      but transparency parameter doesn't working. how i can solve this problem.
      here's my code
      #include "ImageSearch2015.au3" #include <Date.au3> ; Script Start - Add your code below here Global $x = 0 Global $y = 0 HotKeySet("{UP}","hey") HotKeySet("{DOWN}","heyo") Func hey() $balikcisaniye = _Date_Time_GetTickCount() $array = _ImageSearchArea("bul.bmp", 1, 0, 0, @DesktopWidth, @DesktopHeight, $x, $y, 2,0x000000) if($array = True) Then $balikcisaniye1 = _Date_Time_GetTickCount() MouseMove($x,$y) MsgBox(1,"","Found." & $x & "-" & $y & " / " & $balikcisaniye1-$balikcisaniye) Else MsgBox(1,"","Not Found.") EndIf EndFunc Func heyo() exit EndFunc while 1 WEnd when i disable transparency parameter, it work normal. but with parameter, this function is always returning false.
      please help.
      here's library i use :
    • By tarretarretarre
      About AutoIt-API-WS
      AutoIt-API-WS is a light weight web server with expressive syntax, with the sole purpose of wrapping your existing AutoIt app with little to no effort.
      With AutoIt-API-WS you can send and receive data between any application or framework, as long they can handle HTTP requests, which is an industry standard today.
      Like my other communcations UDF AutoIt-Socket-IO AutoIt-API-WS is heavily inspired from the big boys, but this time its Laravel and Ruby on Rails.
      Features Highlights
      No external or internal dependencies required RESTful mindset when designed Expressive syntax Small codebase Heavy use of Michelsofts Dictionary object Limitations
      Not complient with any RFC, so something important could be missing. Time will tell! One persons slow loris attack will kill the process forever. Example of implemetnation (With screenshots)
      This is a basic cRud operation with the RESTful mindset in use.
      #include "API.au3" #include <Array.au3> _API_MGR_SetName("My APP DB adapter") _API_MGR_SetVer("1.0 BETA") _API_MGR_SetDescription("This adapter allows you to get this n that") _API_MGR_Init(3000) _API_MGR_ROUTER_GET('/users', CB_GetUsers, 'string sortBy', 'Get all users, sortBy can be either asc or desc. asc is default') _API_MGR_ROUTER_GET('/users/{id}', CB_GetUsersById, 'int id*', 'Get user by id') While _API_MGR_ROUTER_HANDLE() WEnd Func DB_GetUsers() Local $userA = ObjCreate("Scripting.Dictionary") Local $userB = ObjCreate("Scripting.Dictionary") $userA.add('id', 1) $userA.add('name', 'TarreTarreTarre') $userA.add('age', 27) $userB.add('id', 2) $userB.add('name', @UserName) $userB.add('age', 22) Local $aRet = [$userA, $userB] Return $aRet EndFunc Func CB_GetUsers(Const $oRequest) Local $aUsers = DB_GetUsers() If $oRequest.exists('sortBy') Then Switch $oRequest.item('sortBy') Case Default Case 'asc' Case 'desc' _ArrayReverse($aUsers) EndSwitch EndIf Return $aUsers EndFunc Func CB_GetUsersById(Const $oRequest) Local Const $aUsers = DB_GetUsers() Local $foundUser = Null For $i = 0 To UBound($aUsers) -1 Local $curUser = $aUsers[$i] If $curUser.item('id') == $oRequest.item('#id') Then $foundUser = $curUser ExitLoop EndIf Next If Not IsObj($foundUser) Then Return _API_RES_NotFound(StringFormat("Could not find user with ID %d", $oRequest.item('#id'))) EndIf return $foundUser EndFunc When you visit http://localhost:3000 you are greeted with this pleasent view that will show you all your registred routes and some extra info you have provided.

      When you visit http://localhost:3000/users the UDF will return the array of objects as Json
      And here is an example of http://localhost:3000/users/1

      More examples can be found here
       (NEWEST 2020-09-21)
      Autoit-API-WS-1.0.0-beta.zip Autoit-API-WS-1.0.1-beta.zip
  • Create New...