Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

getwindowtexta = need help defining function

Status
Not open for further replies.

dazappa007

Programmer
Oct 24, 2007
4
US
OK well I think I found a user32.dll function that is perfect for me: GetWindowTextA. The problem is, I don't know how to do it... In vb you'd do
Code:
 Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA"
(ByVal hWnd As System.IntPtr, ByVal lpString As System.Text.StringBuilder,
ByVal nMaxCount As Integer) As Integer
But yeah, can someone help me convert that to delphi?
 
Usually most of the common Windows API functions are defined in the Windows unit. So if the program has the windows unit present, all it takes is making the call.

This should be documented in the Windows 32 API help. Or if you can find it (hopefully in the Delphi install), have a look at the windows unit source.

I'll do it for you for this one:
Code:
function GetWindowTextA(hWnd: HWND; lpString: PAnsiChar; nMaxCount: Integer): Integer; stdcall;

function GetWindowTextA; external user32 name 'GetWindowTextA';
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top