GetWindowText: does not work!

M

Mauro

Hi,
as subject i've a problem with the API GetWindowText.
I declare the function GetWindowText:

[DllImport("user32.dll", EntryPoint="GetWindowTextA")]
public static extern int GetWindowTextt (
int hwnd,
string lpString,
int cch
);

When i try to call it in this way: Win32.GetWindText(hWnd,sName,128)
the sName string variable return empty!
how can i solve this problem?

thx!

Mauro.
 
R

Richard Blewett [DevelopMentor]

You need to use a System.Text.StringBuilder rather than a string for the lpString

Regards

Richard Blewett - DevelopMentor

http://staff.develop.com/richardb/weblog

nntp://news.microsoft.com/microsoft.public.dotnet.languages.csharp/<[email protected]>

Hi,
as subject i've a problem with the API GetWindowText.
I declare the function GetWindowText:

[DllImport("user32.dll", EntryPoint="GetWindowTextA")]
public static extern int GetWindowTextt (
int hwnd,
string lpString,
int cch
);

When i try to call it in this way: Win32.GetWindText(hWnd,sName,128)
the sName string variable return empty!
how can i solve this problem?

thx!

Mauro.

--
Questa &egrave; una firma automatica di MesNews.
Sito: http://mesnews.no-ip.com


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.766 / Virus Database: 513 - Release Date: 17/09/2004



[microsoft.public.dotnet.languages.csharp]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top