|
-
Oct 31st, 2003, 03:25 AM
#1
is it possible to know when clipboard changes?
with .NET or with APIs?
any way to raise an event when the data in clipboard is changed?
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Oct 31st, 2003, 04:56 AM
#2
Doesn't the clipboard chain component do this?
If not you could coinvert this VB6 code which uses APIs...
-
Oct 31st, 2003, 09:31 AM
#3
if you want a basic example to start with, i knocked this up for you, it notifies you when the clipboard receives a change, you can add stuff like if it receives copy etc... as you like
VB Code:
[Color=Blue]Private[/COLOR] [Color=Blue]Declare[/COLOR] [Color=Blue]Function[/COLOR] SetClipboardViewer [Color=Blue]Lib[/COLOR] "user32" ([Color=Blue]ByVal[/COLOR] hwnd [Color=Blue]As[/COLOR] IntPtr) [Color=Blue]As[/COLOR] [Color=Blue]Integer
[/COLOR] [Color=Blue]Private[/COLOR] [Color=Blue]Const[/COLOR] WM_DRAWCLIPBOARD = &H308
[Color=Blue]Private[/COLOR] IsSubClassed [Color=Blue]As[/COLOR] [Color=Blue]Boolean[/COLOR] = [Color=Blue]False
[/COLOR] [Color=Blue]Private[/COLOR] [Color=Blue]Sub[/COLOR] Form1_Load([Color=Blue]ByVal[/COLOR] sender [Color=Blue]As[/COLOR] System.Object, [Color=Blue]ByVal[/COLOR] e [Color=Blue]As[/COLOR] System.EventArgs) [Color=Blue]Handles[/COLOR] [Color=Blue]MyBase[/COLOR].Load
SetClipboardViewer([Color=Blue]Me[/COLOR].Handle)
IsSubClassed = [Color=Blue]True
[/COLOR] [Color=Blue]End[/COLOR] [Color=Blue]Sub
[/COLOR] [Color=Blue]Protected[/COLOR] [Color=Blue]Overrides[/COLOR] [Color=Blue]Sub[/COLOR] WndProc([Color=Blue]ByRef[/COLOR] m [Color=Blue]As[/COLOR] System.Windows.Forms.Message)
[Color=Blue]If[/COLOR] IsSubClassed [Color=Blue]Then
[/COLOR] [Color=Blue]If[/COLOR] m.Msg = WM_DRAWCLIPBOARD [Color=Blue]Then
[/COLOR] MessageBox.Show("ClipBoard has been modified!")
[Color=Blue]End[/COLOR] [Color=Blue]If
[/COLOR] [Color=Blue]End[/COLOR] [Color=Blue]If
[/COLOR] [Color=Blue]MyBase[/COLOR].WndProc(m)
[Color=Blue]End[/COLOR] [Color=Blue]Sub[/COLOR]
~
if a post is resolved, please mark it as [Resolved]
protected string get_Signature(){return Censored;}
[vbcode][php] please use code tags when posting any code [/php][/vbcode]
-
Oct 31st, 2003, 05:17 PM
#4
aha, thanks to both of you...
just wondering though, doesnt this slow the program down a lot? cuz each time WndProc is fired it has to check if it was from the clipboard or not... and I guess WndProc is fired a billion times when you run your app
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
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
|