how to pass ctrl+a through sendmessage?
Printable View
how to pass ctrl+a through sendmessage?
What is your reason for doing that?
i want to select all the content in a file..
Where is the file's content being shown?
Please check this http://www.vbforums.com/showthread.php?t=553578
am attempting to get the content of text from a file,,.
I tried throught menu_Click, but in that exe its not working also WM_Copy and WM_Paste too not at all working..rather not getting any error too..
now am trying the api is getwindowstextlength using windows handle id..
hai vijay, it seems you want to select all the text form a text editor in to clipboard. is it?
Quote:
Originally Posted by vijy
http://msdn.microsoft.com/en-us/libr...21(VS.85).aspxQuote:
However, GetWindowTextLength cannot retrieve the length of the text of an edit control in another application.
sorry windowsgettextQuote:
Originally Posted by Fazi
vijay,
This code will highlight the text in your text editor.
Code:Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long
Private Sub Command1_Click()
SetForegroundWindow 198574 ' find the main app window handle of your app and put it here using findwindow.
keybd_event &H11, 0, 0, 0 ' ctrl
keybd_event &H41, 0, 0, 0 ' A
keybd_event &H11, 0, KEYEVENTF_KEYUP, 0
keybd_event &H41, 0, KEYEVENTF_KEYUP, 0
End Sub
thanks fazi.. its working..
but in the case if i execute the exe using shell command , then automatically it has to select..
in a command_Click i wrote this..
the text selecting only if i click the command again,,
vb Code:
Dim sArg As String = "F:\epsfile\Equ3.eps" Shell("c:\program files\Mathtype\mathtype.exe " & sArg & "") Dim hWnd, lngresult As Long Dim sInput As String = "MathType - " & sArg & " (EPS/TIFF)" hWnd = FindWindow(vbNullString, sInput) SetForegroundWindow(hWnd) keybd_event(&H11, 0, 0, 0) ' ctrl keybd_event(&H41, 0, 0, 0) ' A keybd_event(&H11, 0, KEYEVENTF_KEYUP, 0) keybd_event(&H41, 0, KEYEVENTF_KEYUP, 0)
thanks...works me very well...looking for a whole day...