لدي سؤالين متشابهين أرجو الأجابة عنها في أسرع وقت ممكن........(فجول بيسك)
س1:كيف يمنك الضغط على زر Alt برمجياً (بدون أستخدام لوحة المفاتيح)؟ وهل الأمر sendkeys صالح لذلك أم لا؟وإذا كان صالح فما طريقة أستخدامه؟وإذا لم يكن صالح فما البديل؟
--------------------------------------------------------------------
س2:نفس السؤال السابق ولكن بانسبة إلى Alt+Space في آن واحد
@...Khalefa
03-20-2007, 07:48 AM
طريقة متميزة لتوضيح استخدام SendKey (منقولة من مكتبة الكود)على محرر النصوص
هاتحتاج الى اربعة CommandButton و textbox
Option Explicit
'HERE IS A LIST OF KEYS
'Backspace {BS}
'Break {BREAK}
'Caps Lock {CAPSLOCK}
'DELETE {DEL}
'Down Arrow {DOWN}
'END {END}
'ENTER {ENTER} or ~
'Escape {ESC}
'Help {HELP}
'Home {HOME}
'Insert {INS}
'Left Arrow {LEFT}
'Num Lock {NUMLOCK}
'Page Down {PGDN}
'Page Up {PGUP}
'Print Screen {PRTSC}
'Right Arrow {RIGHT}
'Scroll Lock {SCROLLLOCK}
'Tab {TAB}
'Up arrow {UP}
'F1 - F16 {F1} - {F16}
'Shift +
'Ctrl ^
'Alt %
Private Sub Command1_Click()
'This is to tab from button to button or space in notepad
AppActivate "Untitled - Notepad" 'You would use any programs top handle for example, the handle for
SendKeys "{TAB}" 'calc.exe is Calculator
End Sub
Private Sub Command2_Click()
'This is to drop down a line in notepad or to activate a button on a program
AppActivate "Untitled - Notepad" 'You would use any programs top handle for example, the handle for
SendKeys "{ENTER}" & "Mohammed Khalefa" 'calc.exe is Calculator
End Sub
Private Sub Command3_Click()
'This is to close that program
AppActivate "Untitled - Notepad" 'You would use any programs top handle for example, the handle for
SendKeys "%{F4}" 'Sometimes it will ask if you are sure you want to close
'if it did you would enter.
'appactivate "Untitled - Notepad"
'SendKeys "%{F4}"
'Appactivate "Untitled - Notepad"
'Sendkeys "%{Y}"
End Sub
Private Sub Command4_Click()
'Sends what you typed into notepad
Dim strPart As String
strPart$ = Me.Text1.Text$
If Trim(strPart$) <> "" Then 'Checks text1.text for any words
Else
MsgBox "You did not enter anything.", vbCritical, "Error"
Me.Text1.SetFocus
End If
Do Until strPart$ = "" 'Loops until strPart$ is blank
AppActivate "Untitled - Notepad"
SendKeys Left(strPart$, 1)
strPart$ = Right(strPart$, Len(strPart$) - 1)
DoEvents
Loop
End Sub
Private Sub Form_Load()
Shell "notepad.exe", vbNormalFocus 'Moves your form down and right to move out of the way
'of notepad
Me.Top = Screen.Height - Me.Height
Me.Left = Screen.Width - Me.Width
End Sub
vbKey0 to vbKeyZ
الف شكر........................