How do I call Win32 API functions SetClipBoardViewer, ChangeClipboardChain, etc, from C++ .NET app ?

Tech-Archive recommends: Fix windows errors by optimizing your registry





Hi,

I am a "hobby" programmer with a lot of familiarity with pre-.NET C++
programming in Windows, but not too much with .NET. I've written a
Form based Windows application and want to set it up so that the app
monitors changes to clipboard data. Therefore, I need to call the
Win32 functions SetClipBoardViewer, etc. (Or is there another way to
do this in .NET that I haven't found)?

As far as I can tell, I need to use the P/Invoke mechanism with
declarations something like:

[DllImport("User32")]
static int SetClipboardViewer(int hWndNewViewer);

(I would think these should be HWND's, but the above is what I found.)

My problem is that I don't know the correct declarations for these
functions, and I don't know how to set up the calls to them. I found
an example for C# that shows how to do the whole process of setting up
a clipboard monitoring application, but I really want to learn how to
do this in C++.

Any help would be appreciated!
Thanks,
Tom
.


Quantcast