PDA

View Full Version : مشکل در فارسی و انگلیسی شدن برنامه



martoor
جمعه 24 اردیبهشت 1389, 10:54 صبح
با سلام و خسته نباشید خدمت تمامی دوستان .
من برنامه ای در vb نوشتم و کد های زیر رو در Form_Load اون قرار دادم و همچنین حاشیه ی فرم رو برداشتم تا برنامه حالت تمام صفحه بگیره :


me.width = screen.width
me.height = screen.height


در این حالت حتی TaskBar هم نمایش داده نمی شود .
حال با مشکلی برخوردم و آن این است که وقتی در برنامه زبان صفحه کلید را تغییر می دهیم ، تغییر زبان در Language Bar واقع در TaskBar نمایش داده نمی شود . و این مسئله کاربر بنده را با مشکل روبرو کرده .

خواهشمندم مشکل بنده را بررسی کنید .

حمید محمودی
جمعه 24 اردیبهشت 1389, 12:21 عصر
میتونید با api زبان جاری صفحه کلید رو توی برنامه شبیه سازی کنید. بعد هم اگه کاربر مایل بود همون جا تغییرش بده. نمونه اش تو سایت هست

martoor
جمعه 24 اردیبهشت 1389, 12:30 عصر
خوب برنامه چجوری کلید ALT+SHIFT برای تغییر زبان رو تشخیص بده ؟
اگه می شه با لینک یا کد توضیح بدید .
ممنون

حمید محمودی
جمعه 24 اردیبهشت 1389, 14:38 عصر
اینم یه نمونه :
با form_load زبان به فارسی و با form_unload زبان به انگلیسی تغییر میکنه





'parameters for api's
Const KL_NAMELENGTH As Long = 9 'length of the keyboardbuffer
Const KLF_ACTIVATE As Long = &H1 'activate the layout

'the language constants
Const LANG_NL_STD As String = "00000413"
Const LANG_EN_US As String = "00000409"
Const LANG_DU_STD As String = "00000407"
Const LANG_FR_STD As String = "0000040C"
Const LANG_farsi As String = "00000429"

'api's to adjust the keyboardlayout
Private Declare Function GetKeyboardLayoutName Lib "user32" Alias "GetKeyboardLayoutNameA" (ByVal pwszKLID As String) As Long
Private Declare Function LoadKeyboardLayout Lib "user32" Alias "LoadKeyboardLayoutA" (ByVal pwszKLID As String, ByVal flags As Long) As Long
Public Function SetKbLayout(strLocaleId As String) As Boolean
'Changes the KeyboardLayout
'Returns TRUE when the KeyboardLayout was adjusted properly, FALSE otherwise
'If the KeyboardLayout isn't installed, this function will install it for you
On Error Resume Next
Dim strLocId As String 'used to retrieve current KeyboardLayout
Dim strMsg As String 'used as buffer
Dim lngErrNr As Long 'receives the API-error number

'create a buffer
strLocId = String(KL_NAMELENGTH, 0)
'retrieve the current KeyboardLayout
GetKeyboardLayoutName strLocId
'Check whether the current KeyboardLayout and the
'new one are the same
If strLocId = (strLocaleId & Chr(0)) Then
'If they're the same, we return immediately
SetKbLayout = True
Else
'create buffer
strLocId = String(KL_NAMELENGTH, 0)
'load and activate the layout for the current thread
strLocId = LoadKeyboardLayout((strLocaleId & Chr(0)), KLF_ACTIVATE)
If IsNull(strLocId) Then 'returns NULL when it fails
SetKbLayout = False
Else 'check again
'create buffer
strLocId = String(KL_NAMELENGTH, 0)
'retrieve the current layout
GetKeyboardLayoutName strLocId
If strLocId = (strLocaleId & Chr(0)) Then
SetKbLayout = True
Else
SetKbLayout = False
End If
End If
End If
End Function
Private Sub Form_Load()
'change the current keybour layout to 'English - US'
SetKbLayout LANG_farsi
End Sub

Private Sub Form_Unload(Cancel As Integer)
SetKbLayout LANG_EN_US
End Sub