By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,125 Members | 1,570 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,125 IT Pros & Developers. It's quick & easy.

How to use StructToPtr with SendMessage?

P: n/a


In my C# library I have many SendMessages like the following:

[DllImport("user32.dll", EntryPoint="SendMessage",CharSet=CharSet.Auto )]

public static extern int SendMessage(IntPtr hwnd, int wMsg, int wParam, ref
PARAFORMAT2 pf2);

I use this one like this:

Dim lSelectedParagraph As PARAFORMAT2

Rtf.SendMessage(gctlText.TxtHandle, Rtf.EM_GETPARAFORMAT, 0,
lSelectedParagraph)

So that I do not need to define a SendMesage for each usage, I think I could
define:

[DllImport("user32.dll", CharSet=CharSet.Auto, SetLastError=true)]public
static extern int SendMessage(

IntPtr hWnd, [MarshalAs(UnmanagedType.U4)] int Msg,IntPtr wParam, IntPtr
lParam);

Could someone show me how to write the VB SendMessage call that will use
this SendMessage??

I think if I have one example I can figure out how to do the others,

Thanks in advance

Thanks
Nov 20 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.