Jump to content

UEZ

MVPs
  • Posts

    7,315
  • Joined

  • Last visited

  • Days Won

    76

UEZ last won the day on April 7 2024

UEZ had the most liked content!

About UEZ

  • Birthday 12/03/2007

Profile Information

  • Member Title
    Never say never
  • Location
    Germany
  • Interests
    Computer, watching movies, football (soccer), being lazy :-)

Recent Profile Visitors

9,110 profile views

UEZ's Achievements

  1. Is there a way to check if visible GUI is in dark mode? Edit: this seems to work: ;Coded by UEZ build 2025-05-14 #include <AutoItConstants.au3> #include <StringConstants.au3> #include <WinAPISysWin.au3> Const $DWMWA_USE_IMMERSIVE_DARK_MODE = @OSBuild < 18362 ? 19 : 20 Func _WinAPI_IsWindowDarkMode($hWnd) Local $value = DllStructCreate("int dm") Local $ret = DllCall("dwmapi.dll", "long", "DwmGetWindowAttribute","hwnd", $hWnd, "uint", $DWMWA_USE_IMMERSIVE_DARK_MODE, "struct*", $value, "uint", DllStructGetSize($value)) If @error Or $ret[0] <> 0 Then Return 0 Return $value.dm <> 0 EndFunc Global $aWinList = WinList(), $i, $iStatus For $i = 1 To $aWinList[0][0] If _WinAPI_IsWindowVisible($aWinList[$i][1]) Then If IsHWnd($aWinList[$i][1]) Then $iStatus = _WinAPI_IsWindowDarkMode($aWinList[$i][1]) ConsoleWrite($aWinList[$i][1] & ": " & $iStatus & " -> " & StringRegExpReplace($aWinList[$i][0], "[\r\n]+", "") & @CRLF) EndIf EndIf Next
  2. Nice work. It crashes for x64 just after displaying GUI : (609,0) IsObj($oIMFMediaEngineNotify) = 1 (648,0) Fact.CreateInstance(), hr = 0x00000000 (650,0) IMFEngine Created = True Test a few notifications.... Event: 22 >, Volume Change, Vol: 1.000000, Muted: True Event: 22 >, Volume Change, Vol: 1.000000, Muted: False Event: 1001 > Purge Queued Events Event: 1 > P1: 0, P2 0 (663,0) $oIMFEngine.SetSource hresult = 0x00000000 Event: 1001 > Purge Queued Events Event: 4 > P1: 0, P2 0 Event: 6 > Emptied Event: 1 > P1: 0, P2 0 (665,0) $oIMFEngine.Load hresult = 0x00000000 Event: 8 > Play Event: 12 > Waiting (667,0) $oIMFEngine.Play hresult = 0x00000000 Event: 21 > P1: 0, P2 0 Event: 10 > P1: 0, P2 0 Event: 11 > P1: 0, P2 0 Event: 14 > CanPlay Event: 15 > P1: 0, P2 0 Event: 18 > Time Update Event: 1000 > P1: 0, P2 0 Event: 1009 > P1: 0, P2 0 Event: 18 > Time Update Event: 18 > Time Update Event: 13 > Playing Event: 18 > Time Update !>09:52:06 AutoIt3.exe ended.rc:-1073741819 -1073741819 / 0xC0000005: An Access Violation is a type of Exception caused when an application Reads, Writes or Executes an invalid Memory Address. x86: it starts but get frozen after 1 sec and crashes with same error as for x64.
  3. Something like this here: #include <Array.au3> #include <Constants.au3> #include <WindowsConstants.au3> #include <SendMessage.au3> #include <WinAPISysWin.au3> #include <WinAPIGdi.au3> #include <WinAPIShellEx.au3> Global Const $WM_NOTIFYICON = $WM_USER + 1 Global Const $sWinTitle = "TrayExample" AutoItWinSetTitle($sWinTitle) Opt("TrayMenuMode", 3) Global $hHWND = WinGetHandle($sWinTitle) Global $hTaskbar = WinGetHandle("[CLASS:Shell_TrayWnd]") Global $hTray Example() Func Example() Local $idAbout = TrayCreateItem("About") TrayCreateItem("") Local $idExit = TrayCreateItem("Exit") HotKeySet("{F9}", ShowTrayMenu) $a = _WinAPI_EnumChildWindows($hTaskbar) $iPos = _ArraySearch($a, "TrayNotifyWnd", 0, 0, 0, 0, 1, 1) If Not @error Then $hTray = $a[$iPos][0] EndIf While True Switch TrayGetMsg() Case $idExit ExitLoop Case $idAbout MsgBox($MB_SYSTEMMODAL, "About", "AutoIt tray menu example." & @CRLF & @CRLF & _ "Version: " & @AutoItVersion & @CRLF & _ "Install Path: " & StringLeft(@AutoItExe, StringInStr(@AutoItExe, "\", 0, -1) - 1)) EndSwitch If CheckMouseOverTrayIcon() = 1 And WinExists("[CLASS:#32768]") = 0 Then ShowTrayMenu() WEnd EndFunc ;==>Example Func ShowTrayMenu() _SendMessage($hHWND, $WM_NOTIFYICON, 0, $WM_LBUTTONDOWN) EndFunc ;==>ShowTrayMenu Func CheckMouseOverTrayIcon() Local $tNID = DllStructCreate("dword cbSize;hwnd hWnd;uint uID;uint uFlags") Local $hTrayWnd = _WinAPI_GetShellWindow() If $hTrayWnd = 0 Then Return -1 DllStructSetData($tNID, "cbSize", DllStructGetSize($tNID)) DllStructSetData($tNID, "hWnd", $hTray) DllStructSetData($tNID, "uID", 1) Local $tRECT = _WinAPI_ShellNotifyIconGetRect(WinGetHandle(AutoItWinGetTitle()), 1) If @error Then Return -2 Local $aPos = _WinAPI_GetPosFromRect($tRECT) Local $aMousePos = MouseGetPos() If $aMousePos[0] >= $aPos[0] And $aMousePos[0] <= $aPos[0] + $aPos[2] And $aMousePos[1] >= $aPos[1] And $aMousePos[1] <= $aPos[1] + $aPos[3] Then Return 1 EndIf Return 0 EndFunc ;==>CheckMouseOverTrayIcon Will work properly when icon is visible on the taskbar. Tested on Win11 24H2.
  4. Maybe you can test singleton using Atom.
  5. Just wondering why API call is different when using Freebasic: 'Coded by UEZ build 2025-03-29 #include "windows.bi" 'https://learn.microsoft.com/de-de/windows/win32/api/winbase/nf-winbase-createsemaphorea Function _WinAPI_CreateSemaphore(sOccurrenceName As String, InitCount As Long = 0, MaxCount As Long = 1) As HANDLE Dim As HANDLE hSemaphore = CreateSemaphore(NULL, InitCount, MaxCount, sOccurrenceName) If GetLastError() = ERROR_ALREADY_EXISTS Then Return 0 If hSemaphore = 0 Then Return -1 Return hSemaphore End Function Dim As HANDLE hSemaphore = _WinAPI_CreateSemaphore("1a2b3c4d5e6f") If hSemaphore = 0 Then End MessageBox(0, "An occurrence of this app (x64 or x86) is already running! Exiting...", "ERROR", MB_OK Or MB_ICONSTOP Or MB_TOPMOST) MessageBox(0, "Started", "Information", MB_OK Or MB_TOPMOST Or MB_ICONINFORMATION) If hSemaphore > 0 Then ReleaseSemaphore(hSemaphore, 1, NULL) CloseHandle(hSemaphore) End If In FB I call the CreateSemaphore with the key whereas in Autoit the first call is empty. Any other call with the compiled exe regardless if it is x86 or x64 it will show the MsgBox.
  6. Hi KaFu, I now have a new notebook and have not looked into the problem since then because it works with ioa747's suggestion. Maybe I will make some tests. Btw, I have no problems with the CreateSemaphore code from post#1. Edit: still same problem with x86. #AutoIt3Wrapper_UseX64=n ShellExecute("C:\Users\Public\Desktop\Adobe Acrobat.lnk")
  7. Skinning the cat makes it ugly. 😉 _WinAPI_SetLayeredWindowAttributes($hGUI_Child, 0x123456, 0x60) makes the child GUI transparent, too.
  8. Use child GUI: ... Global Const $SC_DRAGMOVE = 0xF012 Global $iW = 300, $iH = 100, $hHBitmap Global $hGUI = GUICreate("Parent", $iW, $iH, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST)), _ $hGUI_Child = GUICreate("", 30, 20, 0, 0, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $hGUI) Global $hButton = GUICtrlCreateButton("Test", 0, 0, 30, 20) GUICtrlSetBkColor($hButton, 0x000000) GUICtrlSetColor($hButton, 0x00FF00) GUISetBkColor(0x123456, $hGUI_Child) _WinAPI_SetLayeredWindowAttributes($hGUI_Child, 0x123456) GUISetState(@SW_SHOW, $hGUI_Child) GUISetState(@SW_SHOW, $hGUI) ...
  9. Interesting that the input string must be in that format. #include <Array.au3> #include <WinAPIDiag.au3> Local $sFilename = "c:\Test\MyTestFile.xyž" Local $aCall = DllCall("OleAut32.dll", "ptr", "SysAllocString", "wstr", $sFilename) $t = DllStructCreate("wchar p[" & StringLen($sFilename) & "]", $aCall[0]) _WinAPI_DisplayStruct($t) DllCall("OleAut32.dll", "none", "SysFreeString", "ptr", $aCall[0]) ž = 0000 0001 0111 1110 -> 1 126 Wondering why there is no API documentation...
  10. Error 3221225477 is hex 0xC000005 which is an access violation. Without the possibility to test it with the DLL, it will be difficult to find the problem.
  11. When I read the VB code, I understand that the length of the string will be written to dwOutSize variable. Passing $dwOutSize to the dll call make no sense because you pass a value, not the pointer to the variable. Can you test? $tLength = DllStructCreate("long dwOutSize") Local $aDllCallReturn = DllCall("XYZDECRYPT.DLL", "str", "DECRYPTXYZFILE", "str", $sFullFileName, "struct*", $tLength) ConsoleWrite($tLength.dwOutSize & @CRLF)
  12. It was more an information to M23 because of the embedded executable... These files can be found somewhere in this forum.
  13. dwOutSize As Long should be "long", $dwOutSize otherwise, if this is a pointer to a struct then try $dwOutSize = DllStructCreate("long dwOutSize") Local $aDllCallReturn = DllCall("XYZDECRYPT.DLL", "str", "DECRYPTXYZFILE", "str", $sFullFileName, "struct*", $dwOutSize)
  14. Meanwhile also source codes will be classified as malware! Microsoft Defender Antivirus has detected malware or other potentially unwanted software. For more information please see the following: https://go.microsoft.com/fwlink/?linkid=37020&name=Trojan:AutoIt/Prcablt.SD!MTB&threatid=2147740918&enterprise=1 Name: Trojan:AutoIt/Prcablt.SD!MTB ID: 2147740918 Severity: Severe Category: Trojan Path: containerfile:_C:\Coding\AU3\Internet\Mp3SearchEngine\Mp3SearchEngine v1.0.8.8.au3; containerfile:_C:\Coding\AU3\Tools\WallpaperBank\WallpaperBank v1.0.2.0.au3; file:_C:\Coding\AU3\Internet\Mp3SearchEngine2\Mp3SearchEngine_v2.0.1.1.au3; file:_C:\Coding\AU3\Internet\Mp3SearchEngine\Mp3SearchEngine v1.0.8.8.au3->(UTF-8); file:_C:\Coding\AU3\SystemInfo\CompStats\Computer Stats Utility 2.0.2.0.au3; file:_C:\Coding\AU3\Tools\HTML Imager\HTML Imager v1.0.1.1.au3; file:_C:\Coding\AU3\Tools\HTML Imager\HTML Imager v1.0.1.2.au3; file:_C:\Coding\AU3\Tools\HTML Imager\HTML Imager v1.0.1.3.au3; file:_C:\Coding\AU3\Tools\ImageSplitter\ImageSplitter v1.0.0.7.au3; file:_C:\Coding\AU3\Tools\Mp3SearchEngine\Mp3SearchEngine v1.0.9.2.au3; file:_C:\Coding\AU3\Tools\WallpaperBank\WallpaperBank v1.0.2.0.au3->(UTF-8); Detection Origin: Local machine Detection Type: Concrete Detection Source: System User: NT AUTHORITY\SYSTEM Process Name: C:\Programme\Editor\Notepad3\Notepad3.exe Security intelligence Version: AV: 1.421.1531.0, AS: 1.421.1531.0, NIS: 1.421.1531.0 Engine Version: AM: 1.1.24090.11, NIS: 1.1.24090.11
  15. Something like that? #include <GUIConstantsEx.au3> #include <WinAPIGdi.au3> #include <WinAPIHObj.au3> #include <WinAPISys.au3> #include <WindowsConstants.au3> #include <ColorConstants.au3> #include <GUIConstantsEx.au3> #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WinAPIGdi.au3> #include <WinAPIHObj.au3> #include <WinAPISys.au3> #include <WindowsConstants.au3> #include <ColorConstants.au3> #include <GUIConstantsEx.au3> #include <Timers.au3> $hGUI = GUICreate('Move region - is it possible.. ?', 600, 600) GUISetBkColor($COLOR_RED, $hGUI) GUISetState(@SW_SHOW, $hGUI) Global $x = 0, $y = 0, $iWidth = 80, $iHeight = 80 $hRgn1 = _WinAPI_CreateRectRgn($x, $y, $x + $iWidth, $y + $iHeight) Global $x = 120, $y = 120, $iWidth = 80, $iHeight = 80 $hRgn2 = _WinAPI_CreateRectRgn($x, $y, $x + $iWidth, $y + $iHeight) $hCombinedRgn = _WinAPI_CreateRectRgn(0, 0, WinGetPos($hGUI)[2], WinGetPos($hGUI)[3]) _WinAPI_CombineRgn($hCombinedRgn, $hCombinedRgn, $hRgn1, 1) _WinAPI_CombineRgn($hCombinedRgn, $hCombinedRgn, $hRgn2, 3) _WinAPI_SetWindowRgn($hGUI, $hCombinedRgn) ;help me ;how to move region? ;ex. _WinAPI_MoveRgn ... (set new iX iY) ;ex. _WinAPI_RgnSetPos ... (set new iX iY) ;any ideas? Global $i, $tPAINTSTRUCT _Timer_SetTimer($hGUI, 10, "UpdateRegion") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE _Timer_KillAllTimers($hGUI) _WinAPI_DeleteObject($hRgn1) _WinAPI_DeleteObject($hRgn2) _WinAPI_DeleteObject($hCombinedRgn) ExitLoop EndSwitch WEnd Func UpdateRegion($hWnd, $iMsg, $iIDTimer, $iTime) #forceref $hWnd, $iMsg, $iIDTimer, $iTime _WinAPI_OffsetRgn($hRgn2, Sin($i) * 10, Cos($i) * 10) $i += 0.1 $hCombinedRgn = _WinAPI_CreateRectRgn(0, 0, WinGetPos($hGUI)[2], WinGetPos($hGUI)[3]) _WinAPI_CombineRgn($hCombinedRgn, $hCombinedRgn, $hRgn1, 1) _WinAPI_CombineRgn($hCombinedRgn, $hCombinedRgn, $hRgn2, 3) _WinAPI_SetWindowRgn($hGUI, $hCombinedRgn) _WinAPI_DeleteObject($hCombinedRgn) EndFunc
×
×
  • Create New...