Jump to content

InputBox RTL Prompt Text


EKY32
 Share

Go to solution Solved by funkey,

Recommended Posts

  • Solution

#include <WinAPI.au3>
#include <Constants.au3>
#include <WindowsConstants.au3>

Opt("MustDeclareVars", 1)
Global $hHookInputBox

InputBox("Standard InputBox", "Please enter some text")
_InputBox("RTL InputBox", "Please enter some text")

Func _InputBox($title, $prompt, $default = Default, $passwordchar = Default, $width = Default, $height = Default, $left = Default, $top = Default, $timeout = Default, $hwnd = Default)
    Local $hProcInputBox = DllCallbackRegister("CbtHookProcInputBox", "int", "int;int;int")
    Local $TIDInputBox = _WinAPI_GetCurrentThreadId()
    $hHookInputBox = _WinAPI_SetWindowsHookEx($WH_CBT, DllCallbackGetPtr($hProcInputBox), 0, $TIDInputBox)
    Local $iRet = InputBox($title, $prompt, $default, $passwordchar, $width, $height, $left, $top, $timeout, $hwnd)
    Local $ierror = @error
    _WinAPI_UnhookWindowsHookEx($hHookInputBox)
    DllCallbackFree($hProcInputBox)
    Return SetError($ierror, "", $iRet)
EndFunc   ;==>_InputBox

Func CbtHookProcInputBox($nCode, $wParam, $lParam, $hHookInputBox)
    Local $RET = 0, $idText, $idInput
    If $nCode < 0 Then
        $RET = _WinAPI_CallNextHookEx($hHookInputBox, $nCode, $wParam, $lParam)
        Return $RET
    EndIf
    Switch $nCode
        Case 5 ;5=HCBT_ACTIVATE
            $idText = _WinAPI_GetDlgItem($wParam, 1002)
            $idInput = _WinAPI_GetDlgItem($wParam, 1001)
            _WinAPI_SetWindowLong($wParam, $GWL_EXSTYLE, BitOR(_WinAPI_GetWindowLong($wParam, $GWL_EXSTYLE), $WS_EX_LAYOUTRTL))
            _WinAPI_SetWindowLong($idText, $GWL_EXSTYLE, BitOR(_WinAPI_GetWindowLong($idText, $GWL_EXSTYLE), $WS_EX_LAYOUTRTL))
            _WinAPI_SetWindowLong($idInput, $GWL_EXSTYLE, BitOR(_WinAPI_GetWindowLong($idInput, $GWL_EXSTYLE), $WS_EX_LAYOUTRTL))
    EndSwitch
    Return
EndFunc   ;==>CbtHookProcInputBox

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...