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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GetWindow() , GetWindowText()..Can I use it inVFP ? 1

Status
Not open for further replies.

Brezhnev

Programmer
Sep 25, 2002
53
CA
Good day everybody!
Can I use c-functions GetWindow() and GetWindowText() in VFP? I am trying it , but return value is always 0 which is indication that something is wrong.Here is my code :
*---------------
LPARAMETERS tnHandle,tcTextString,tnMaxCount

DECLARE INTEGER GetWindowText IN user32.dll;
INTEGER lnHandle,;
STRING @lcTextString,;
INTEGER lnMaxCount

RETURN GetWindowText(tnHandle,tcTextString,tnMaxCount)
*----------------
What i am trying to do is simple : get the title of running window , but lcTextString is always empty...
Any suggestions what am I doing wrong ?

Thanks a lot
 
if you want to know the name of the running window(form) use
?thisform.caption
and the name will be show
or
var=thisform.caption
to store the name in some var.
 
Brezhnev,

lcTextString is always empty...

You need to create the variable first:

lcTextString = REPLICATE(CHR(0),254)

Do that before you call the function.

BluePanic,

I think (but am not sure) that Brezhnev wants the title of a window from another application. If he wants a VFP window caption, your suggestion is good.

Mike


Mike Lewis
Edinburgh, Scotland
 
thanks Mike... will try it out and let you know!
 
it works..everything ..thanks a lot everybody for help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top