473,326 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

GetWindowText: does not work!

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 è una firma automatica di MesNews.
Sito: http://mesnews.no-ip.com

Nov 16 '05 #1
1 6593
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/<mn***********************@SPAM.no>

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]
Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Jonas | last post by:
This works fine in Win XP but does not work at all in Win 98. Private WithEvents objIExplorer As InternetExplorer I have to do it like this to get it to work in Win 98 Dim objIExplorer As...
5
by: me | last post by:
I have a Class Library that contains a Form and several helper classes. A thread gets created that performs processing of data behind the scenes and the Form never gets displayed (it is for debug...
1
by: R Huff | last post by:
I am trying to capture some text of an external application by using the GetWindowText Win32 function. I am able to successfully retrieve the text of some windows in the application (text boxes,...
2
by: Larry Dodd | last post by:
I am trying to write an application that sits in the system tray and just monitors for a certain Window to be opened. Once this window is opened all keystrokes will be captured. I have the key...
14
by: Anoop | last post by:
Hi, I am new to this newsgroup and need help in the following questions. 1. I am workin' on a GUI application. Does C# provides Layout Managers the way Java does to design GUI? I know that it...
89
by: Cuthbert | last post by:
After compiling the source code with gcc v.4.1.1, I got a warning message: "/tmp/ccixzSIL.o: In function 'main';ex.c: (.text+0x9a): warning: the 'gets' function is dangerous and should not be...
2
by: abxyz | last post by:
urgent required : how to get input from edit box in vc++ using GetWindowText function
14
by: webEater | last post by:
I have a problem, it's not browser specific, and I don't get a solution. I have an (X)HTML document, I show you a part of it: .... <!--<div class="pad">--> <div id="eventImages"><img src=""...
4
by: siulm | last post by:
All hi, I would like to move the mouse to X,Y point to any other window application and read its contents providing there is data there. Can GetWindowText do it? is there another function to do...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.