Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/19/2024 in all areas

  1. Hello, Another alternative. #include <WinAPIProc.au3> #include <WinAPI.au3> #include <GUIConstants.au3> Global $hGUI = GUICreate("GUI") Global $idbtnOK = GUICtrlCreateButton("OK", 310, 370, 85, 25) GUISetState(@SW_SHOW, $hGUI) GUIRegisterMsg(_WinAPI_RegisterWindowMessage('SHELLHOOK'), 'WM_SHELLHOOK') _WinAPI_RegisterShellHookWindow($hGUI) Local $nMsg = 0 While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE ExitLoop Case $nMsg = $idbtnOK _MsgBox(0, "", "Hello I'm an AutoIt Msgbox at Default Position :-)") _MsgBox(0, "", "Hello I'm an AutoIt Msgbox at 10,10 Position :-)", 10, 10) _MsgBox(0, "", "Hello I'm an AutoIt Msgbox at " & @DesktopWidth - 300 & "," & @DesktopHeight - 300 & " Position :-)", @DesktopWidth - 300, @DesktopHeight - 300) _MsgBox(0, "", "Hello I'm an AutoIt Msgbox at 0,0 Position :-)", 0, 0) EndSelect WEnd _WinAPI_DeregisterShellHookWindow($hGUI) Exit Func _MsgBoxPostition($X = Default, $Y = Default) Local Static $aPos[] = [Default, Default] If $X = Default Or $Y = Default Then Return $aPos EndIf $aPos[0] = $X $aPos[1] = $Y EndFunc ;==>_MsgBoxPostition Func _MsgBox($iFlag, $Title, $Text, $X = Default, $Y = Default, $iTimeout = Default, $hWnd = Default) _MsgBoxPostition($X, $Y) MsgBox($iFlag, $Title, $Text, $iTimeout, $hWnd) EndFunc ;==>_MsgBox Func WM_SHELLHOOK($hWnd, $iMsg, $wParam, $lParam) #forceref $iMsg Switch $wParam Case $HSHELL_WINDOWCREATED If WinGetProcess($lParam) = @AutoItPID And _WinAPI_GetClassName($lParam) = "#32770" Then Local $aPos = _MsgBoxPostition() If $aPos[0] <> Default And $aPos[1] <> Default Then WinMove($lParam, "", $aPos[0], $aPos[1]) EndIf EndIf EndSwitch EndFunc ;==>WM_SHELLHOOK Saludos
    1 point
  2. Another way : #include <Constants.au3> #include <WinAPISysWin.au3> Global $sTitle, $iPosX, $iPosY Local $iRet = MsgBoxEx($MB_OKCANCEL, "Test", "Text here", 200, 60) ConsoleWrite("Test response " & $iRet & @CRLF) $iRet = MsgBoxEx($MB_YESNO, "New Test", "New text here", 300, 0) ConsoleWrite("New Test response " & $iRet & @CRLF) Func MsgBoxEx($iFlag, $sWin, $sText, $iX, $iY) Local $hTimerProc = DllCallbackRegister(TimerProc, 'none', 'hwnd;uint;uint_ptr;dword') Local $iTimerID = _WinAPI_SetTimer(0, 0, 10, DllCallbackGetPtr($hTimerProc)) $sTitle = $sWin $iPosX = $iX $iPosY = $iY Local $iResp = MsgBox($iFlag, $sWin, $sText) DllCallbackFree($hTimerProc) Return $iResp EndFunc ;==>MsgBoxEx Func TimerProc($hWnd, $iMsg, $iTimerID, $iTime) If WinActive($sTitle) Then _WinAPI_KillTimer(0, $iTimerID) WinMove($sTitle, "", $iPosX, $iPosY) EndIf EndFunc ;==>_TimerProc
    1 point
  3. Nine

    "Windows Security Warning"

    Seems OP is entering PS C:\temp> on each command
    1 point
  4. #include <GUIConstants.au3> #include <GuiListView.au3> Local $array[10] $Form1 = GUICreate("AForm1", 370, 270, 193, 115) $ListView = GUICtrlCreateListView("First Column|Second Column|Third Column", 10, 10, 350, 250) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_LV_ALTERNATE) For $i = 1 to Ubound($array) -1 $array[$i] = GUICtrlCreateListViewItem("stuff|stuff|stuff", $ListView) GUICtrlSetBkColor(-1,0xFF00FF) Next GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Incidently if you try using it with this method to create the listview entries _GUICtrlListViewInsertItem($ListView,-1,"stuff|stuff|stuff") it doesn't work. Using the first method I think your limited to 4000 rows
    1 point
  5. GaryFrost

    Window Transparency

    modded to fix visibility back to 100% upon exit of the app. #include <GUIConstants.au3> If (Not IsDeclared('CB_GETCOUNT')) Then Global Const $CB_GETCOUNT = 0x146 If (Not IsDeclared('CB_SETCURSEL')) Then Global Const $CB_SETCURSEL = 0x14E $perc = "100%" $winName = "" GUICreate("iWindow", 220, 135, 0, 0, -1, $WS_EX_TOPMOST) $repop = GUICtrlCreateButton("Repopulate List", 10, 10, 200, 20) $winLabel = GUICtrlCreateLabel("Window:", 10, 40) $win = GUICtrlCreateCombo("Select a Window Title", 10, 55, 200, 100) $transLabel = GUICtrlCreateLabel("Visibility:", 10, 90) $trans = GUICtrlCreateCombo("Select Visibility", 10, 105, 200, 100) GUICtrlSetData(-1, "0%|5%|10%|15%|20%|25%|30%|35%|40%|45%|50%|55%|60%|65%|70%|75%|80%|85%|90%|95%|100%") repopList() GUISetState() Func repopList() GUICtrlSetData($win, "|") $winList = WinList() For $i = 1 To $winList[0][0] If $winList[$i][0] <> "" And $winList[$i][0] <> "Program Manager" And BitAND(WinGetState($winList[$i][0]), 2) Then GUICtrlSetData($win, $winList[$i][0]) EndIf Next GUICtrlSetData($win, "Select a Window Title", "Select a Window Title") EndFunc ;==>repopList Func setTrans() $perc = StringTrimRight($perc, 1) $transNum = $perc * 2.55 WinSetTrans($winName, "", $transNum) EndFunc ;==>setTrans Do $msg = GUIGetMsg() Select Case $msg = $repop GUICtrlSetData($trans, "Select Visibility") repopList() Case $msg = $trans $winName = GUICtrlRead($win) $perc = GUICtrlRead($trans) If $winName <> "Select a Window Title" Then setTrans() EndIf Case $msg = $GUI_EVENT_CLOSE GUISetState(@SW_HIDE) ResetVisibility() EndSelect Until $msg = $GUI_EVENT_CLOSE Func ResetVisibility() For $i = 0 To _GUICtrlComboBoxGetCount($win) - 1 $perc = "100%" _GUICtrlComboBoxSetCurSel($win, $i) $winName = GUICtrlRead($win) setTrans() Next EndFunc ;==>ResetVisibility ;=============================================================================== ; ; Description: _GUICtrlComboBoxGetCount ; Parameter(s): $h_combobox - controlID ; Requirement: None ; Return Value(s): The return value is the number of items in the list box. ; If an error occurs, it is CB_ERR ; User CallTip: _GUICtrlComboBoxGetCount($h_combobox) Retrieve the number of items in the list box of a combo box (required: <ComboBox.au3>) ; Author(s): Gary Frost (custompcs@charter.net) ; Note(s): The index is zero-based, so the returned count is one greater ; than the index value of the last item. ; ;=============================================================================== Func _GUICtrlComboBoxGetCount($h_combobox) Return GUICtrlSendMsg($h_combobox, $CB_GETCOUNT, 0, 0) EndFunc ;==>_GUICtrlComboBoxGetCount ;=============================================================================== ; ; Description: _GUICtrlComboBoxSetCurSel ; Parameter(s): $h_combobox - controlID ; $i_index - Specifies the zero-based index of the string to select ; Requirement: None ; Return Value(s): If the message is successful, the return value is the index of the item selected. ; If $i_index is greater than the number of items in the list or if $i_index is 1, ; the return value is CB_ERR and the selection is cleared ; User CallTip: _GUICtrlComboBoxSetCurSel($h_combobox,$i_index) Select a string in the list of a combo box (required: <ComboBox.au3>) ; Author(s): Gary Frost (custompcs@charter.net) ; Note(s): If this $i_index is 1, any current selection in the list is removed and the edit control is cleared ; ;=============================================================================== Func _GUICtrlComboBoxSetCurSel($h_combobox, $i_index) Return GUICtrlSendMsg($h_combobox, $CB_SETCURSEL, $i_index, 0) EndFunc ;==>_GUICtrlComboBoxSetCurSel
    1 point
×
×
  • Create New...