Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
Insert Picture w/o Clearing Clipboard
Author:
Hunter Perrin
E-mail:
Click to e-mail author
Website:
http://www.hpshareware.com
Submitted:
6/26/2004
Version:
VB6
Compatibility:
VB6
Category:
Graphics
Views:
12353
I saw another snippet like this but it cleared the clipboard when it ran. Thats not very nice to the user. This snippet saves the contents then returns them to the clipboard.
Declarations:
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long Public Const WM_PASTE = &H302 Public Const WM_COPY = &H301
Code:
Public Function InsertPic() On Error Resume Next Dim strSaveClipboard As String Dim Pic As String Pic = "(Filename of Picture)" If Clipboard.GetFormat(vbCFText) = True Then strSaveClipboard = Clipboard.GetText Saved = True End If Clipboard.Clear Clipboard.SetData LoadPicture(Pic) SendMessage rtfText.hwnd, WM_PASTE, 0, vbNullString If Saved = True Then Clipboard.Clear Clipboard.SetText strSaveClipboard Else Clipboard.Clear End If End Function
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement