Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/22/2024 in all areas

  1. jpm

    Struct Notation

    Hi, already fix for next beta/release
    2 points
  2. Thank you very much, the TrayTip function was what I was looking for. Very thankful!!
    1 point
  3. I'm not sure what are you talking about. Selection has nothing to do with undo, as you can see below: #include <GUIConstantsEx.au3> #include <GuiRichEdit.au3> #include <WindowsConstants.au3> Local $hGui = GUICreate("RichEdit Get/Set Text (v" & @AutoItVersion & ")", 340, 350) Local $hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 320, 220, BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL)) GUISetState(@SW_SHOW) Sleep(5000) _GUICtrlRichEdit_SetText2($hRichEdit, "This is Set text.", True) Sleep(5000) _GUICtrlRichEdit_Undo($hRichEdit) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE _GUICtrlRichEdit_Destroy($hRichEdit) Func _GUICtrlRichEdit_SetText2($hWnd, $sText, $bCanUndo = False) If Not _WinAPI_IsClassName($hWnd, $__g_sRTFClassName) Then Return SetError(101, 0, False) Local $tSetText = DllStructCreate($tagSETTEXTEX) DllStructSetData($tSetText, 1, ($bCanUndo ? $ST_KEEPUNDO : $ST_DEFAULT)) DllStructSetData($tSetText, 2, $CP_ACP) Local $iRet If StringLeft($sText, 5) <> "{\rtf" And StringLeft($sText, 5) <> "{urtf" Then DllStructSetData($tSetText, 2, $CP_UNICODE) $iRet = _SendMessage($hWnd, $EM_SETTEXTEX, $tSetText, $sText, 0, "struct*", "wstr") Else $iRet = _SendMessage($hWnd, $EM_SETTEXTEX, $tSetText, $sText, 0, "struct*", "STR") EndIf If Not $iRet Then Return SetError(700, 0, False) Return True EndFunc
    1 point
  4. Thanks ioa747 ! That worked fine. It helped when I added the /console switch; which I don't recall using before.
    1 point
  5. What is the value of @error and @extended after calling _AD_GetObjectsInOu when searching for GUID? Looks like you need to enter the GUID in a special format as described here.
    1 point
  6. I know this is an old post but I figured it out after @orbs requested I look at this from another topic. Initially I couldn't figure it out either. I thought the $WS_HSCROLL was word wrap, and it very well may be for a regular edit control, but for richedit there is an actual word wrap option. using EM_SETTARGETDEVICE you can enable/disable word wrap #include <GuiRichEdit.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <Constants.au3> #include <WinAPI.au3> ; build GUI Global Const $nGUI_MaxW = 500, $nGUI_MaxH = 100 Global $nGUI_W = 720, $nGUI_H = 500, $nRichEditOffset = 10, $nRichEditOffsetTop = 30 Global $nToolbarHeight = $nRichEditOffsetTop Global $hGui = GUICreate('RichEdit wrap/unwrap test', $nGUI_W, $nGUI_H, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_SYSMENU)) GUISetBkColor(0xCCDDEE) ; - toolbar ; ** requires an extra lower contour if main rich edit is not docked to edges Global $gToolbarBackground = GUICtrlCreateLabel('', 0, 0, $nGUI_W, $nToolbarHeight) GUICtrlSetResizing(-1, BitOR($GUI_DOCKTOP, $GUI_DOCKLEFT, $GUI_DOCKRIGHT, $GUI_DOCKHEIGHT)) GUICtrlSetBkColor(-1, 0xFFFFFF) GUICtrlSetState(-1, $GUI_DISABLE) Global $gToolbarBackgroundContour = GUICtrlCreateLabel('', 0, $nToolbarHeight+1, $nGUI_W, 1) GUICtrlSetResizing(-1, BitOR($GUI_DOCKTOP, $GUI_DOCKLEFT, $GUI_DOCKRIGHT, $GUI_DOCKHEIGHT)) GUICtrlSetBkColor(-1, 0) GUICtrlSetState(-1, $GUI_DISABLE) ; -- wrap/unwrap Global $bWrap = False Global $gWrap = GUICtrlCreateCheckbox('Wrap', 3, 3, 48, 24, $BS_PUSHLIKE) GUICtrlSetResizing(-1, BitOR($GUI_DOCKTOP, $GUI_DOCKLEFT, $GUI_DOCKSIZE)) ; - main Global $hRichEdit = _GUICtrlRichEdit_Create($hGui, 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz', $nRichEditOffset, $nRichEditOffset + $nRichEditOffsetTop, $nGUI_W - $nRichEditOffset * 2, $nGUI_H - $nRichEditOffset * 2 - $nRichEditOffsetTop - 24, BitOR($ES_MULTILINE, $WS_HSCROLL, $WS_VSCROLL)) _GUICtrlRichEdit_SetSel($hRichEdit, 0, -1, True) _GUICtrlRichEdit_SetFont($hRichEdit, Default, 'Courier New') GUISetState() GUIRegisterMsg($WM_GETMINMAXINFO, "_WM_GETMINMAXINFO") GUIRegisterMsg($WM_SIZE, "_WM_SIZE") ; work with GUI Global $iMsg = 0 While True $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE _GUICtrlRichEdit_Destroy($hRichEdit) Exit Case $gWrap $bWrap = Not $bWrap ConsoleWrite(_GUICtrlRichEdit_WordWrap($hRichEdit, $bWrap) & @LF) EndSwitch WEnd Func _GUICtrlRichEdit_WordWrap($hWnd, $bEnable = True) If (IsHWnd($hWnd) = False) Then Return SetError(1, 0, False) DllCall("user32.dll", "lresult", "SendMessageW", "hwnd", $hWnd, "uint", $EM_SETTARGETDEVICE, "wparam", 0, "lparam", Not $bEnable) If (@Error) Then Return SetError(2, @extended, False) Return True EndFunc This topic gave me the answer.
    1 point
  7. trancexx

    Register a dll

    If you want to do that the way it should be done considering the language it would be: #RequireAdmin ; Unregister If _UnregisterServer("zipfldr.dll") Then MsgBox(64, "zipfldr.dll OK", "DllUnregisterServer succeeded!") Else If @error = 1 Then MsgBox(48, "zipfldr.dll Error", "DllUnregisterServer failed with error code 0x" & Hex(@extended)) Else MsgBox(48, "zipfldr.dll Error", "zipfldr.dll missing maybe?") EndIf EndIf ; Register If _RegisterServer("zipfldr.dll") Then MsgBox(64, "zipfldr.dll OK", "DllRegisterServer succeeded!") Else If @error = 1 Then MsgBox(48, "zipfldr.dll Error", "DllRegisterServer failed with error code 0x" & Hex(@extended)) Else MsgBox(48, "zipfldr.dll Error", "zipfldr.dll missing maybe?") EndIf EndIf ; Functions... Func _RegisterServer($sDll) Local $fInit, $fError Local $aCall = DllCall("ole32.dll", "long", "OleInitialize", "ptr", 0) If Not @error Then $fInit = $aCall[0] <> 1 ; The COM library is already initialized $aCall = DllCall($sDll, "long", "DllRegisterServer") If @error Then $fError = True If $fInit Then DllCall("ole32.dll", "none", "OleUninitialize") If $fError Then Return SetError(2, 0, False) Return SetError($aCall[0] <> 0, $aCall[0], $aCall[0] = 0) EndFunc Func _UnregisterServer($sDll) Local $fInit, $fError Local $aCall = DllCall("ole32.dll", "long", "OleInitialize", "ptr", 0) If Not @error Then $fInit = $aCall[0] <> 1 ; The COM library is already initialized $aCall = DllCall($sDll, "long", "DllUnregisterServer") If @error Then $fError = True If $fInit Then DllCall("ole32.dll", "none", "OleUninitialize") If $fError Then Return SetError(2, 0, False) Return SetError($aCall[0] <> 0, $aCall[0], $aCall[0] = 0) EndFunc
    1 point
  8. microbious

    If exist

    best example ever RegRead ("HKEY_CURRENT_USER\test", "") if @error = -1 Then MsgBox (0,"","yes it does") ElseIf @Error = 1 Then MsgBox (0,"","no it doesnt") EndIf
    1 point
×
×
  • Create New...