|
-
May 13th, 2011, 11:09 AM
#1
Thread Starter
Junior Member
do CTRL + V (Paste)
I have a dialog box that pops up from a webbrowser window when i invoke click.
I have copied a filepath to the clipboard but does anyone know how i can do a ctrl + v to paste the text into the dialog filename window.
I have tried sendkeys but didnt work
-
May 13th, 2011, 01:02 PM
#2
Re: do CTRL + V (Paste)
 Originally Posted by stewmath
I have a dialog box that pops up from a webbrowser window when i invoke click.
I have copied a filepath to the clipboard but does anyone know how i can do a ctrl + v to paste the text into the dialog filename window.
I have tried sendkeys but didnt work
It is not a good idea to copy text into a user's clipboard as you are overwriting their data. A better idea is to set the file path into the dialog directly. Where you are copying the file name into the clipboard copy it instead to a variable. When the dialog is ready to display place the info from the variable into the dialog.
Declare the variable
Code:
Private FilePath As String = ""
At some point set the variable then use it.
Code:
MyOpenDialog.InitialDirectory = FilePath
-
May 13th, 2011, 02:05 PM
#3
Thread Starter
Junior Member
Re: do CTRL + V (Paste)
The only problem with your suggestion is that its not actually my dialog box thats open. Its one from a website, im using the invoke click method in a webbrowser control to click a browse box in a form.
-
May 14th, 2011, 07:03 AM
#4
Re: do CTRL + V (Paste)
 Originally Posted by stewmath
The only problem with your suggestion is that its not actually my dialog box thats open. Its one from a website, im using the invoke click method in a webbrowser control to click a browse box in a form.
Seems like you will need to look at obtaining the window handle of the text box in question using VS Spy++ using either FindWindow or FindWindowEx API functions followed by SetDlgItemText API to set the text.
The following is not a solution but some code showing how to work with window handles.
http://www.vbforums.com/showpost.php...74&postcount=2
SetDlgItemText
Code:
Public Declare Function SetDlgItemText Lib "user32.dll" Alias "SetDlgItemTextA" ( _
ByVal hDlg As Integer, _
ByVal nIDDlgItem As Integer, _
ByVal lpString As String) As Integer
Public Const IDC_TEXT As Long = 1000
Code should look something like this
Code:
SetDlgItemText(hwnd, IDC_TEXT, "This is a string")
I have not done this before (set text as you want in vb.net), the code above all came from searching via Google for about five minutes.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|