Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/28/2020 in all areas

  1. Nine

    Overlapped Named Pipe IPC

    From this this thread, I started to get interested in very fast communication that could be used between VBS or AutoIt. And thanks to @argumentum, he is always there to challenge any IPC solution . My last tests show that a request from a dedicated client is about 7ms to transit to the server. And a small response takes about 4ms to be sent from the server to the client. From a basic snippet, I changed it to make a UDF on request from the community of @mLipok . Now with this UDF, you can create duplex communication but also dual channels (one way to) IPC. You can also make it persistent (close to a Peer-to-Peer approach) or a transactional (more of a client-server protocol). Example 1 : Duplex and persistent Example 2 : Dual and persistent (VBS example included) Example 3 : Duplex and transactional Whether you find it useful or not, your comments are always welcome ! (former is my preference though) Version 2022-02-11 * Added security descriptor to allow mix elevation between Client and Server * Added support for IPC between computers Version : 2020-12-30 * Added documentation to the UDF file * Optimized code * Moved some code from Example files into UDF file NPIPC UDF.zip
    3 points
  2. If you don't want Desktop and Windows Explorer to trigger, the CodeProject link had one extra step checking for something like this.. $sActiveProcess = WinGetText (_WinAPI_GetForegroundWindow ( )) if StringInStr($sActiveProcess, "explorer") = 0 and not $sActiveProcess = "" then ; Do Stuff endif
    1 point
  3. Hell yeah, you're amazing! You found almost the same solution as I did: WinGetPos(). There you set yourself a little trap. $aInfo[2] is the active control that gets the keyboard input. This is passed to the function "MoveMyForm()" as second parameter. You also passed it as the first parameter and treated it as if it were the active window. Thus you have a false/positive bug in "_WinAPI_GetTopWindow ( $_ActiveWin )" which is actually "_WinAPI_GetTopWindow ( $_ActiveCtrl )". However, edits do not have child windows, so the function always returns 0. So you could also use: ; _WinAPI_ClientToScreen(_WinAPI_GetTopWindow ( $_ActiveWin ), $tPoint) _WinAPI_ClientToScreen(0, $tPoint) WinMove($hForm, "", DllStructGetData($tPoint, "X"), DllStructGetData($tPoint, "Y")) EndFunc But that doesn't change the fact that your code works! 👍 That's correct and I thought exactly the same in my code and included "$iYAdjust = $_iCaretHeight", which is also supplied by "_WinAPI_GetGUIThreadInfo()".
    1 point
  4. Ok, this one works with SciTE output as well (changed bit inside move func, also the call to move func, but as it is sending $aInfo[2] as activewin handle). If this helps maybe it can be improved. Not quite right but better perhaps. Tested with: 1. SciTE main window 2. SciTE output 3. Notepad++ 4. Windows Run menu (unintentional test while starting notepad ) 5. Notepad Still some issues with Excel, was better with earlier version. ; ; _WinAPI_GetGUIThreadInfo() Tests ; ; Demo 1, 2020-12-28, Professor Bernd. ; ; First test with the example from the AutoIt help for "_WinAPI_GetGUIThreadInfo()" ; looks good. I just changed the GUI to a non-focusable GUI without border, and ; added a button to close the GUI. ; There is no stealing of the focus and no eating of clicks or double clicks. #include <GUIConstantsEx.au3> #include <WinAPISysWin.au3> #include <WindowsConstants.au3> #include <WinAPIConv.au3> ; Local $hForm = GUICreate('', 240, 268, 10, 10, BitOR($WS_CAPTION, $WS_POPUP), $WS_EX_TOPMOST) Global $hForm = GUICreate('', 260, 268, 10, 10, _ BitOR($WS_POPUP, $WS_BORDER), BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST, $WS_EX_NOACTIVATE)) Global $btnClose = GUICtrlCreateButton("X", 230, 10, 24, 24) GUICtrlCreateLabel('Thread state:', 20, 18, 90, 14) GUICtrlCreateLabel('Active window:', 20, 40, 90, 14) GUICtrlCreateLabel('Keyboard focus:', 20, 62, 90, 14) GUICtrlCreateLabel('Mouse capture:', 20, 84, 90, 14) GUICtrlCreateLabel('Active menu:', 20, 106, 90, 14) GUICtrlCreateLabel('Move or size loop:', 20, 128, 90, 14) GUICtrlCreateLabel('Caret:', 20, 150, 90, 14) GUICtrlCreateLabel('Left:', 20, 172, 90, 14) GUICtrlCreateLabel('Top:', 20, 194, 90, 14) GUICtrlCreateLabel('Width:', 20, 216, 90, 14) GUICtrlCreateLabel('Height:', 20, 238, 90, 14) Local $a_idInput[11] For $i = 0 To 10 $a_idInput[$i] = GUICtrlCreateLabel('', 114, 18 + 22 * $i, 116, 14) Next GUISetState(@SW_SHOWNOACTIVATE) Local $hWnd, $aInfo, $iPID Do $hWnd = WinGetHandle('[ACTIVE]') $aInfo = _WinAPI_GetGUIThreadInfo(_WinAPI_GetWindowThreadProcessId($hWnd, $iPID)) If Not @error Then WinSetTitle($hForm, '', WinGetTitle($hWnd)) $aInfo[0] = '0x' & Hex($aInfo[0], 8) Else WinSetTitle($hForm, '', '') Dim $aInfo[11] For $i = 0 To 10 $aInfo[$i] = '' Next $hWnd = 0 EndIf For $i = 0 To 10 If StringCompare(GUICtrlRead($a_idInput[$i]), $aInfo[$i]) Then GUICtrlSetData($a_idInput[$i], $aInfo[$i]) EndIf Next MoveMyForm($hWnd, $aInfo[2], $aInfo[2], $aInfo[7], $aInfo[8]) Until GUIGetMsg() = $btnClose Func MoveMyForm($_hWnd, $_ActiveWin, $_ActiveCtrl, $_iX, $_iY) Local $aPos = WinGetPos($_ActiveWin) Local $iX = ($aPos="") ? (0):($aPos[0]) Local $iY = ($aPos="") ? (0):($aPos[1]) Local $tPoint = DllStructCreate("int X;int Y") DllStructSetData($tPoint, "X", $_iX + $iX) DllStructSetData($tPoint, "Y", $_iY + $iY) _WinAPI_ClientToScreen(_WinAPI_GetTopWindow ( $_ActiveWin ), $tPoint) WinMove($hForm, "", DllStructGetData($tPoint, "X"), DllStructGetData($tPoint, "Y")) EndFunc
    1 point
  5. I will link 2 pages, and you will tell me what to do with it 😛 I don't know either, but for anyone experienced with these stuff maybe they can interpret or propose something useful for your case. https://www.codeproject.com/Articles/34520/Getting-Caret-Position-Inside-Any-Application He is using GetGUIThreadInfo: https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getguithreadinfo
    1 point
  6. Danp2

    Clicking on unlisted element.

    You've contradicted yourself in a few places. First you said this -- Then you said this -- AFAIK, each element should be able to be addressed by a unique xpath.
    1 point
×
×
  • Create New...