Ok..I have so many dumb questions that keep popping up..I think I will just ask them all here rather then start a new thread each time.....
1. How do I copy txtCode.Text to the system clipboard?
2. How do I pass like subject, etc. arguments to a mail program? I am calling mailto:[email protected] via a shell to launch the default mail program..how do I pass the arguments too?
'paste into a textbox
Text1 = Clipboard.Gettext
'get text from a textbox
Clipboard.Settext Text1.text
'copy a variable content to clipboard
Clipboard.Settext MyVar
'clear the clipboard
Clipboard.Clear
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
when I do that the text can be pasted somewhere else in the program but let's say I open Notepad and whatever was on the system CLipboard get pasted.....
It's almost as though it is using it's own clipboard......
I can use ctrl + c and ctrl + v to do it but i want them to be able to click a command and have it copy to the system clipboard so it can pasted somewhere else...
The code I and HeSaidJoe gave should copy to the system clipboard and be available to any program that accepts text pasting. After you have copied the text, go to Start->Programs->Accessories->System Tools->Clipboard Viewer and make sure it appears in there.
Don't forget there is a bug(??) in VB that clears the clipboard whenever you open it. Maybe that is your problem.
Last edited by chrisjk; Apr 21st, 2001 at 11:13 AM.
Of course when you open Notepad you must paste the clipboard using edit paste or shortcuts but this copies
the text from Text1 and paste it when using edit paste.
Code:
Private Sub Command1_Click()
'clear the clipboard
Clipboard.Clear
'get text from a textbox
Clipboard.SetText Text1.Text
End Sub
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
OK I figured #1 out.. as long as I cleared the clipboard before I put anything on it, it works fine...thankyou
#2 basically have you ever seen the hyperlinks were you click on them and they open up with your default mail program and the address and subject are filled in?
well mailto:[email protected] does the address somehow you can include the subject etc.. in that link too.. don't rememvber how tho...
I know this works with oe, outlook when using shell execute. Not sure about the rest. Also I wasn't able to get more than one tag working at a time (couldn't combine them) . MS says you need to use a, I think it was "|" to seperate the tags, not sure, can't remember !
would work fine. I don't know about the ShellExecute API, however...I think that's only supposed to run local programs. It's better to use the Scriptlet control, which is located in MSHTML.DLL <MS Internet Objects>.
I have an image file in my app...just used the image control....well I tried it (the exe) on anouther machine and surprise, surprise it didn't show up! so..
Where does it look for the image file? (is it just the current running directory?)
And is there a way to incorporate the pic into the exe?
launch the url "mailto:[email protected]?subject=yoursubject&body=body" with in the program ?
Here is the code to launch the default mail program..
' Browser call routine
#If Win32 Then
Private Declare Function ShellExecute Lib _
"shell32.dll" Alias "ShellExecuteA" _
(ByVal hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
#Else
Private Declare Function ShellExecute Lib "shell.dll" (ByVal hwnd As Integer, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Integer) As Integer
#End If
Private Const SW_SHOWNORMAL = 1
Private Sub Link1_Click()
Dim iret As Long
iret = ShellExecute(Me.hwnd, vbNullString, "mailto:[email protected]?subject=yoursubject&body=body", vbNullString, "c:\", SW_SHOWNORMAL)
End Sub
See form below ....
It is the mark of an instructed mind to rest satisfied with the degree of precision which the nature of the subject admits, and not to seek exactness when only an approximation of the truth is possible.
-Aristotle As quoted in Rapid Development, chapter 8, page 167.