Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/08/2024 in all areas

  1. Nice trick M23, to make it more like modern menu how about using this character (instead of null) : $mDummymenu = GUICtrlCreateMenu("≡")
    3 points
  2. So another vscode extension for the AutoIt language emerges! I've tried the existing ones, and found small problems that i felt i could improve on, but it would require an entire new approach to the inner working of the existing extensions. Also working on a complete AutoIt3 parser a vscode extension just made sense Any feedback is appreciated, and i hope this project will benefit more than just me 🤡 Visual Studio Code Marketplace GitHub repo Some of the current features: Basic AutoIt2 syntax highlighting, for fun 🤡 AutoIt3 syntax highlighting Variable/Function hover gives declaration information if available. Goto declaration #include links Syntax checking, as you type Function signature help Function and variable list in a file via the outline tab. Works on desktop (any OS) and web version ⚠️ The parser used is not yet 100% complete (see issues for know problems), and the last thing to be implemented is the With code block. Hope you like 😃
    1 point
  3. TheAutomator, The trick I have used in the past only works when you to have an initial "normal" menu entry - so how about this: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 615, 437, 192, 124) $mDummymenu = GUICtrlCreateMenu("") $menu1 = GUICtrlCreateMenuItem("click me", -1) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $menu1 MsgBox(64,'yes!','it works') ; does! EndSwitch WEnd M23
    1 point
  4. Here one way : #include <GUIConstants.au3> #include <WindowsConstants.au3> #include <GuiMenu.au3> Opt("MustDeclareVars", True) Global $hGUI = GUICreate("Form1", 625, 442, 370, 232) Global $idMenu = GUICtrlCreateMenu("Click me") Global $hMenu = _GUICtrlMenu_GetMenu($hGUI) Global $idChoice = GUICtrlCreateDummy() GUISetState() GUIRegisterMsg($WM_MENUSELECT, WM_MENUSELECT) While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $idChoice ConsoleWrite("Menu clicked " & GUICtrlRead($idChoice) & @CRLF) EndSwitch WEnd Func WM_MENUSELECT($hWnd, $iMsg, $wParam, $lParam) Local $iIndex = _WinAPI_LoWord($wParam) Local $iFlag = _WinAPI_HiWord($wParam) If $iIndex = 0 And BitAND($iFlag, $MF_MOUSESELECT) And $lParam = $hMenu Then GUICtrlSendToDummy($idChoice, $iIndex) EndMenu() EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_MENUSELECT Func EndMenu() DllCall("user32.dll", "bool", "EndMenu") EndFunc
    1 point
  5. On a side note, when using structures (especially at the beginning or your learning), you should always check their integrity by showing the content of the structures with _WinAPI_DisplayStruct function. When creating more complex structures, alignement can, without notice, include some paddings that you may want or not. Just so you are aware of this...
    1 point
  6. There are two separate issues here, 1. struct element retrieval and 2. Hex representation. ad 1. struct dot notation won't tell you this, but if you check the help page for DllStructGetData, you'll see: ad 2. Reading up on the Hex function in the Help, you'll find:
    1 point
  7. Nice solution @InnI . Here is my little refactored example: #include <WinAPIGdi.au3> ; enum _PROCESS_DPI_AWARENESS Global Const $PROCESS_DPI_UNAWARE = 0 Global Const $PROCESS_SYSTEM_DPI_AWARE = 1 Global Const $PROCESS_PER_MONITOR_DPI_AWARE = 2 ; enum _MONITOR_DPI_TYPE Global Const $MDT_EFFECTIVE_DPI = 0 Global Const $MDT_ANGULAR_DPI = 1 Global Const $MDT_RAW_DPI = 2 Global Const $MDT_DEFAULT = $MDT_EFFECTIVE_DPI _WinAPI_SetProcessDpiAwareness($PROCESS_PER_MONITOR_DPI_AWARE) _Example() Func _Example() Local $aMonitors = _WinAPI_EnumDisplayMonitors() If Not IsArray($aMonitors) Then Exit MsgBox(0, "", "EnumDisplayMonitors error") Local $aDPI, $_fake For $i = 1 To $aMonitors[0][0] $aDPI = _WinAPI_GetDpiForMonitor($aMonitors[$i][0], $MDT_DEFAULT) $_fake = IsArray($aDPI) ? MsgBox(0, "Monitor #" & $i, $aDPI[0] & ":" & $aDPI[1]) : MsgBox(0, "Monitor #" & $i, "error") Next #forceref $_fake EndFunc ;==>_Example Func _WinAPI_SetProcessDpiAwareness($DPIAware) DllCall("Shcore.dll", "long", "SetProcessDpiAwareness", "int", $DPIAware) If @error Then Return SetError(1, 0, 0) EndFunc ;==>_WinAPI_SetProcessDpiAwareness Func _WinAPI_GetDpiForMonitor($hMonitor, $dpiType) Local $X, $Y Local $aRet = DllCall("Shcore.dll", "long", "GetDpiForMonitor", "long", $hMonitor, "int", $dpiType, "uint*", $X, "uint*", $Y) If @error Or Not IsArray($aRet) Then Return SetError(1, 0, 0) Local $aDPI[2] = [$aRet[3], $aRet[4]] Return $aDPI EndFunc ;==>_WinAPI_GetDpiForMonitor
    1 point
  8. #include <WinAPIGdi.au3> ; enum _PROCESS_DPI_AWARENESS Global Const $PROCESS_DPI_UNAWARE = 0 Global Const $PROCESS_SYSTEM_DPI_AWARE = 1 Global Const $PROCESS_PER_MONITOR_DPI_AWARE = 2 ; enum _MONITOR_DPI_TYPE Global Const $MDT_EFFECTIVE_DPI = 0 Global Const $MDT_ANGULAR_DPI = 1 Global Const $MDT_RAW_DPI = 2 Global Const $MDT_DEFAULT = $MDT_EFFECTIVE_DPI _WinAPI_SetProcessDpiAwareness($PROCESS_PER_MONITOR_DPI_AWARE) $aMonitors = _WinAPI_EnumDisplayMonitors() If Not IsArray($aMonitors) Then Exit MsgBox(0, "", "EnumDisplayMonitors error") For $i = 1 To $aMonitors[0][0] $aDPI = _WinAPI_GetDpiForMonitor($aMonitors[$i][0], $MDT_DEFAULT) $_ = IsArray($aDPI) ? MsgBox(0, "", $aDPI[0] & ":" & $aDPI[1]) : MsgBox(0, "", "error") Next Func _WinAPI_SetProcessDpiAwareness($DPIAware) DllCall("Shcore.dll", "long", "SetProcessDpiAwareness", "int", $DPIAware) If @error Then Return SetError(1, 0, 0) EndFunc Func _WinAPI_GetDpiForMonitor($hMonitor, $dpiType) Local $X, $Y $aRet = DllCall("Shcore.dll", "long", "GetDpiForMonitor", "long", $hMonitor, "int", $dpiType, "uint*", $X, "uint*", $Y) If @error Or Not IsArray($aRet) Then Return SetError(1, 0, 0) Local $aDPI[2] = [$aRet[3],$aRet[4]] Return $aDPI EndFunc
    1 point
×
×
  • Create New...