Jump to content

InputBox RTL Prompt Text


Go to solution Solved by funkey,

Recommended Posts

Posted

Hello, is it possible to get the prompt text direction RTL in the InputBox?

Thank you.

[font="'trebuchet ms', helvetica, sans-serif;"]Please mark the answer of your question if you found it.[/font]

Posted

Hello, sorry UEZ, I mean the Input Box not the input control.

InputBox("Question", "This text should be RTL", "Planet Earth")

[font="'trebuchet ms', helvetica, sans-serif;"]Please mark the answer of your question if you found it.[/font]

  • Solution
Posted

#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.

Posted

You are amazing people!

[font="'trebuchet ms', helvetica, sans-serif;"]Please mark the answer of your question if you found it.[/font]

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
  • Recently Browsing   0 members

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