Hi
Usually win32 API has two versions. ansi version or unicode version.
e.g.
SendMessageA is Ansi version
SendMessageW is unicode version.
Because the declare in the google link has define the entrypoint as
SendMessageA, that means to use the ansi version.
For detailed information you may try to take a look at the
DllImportAttribute Class and the DllImportAttribute.CharSet Field
DllImportAttribute.ExactSpelling Field.
Specifying a Character Set
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/htm
l/cpconcharsetobjectfield.asp
[DllImport("user32.dll")]
public static extern int MessageBoxA(int hWnd, String text,
String caption, uint type);
[DllImport("user32.dll", CharSet=CharSet.Unicode)]
public static extern int MessageBoxW(int hWnd, String text,
String caption, uint type);
[DllImport("user32.dll", CharSet=CharSet.Auto)]
public static extern int MessageBox(int hWnd, String text,
String caption, uint type);
The example above will tell you what is the default conversion when using
CharSet.
Charset.Auto
Automatically marshal strings appropriately for the target operating
system. The default is Unicode on Windows NT, Windows 2000, Windows XP, and
the Windows Server 2003 family; the default is Ansi on Windows 98 and
Windows Me.
[DllImport("user32.dll",CharSet=CharSet.Auto)]
private static extern int SendMessage(IntPtr _WindowHandler, int
_WM_USER, int wParam, [Out] StringBuilder windowText);
private const int WM_GETTEXT = 0xD;
private void button1_Click(object sender, System.EventArgs e)
{
int textSize = 1024;
StringBuilder buffer = new StringBuilder ( textSize );
SendMessage ( this.textBox1.Handle , WM_GETTEXT, textSize,
buffer );
MessageBox.Show(buffer.ToString());
}
Best regards,
Peter Huang
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
Dennis C. Drumm - 19 Nov 2004 12:17 GMT
Thanks Peter,
By the way, when I search the MSDN docs (unfiltered) for SendMessageGetText
or SendMessageSetText it does not come up with anything. How is one
suppoesed to know about these functions and are they something that might
not be supported in the next version of ...?
Dennis
> Hi
>
[quoted text clipped - 54 lines]
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
"Peter Huang" - 22 Nov 2004 01:57 GMT
Hi
Actually there is no such function, it is just a customized name( we can
change to other), the really function it is called is determined by
EntryPoint attribute. If we did not use that attribute the CLR will try to
find the function based on the function name we define, but once we have
define it, it does not matter what function name we define, because the CLR
will try to find the function in the DLL based on the EntryPoint.
Best regards,
Peter Huang
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
"Peter Huang" [MSFT] - 24 Nov 2004 03:09 GMT
Hi
If you still have any concern, please feel free to post here.
Best regards,
Peter Huang
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
Dennis C. Drumm - 26 Nov 2004 12:14 GMT
Thanks Peter,
You responses were greatly appreciated, I'm all set now!
Dennis
> Hi
>
[quoted text clipped - 8 lines]
> This posting is provided "AS IS" with no warranties, and confers no
> rights.