Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Ctrl+ right and left Shift simulating
Message
From
03/01/2009 08:30:01
Reza Meamar
Homa Programming Group
Shiraz, Iran
 
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01370599
Message ID:
01370819
Views:
54
Hi ali,
No, your code is for making object RigthToLeft.
I want to make two command button such as right-to-left and left-to-right that exist in MS-WORD.
I want to make a paragraph rtl or ltr.
I know that it can do with SendMessage, but i have not hex code for Ctrl+ right Shift and Ctrl+ left Shift.
I see some code in VB, but i dont know VB !

here is VB code:
'//Code\\
'This code requires nothing, place it in a module.
Option Explicit
Public Const WM_USER = &H400
Public Const EM_SETPARAFORMAT = WM_USER + 71
Public Const EM_SETBIDIOPTIONS = WM_USER + 200
Public Const PFM_DIR = &H10000 'Direction mask bit
Public Const PFE_RTLPAR = &H1 'RTL paragraph style bit
Public Const BOM_DEFPARADIR = &H1 'Default direction mask
Public Const BOE_RTLDIR = &H1 'Default RTL para style
Type vbParaFormat
    cbSize As Long
    dwMask As Long
    wNumbering As Integer
    wEffects As Integer
    dxStrtIndent As Long
    dxRightIndent As Long
    dxOffset As Long
    wAlignment As Integer
    cTabCount As Integer
    rgxTabs(31) As Long
End Type
Public vbPF As vbParaFormat
Public Declare Function SendPFMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As vbParaFormat) As Long
Type vbBiDiOptions
    cbSize As Long
    wMask As Integer
    wEffects As Integer
End Type
Public vbBO As vbBiDiOptions
Public Declare Function SendBOMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As vbBiDiOptions) As Long

Public Function SetParaDirection(Direction As Integer) As Boolean
vbPF.cbSize = LenB(vbPF) 'Size
vbPF.dwMask = PFM_DIR 'Attribute to set
vbPF.wEffects = Direction 'New direction
SetParaDirection = SendPFMessage(Form1.RichTextBox1.hWnd, EM_SETPARAFORMAT, 0, vbPF)
End Function
'\\Code//

'//Code\\
'This code requires a rich text box control. Buttons named btnLTR and btnRTL are supported but not necassarily needed
Option Explicit
Private Sub btnLTR_Click()
SetParaDirection (Not PFE_RTLPAR)
RichTextBox1.SetFocus
End Sub
Private Sub btnRTL_Click()
SetParaDirection (PFE_RTLPAR)
RichTextBox1.SetFocus
End Sub

Private Sub Form_Load()
Dim Result As Long
SetParaDirection (PFE_RTLPAR)
vbBO.cbSize = LenB(vbBO) 'Size
vbBO.wMask = BOM_DEFPARADIR 'Attribute to set
vbBO.wEffects = BOE_RTLDIR 'Default direction
Result = SendBOMessage(RichTextBox1.hWnd, EM_SETBIDIOPTIONS, 0, vbBO)
RichTextBox1.RightMargin = 2000
End Sub
'\\Code//
>Hi Reza
>try this in init :
>
>
>#Define GWL_EXSTYLE -20
>#Define WS_EX_LAYOUTRTL 0x400000
>#Define WS_EX_NOINHERITLAYOUT 0x100000
>Declare Integer GetWindowLong In user32	INTEGER HWnd, Integer nIndex
>Declare Integer SetWindowLong In user32	INTEGER HWnd, Integer nIndex, Integer dwNewLong
>OldLong = GetWindowLong(Thisform.HWnd, GWL_EXSTYLE)
>SetWindowLong(This.HWnd,GWL_EXSTYLE,Bitor(OldLong,WS_EX_LAYOUTRTL,WS_EX_NOINHERITLAYOUT))
>
>
>>Dear all,
>>How to change writing direction to right-to-left programmatically in RichTextBox?
>>Manually if I press Ctrl+ right Shift ,the direction will be changed but how to automate it?
>>I think i must to use from SendMessage as below, but i have not key code for Ctrl+ right Shift and Ctrl + left Shift.
>>
>>#DEFINE WM_USER 0x400
>>#DEFINE WM_COPY 0x301
>>#DEFINE WM_CUT 0x300
>>#DEFINE WM_PASTE 0x302
>>#DEFINE WM_UNDO 0xc6
>>#DEFINE WM_REDO (WM_USER+85)
>>
>>DECLARE SendMessage IN user32 ;
>>INTEGER hWnd,;
>>INTEGER wMsg,;
>>INTEGER wParam,;
>>INTEGER lParam
>>
>>SendMessage(THISFORM.oleRtf2.OBJECT.Hwnd,WM_PASTE,0,0)
>>
>>best regards
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform