Friends,

Recently I posted a question with the SUBJECT heading of "Sending KeyStrokes
to another Windows Application". The replies have been very helpful and did
what I wanted. I further need to know the FULL title bar caption of the
window activated by the the command:

WshShell.AppActivate("My application")

Actually the title bar can be more than just "My application" - In this case
it can be 'My application + some more strings'

I will look forward to guidance of member for doing it in my VFP8 application

Regards

S Bans

RE: Get FULL Title Bar string of Active window. by MichelRoy

MichelRoy
Mon Nov 28 11:19:09 CST 2005

this will iterate thrue open windows and return a collection of all windows
matching the beginning caption text

ex: loCaption = GetFullCaption("My Application")
FOR I = 1 to loCaption.Count && number of matching windows
? loCaption.Item(I)
NEXT

#DEFINE WM_CLOSE 0x10
#DEFINE GW_CHILD 5
#DEFINE GW_HWNDNEXT 2

PROCEDURE GetFullCaption(lcTxt AS STRING)
LOCAL lcPrc AS STRING, lnHwnd AS INTEGER, lnDesktopHWND
LOCAL lcTemp AS STRING, lcDir AS STRING
LOCAL loWindows AS Collection
loWindows = CREATEOBJECT("Collection")

DECLARE LONG "GetWindow" IN WIN32API LONG HWND, LONG wCmd

DECLARE LONG "FindWindow" IN WIN32API ;
STRING lpClassName, STRING lpWindowName

DECLARE LONG "PostMessage" IN WIN32API ;
LONG HWND, LONG wMsg, LONG wParam, LONG LPARAM

DECLARE LONG "IsWindowVisible" IN WIN32API LONG HWND

DECLARE LONG "GetClassName" IN WIN32API ;
LONG HWND, STRING lpClassName, LONG nMaxCount

DECLARE LONG "GetWindowText" IN WIN32API ;
LONG HWND, STRING lpClassName, LONG nMaxCount

DECLARE LONG "GetDesktopWindow" IN WIN32API

lcPrc = ""

TRY
lnDesktopHWND = GetDesktopWindow()
lnHwnd = GetWindow(lnDesktopHWND, GW_CHILD)

DO WHILE lnHwnd <> 0
lnHwnd = GetWindow(lnHwnd, GW_HWNDNEXT)
ccc = GWT(lnHwnd)
IF UPPER(ccc) = UPPER(lcTxt)
loWindows.Add(ccc)
ENDIF
ENDDO

CATCH
ENDTRY
RETURN loWindows
ENDPROC

PROCEDURE GCN(HWND AS LONG)
lcClass = SPACE(256)
lnLen = GetClassName(HWND, @lcClass, LEN(lcClass))
RETURN LEFT(lcClass, lnLen)
ENDPROC

PROCEDURE GWT(HWND AS LONG)
lcText = SPACE(256)
lnLen = GetWindowText(HWND, @lcText, LEN(lcText))
RETURN LEFT(lcText, lnLen)
ENDPROC

ENDDEFINE


"S Bans" wrote:

> Friends,
>
> Recently I posted a question with the SUBJECT heading of "Sending KeyStrokes
> to another Windows Application". The replies have been very helpful and did
> what I wanted. I further need to know the FULL title bar caption of the
> window activated by the the command:
>
> WshShell.AppActivate("My application")
>
> Actually the title bar can be more than just "My application" - In this case
> it can be 'My application + some more strings'
>
> I will look forward to guidance of member for doing it in my VFP8 application
>
> Regards
>
> S Bans
>

RE: Get FULL Title Bar string of Active window. by SBans

SBans
Tue Nov 29 02:22:18 CST 2005

Thanks, Michel,

Your suggestion is working fine, if I run it as a stand alone PRG, However
if I compile it with my project with the top 5 lines changed, I get some
errors:

My changed code is:
-------------------------

loCaption = GetFullCaption("My Application")
mFLAG = 0
FOR I = 1 to loCaption.Count && number of matching windows
IF LEN(ALLTRIM(loCaption.Item(I))) > len("My Application")
mFLAG = 1
EXIT
ELSE
mFLAG = 0
ENDIF
NEXT


The Errors I get are :
--------------------------

Compiling E:\TEST\check.prg
ENDDEFINE
Error in line 80: Statement is only valid within a class definition.

Program E:\TEST\check.prg has the following errors:
Unknown GETDESKTOPWINDOW - Undefined
Unknown GETWINDOW - Undefined
Unknown GETCLASSNAME - Undefined
Unknown GETWINDOWTEXT - Undefined

-------------------------------

Incidentally, my knowledge of Programming is very basic. I am engaged in
some other vocation, and the small appliocations I develop or get developed
are mostly for my own use. So I might be commiting some very basic mistake
and getting these errors. I hope you will understand and guide me how to
solve it.

Regards

S Bans





"Michel Roy" wrote:

> this will iterate thrue open windows and return a collection of all windows
> matching the beginning caption text
>
> ex: loCaption = GetFullCaption("My Application")
> FOR I = 1 to loCaption.Count && number of matching windows
> ? loCaption.Item(I)
> NEXT
>
> #DEFINE WM_CLOSE 0x10
> #DEFINE GW_CHILD 5
> #DEFINE GW_HWNDNEXT 2
>
> PROCEDURE GetFullCaption(lcTxt AS STRING)
> LOCAL lcPrc AS STRING, lnHwnd AS INTEGER, lnDesktopHWND
> LOCAL lcTemp AS STRING, lcDir AS STRING
> LOCAL loWindows AS Collection
> loWindows = CREATEOBJECT("Collection")
>
> DECLARE LONG "GetWindow" IN WIN32API LONG HWND, LONG wCmd
>
> DECLARE LONG "FindWindow" IN WIN32API ;
> STRING lpClassName, STRING lpWindowName
>
> DECLARE LONG "PostMessage" IN WIN32API ;
> LONG HWND, LONG wMsg, LONG wParam, LONG LPARAM
>
> DECLARE LONG "IsWindowVisible" IN WIN32API LONG HWND
>
> DECLARE LONG "GetClassName" IN WIN32API ;
> LONG HWND, STRING lpClassName, LONG nMaxCount
>
> DECLARE LONG "GetWindowText" IN WIN32API ;
> LONG HWND, STRING lpClassName, LONG nMaxCount
>
> DECLARE LONG "GetDesktopWindow" IN WIN32API
>
> lcPrc = ""
>
> TRY
> lnDesktopHWND = GetDesktopWindow()
> lnHwnd = GetWindow(lnDesktopHWND, GW_CHILD)
>
> DO WHILE lnHwnd <> 0
> lnHwnd = GetWindow(lnHwnd, GW_HWNDNEXT)
> ccc = GWT(lnHwnd)
> IF UPPER(ccc) = UPPER(lcTxt)
> loWindows.Add(ccc)
> ENDIF
> ENDDO
>
> CATCH
> ENDTRY
> RETURN loWindows
> ENDPROC
>
> PROCEDURE GCN(HWND AS LONG)
> lcClass = SPACE(256)
> lnLen = GetClassName(HWND, @lcClass, LEN(lcClass))
> RETURN LEFT(lcClass, lnLen)
> ENDPROC
>
> PROCEDURE GWT(HWND AS LONG)
> lcText = SPACE(256)
> lnLen = GetWindowText(HWND, @lcText, LEN(lcText))
> RETURN LEFT(lcText, lnLen)
> ENDPROC
>
> ENDDEFINE
>
>
> "S Bans" wrote:
>
> > Friends,
> >
> > Recently I posted a question with the SUBJECT heading of "Sending KeyStrokes
> > to another Windows Application". The replies have been very helpful and did
> > what I wanted. I further need to know the FULL title bar caption of the
> > window activated by the the command:
> >
> > WshShell.AppActivate("My application")
> >
> > Actually the title bar can be more than just "My application" - In this case
> > it can be 'My application + some more strings'
> >
> > I will look forward to guidance of member for doing it in my VFP8 application
> >
> > Regards
> >
> > S Bans
> >

RE: Get FULL Title Bar string of Active window. by SBans

SBans
Tue Nov 29 02:26:02 CST 2005

Michel,

This is in continuation of my previous post, my OS is Win XP Pro and Visual
foxPro is Ver 8.0

Regards

S Bans

"Michel Roy" wrote:

> this will iterate thrue open windows and return a collection of all windows
> matching the beginning caption text
>
> ex: loCaption = GetFullCaption("My Application")
> FOR I = 1 to loCaption.Count && number of matching windows
> ? loCaption.Item(I)
> NEXT
>
> #DEFINE WM_CLOSE 0x10
> #DEFINE GW_CHILD 5
> #DEFINE GW_HWNDNEXT 2
>
> PROCEDURE GetFullCaption(lcTxt AS STRING)
> LOCAL lcPrc AS STRING, lnHwnd AS INTEGER, lnDesktopHWND
> LOCAL lcTemp AS STRING, lcDir AS STRING
> LOCAL loWindows AS Collection
> loWindows = CREATEOBJECT("Collection")
>
> DECLARE LONG "GetWindow" IN WIN32API LONG HWND, LONG wCmd
>
> DECLARE LONG "FindWindow" IN WIN32API ;
> STRING lpClassName, STRING lpWindowName
>
> DECLARE LONG "PostMessage" IN WIN32API ;
> LONG HWND, LONG wMsg, LONG wParam, LONG LPARAM
>
> DECLARE LONG "IsWindowVisible" IN WIN32API LONG HWND
>
> DECLARE LONG "GetClassName" IN WIN32API ;
> LONG HWND, STRING lpClassName, LONG nMaxCount
>
> DECLARE LONG "GetWindowText" IN WIN32API ;
> LONG HWND, STRING lpClassName, LONG nMaxCount
>
> DECLARE LONG "GetDesktopWindow" IN WIN32API
>
> lcPrc = ""
>
> TRY
> lnDesktopHWND = GetDesktopWindow()
> lnHwnd = GetWindow(lnDesktopHWND, GW_CHILD)
>
> DO WHILE lnHwnd <> 0
> lnHwnd = GetWindow(lnHwnd, GW_HWNDNEXT)
> ccc = GWT(lnHwnd)
> IF UPPER(ccc) = UPPER(lcTxt)
> loWindows.Add(ccc)
> ENDIF
> ENDDO
>
> CATCH
> ENDTRY
> RETURN loWindows
> ENDPROC
>
> PROCEDURE GCN(HWND AS LONG)
> lcClass = SPACE(256)
> lnLen = GetClassName(HWND, @lcClass, LEN(lcClass))
> RETURN LEFT(lcClass, lnLen)
> ENDPROC
>
> PROCEDURE GWT(HWND AS LONG)
> lcText = SPACE(256)
> lnLen = GetWindowText(HWND, @lcText, LEN(lcText))
> RETURN LEFT(lcText, lnLen)
> ENDPROC
>
> ENDDEFINE
>
>
> "S Bans" wrote:
>
> > Friends,
> >
> > Recently I posted a question with the SUBJECT heading of "Sending KeyStrokes
> > to another Windows Application". The replies have been very helpful and did
> > what I wanted. I further need to know the FULL title bar caption of the
> > window activated by the the command:
> >
> > WshShell.AppActivate("My application")
> >
> > Actually the title bar can be more than just "My application" - In this case
> > it can be 'My application + some more strings'
> >
> > I will look forward to guidance of member for doing it in my VFP8 application
> >
> > Regards
> >
> > S Bans
> >

Re: Get FULL Title Bar string of Active window. by Bernhard

Bernhard
Tue Nov 29 03:42:48 CST 2005

Hi S Bans

> The Errors I get are :
> --------------------------
>
> Compiling E:\TEST\check.prg
> ENDDEFINE
> Error in line 80: Statement is only valid within a class definition.
The ENDDEFINE command is the companion to DEFINE CLASS (like ENDDO belongs to DO
WHILE). Since the code does not use any self defined classes, just delete this
ENDDEFINE.

Regards
Bernhard Sander

RE: Get FULL Title Bar string of Active window. by MichelRoy

MichelRoy
Tue Nov 29 04:46:03 CST 2005

yep, that's an extra line of code that should not be there. sometimes, when
you cut/paste from another program you forget to remove/fix little bits.

"S Bans" wrote:

> Thanks, Michel,
>
> Your suggestion is working fine, if I run it as a stand alone PRG, However
> if I compile it with my project with the top 5 lines changed, I get some
> errors:
>
> My changed code is:
> -------------------------
>
> loCaption = GetFullCaption("My Application")
> mFLAG = 0
> FOR I = 1 to loCaption.Count && number of matching windows
> IF LEN(ALLTRIM(loCaption.Item(I))) > len("My Application")
> mFLAG = 1
> EXIT
> ELSE
> mFLAG = 0
> ENDIF
> NEXT
>
>
> The Errors I get are :
> --------------------------
>
> Compiling E:\TEST\check.prg
> ENDDEFINE
> Error in line 80: Statement is only valid within a class definition.
>
> Program E:\TEST\check.prg has the following errors:
> Unknown GETDESKTOPWINDOW - Undefined
> Unknown GETWINDOW - Undefined
> Unknown GETCLASSNAME - Undefined
> Unknown GETWINDOWTEXT - Undefined
>
> -------------------------------
>
> Incidentally, my knowledge of Programming is very basic. I am engaged in
> some other vocation, and the small appliocations I develop or get developed
> are mostly for my own use. So I might be commiting some very basic mistake
> and getting these errors. I hope you will understand and guide me how to
> solve it.
>
> Regards
>
> S Bans
>
>
>
>
>
> "Michel Roy" wrote:
>
> > this will iterate thrue open windows and return a collection of all windows
> > matching the beginning caption text
> >
> > ex: loCaption = GetFullCaption("My Application")
> > FOR I = 1 to loCaption.Count && number of matching windows
> > ? loCaption.Item(I)
> > NEXT
> >
> > #DEFINE WM_CLOSE 0x10
> > #DEFINE GW_CHILD 5
> > #DEFINE GW_HWNDNEXT 2
> >
> > PROCEDURE GetFullCaption(lcTxt AS STRING)
> > LOCAL lcPrc AS STRING, lnHwnd AS INTEGER, lnDesktopHWND
> > LOCAL lcTemp AS STRING, lcDir AS STRING
> > LOCAL loWindows AS Collection
> > loWindows = CREATEOBJECT("Collection")
> >
> > DECLARE LONG "GetWindow" IN WIN32API LONG HWND, LONG wCmd
> >
> > DECLARE LONG "FindWindow" IN WIN32API ;
> > STRING lpClassName, STRING lpWindowName
> >
> > DECLARE LONG "PostMessage" IN WIN32API ;
> > LONG HWND, LONG wMsg, LONG wParam, LONG LPARAM
> >
> > DECLARE LONG "IsWindowVisible" IN WIN32API LONG HWND
> >
> > DECLARE LONG "GetClassName" IN WIN32API ;
> > LONG HWND, STRING lpClassName, LONG nMaxCount
> >
> > DECLARE LONG "GetWindowText" IN WIN32API ;
> > LONG HWND, STRING lpClassName, LONG nMaxCount
> >
> > DECLARE LONG "GetDesktopWindow" IN WIN32API
> >
> > lcPrc = ""
> >
> > TRY
> > lnDesktopHWND = GetDesktopWindow()
> > lnHwnd = GetWindow(lnDesktopHWND, GW_CHILD)
> >
> > DO WHILE lnHwnd <> 0
> > lnHwnd = GetWindow(lnHwnd, GW_HWNDNEXT)
> > ccc = GWT(lnHwnd)
> > IF UPPER(ccc) = UPPER(lcTxt)
> > loWindows.Add(ccc)
> > ENDIF
> > ENDDO
> >
> > CATCH
> > ENDTRY
> > RETURN loWindows
> > ENDPROC
> >
> > PROCEDURE GCN(HWND AS LONG)
> > lcClass = SPACE(256)
> > lnLen = GetClassName(HWND, @lcClass, LEN(lcClass))
> > RETURN LEFT(lcClass, lnLen)
> > ENDPROC
> >
> > PROCEDURE GWT(HWND AS LONG)
> > lcText = SPACE(256)
> > lnLen = GetWindowText(HWND, @lcText, LEN(lcText))
> > RETURN LEFT(lcText, lnLen)
> > ENDPROC
> >
> > ENDDEFINE
> >
> >
> > "S Bans" wrote:
> >
> > > Friends,
> > >
> > > Recently I posted a question with the SUBJECT heading of "Sending KeyStrokes
> > > to another Windows Application". The replies have been very helpful and did
> > > what I wanted. I further need to know the FULL title bar caption of the
> > > window activated by the the command:
> > >
> > > WshShell.AppActivate("My application")
> > >
> > > Actually the title bar can be more than just "My application" - In this case
> > > it can be 'My application + some more strings'
> > >
> > > I will look forward to guidance of member for doing it in my VFP8 application
> > >
> > > Regards
> > >
> > > S Bans
> > >

RE: Get FULL Title Bar string of Active window. by SBans

SBans
Tue Nov 29 07:59:08 CST 2005

Michel,

I removed the extra 'ENDDEFINE', however the following errors still remain:

Program E:\TEST\check.prg has the following errors:
Unknown GETDESKTOPWINDOW - Undefined
Unknown GETWINDOW - Undefined
Unknown GETCLASSNAME - Undefined
Unknown GETWINDOWTEXT - Undefined


Regards

S Bans


"Michel Roy" wrote:

> yep, that's an extra line of code that should not be there. sometimes, when
> you cut/paste from another program you forget to remove/fix little bits.
>
> "S Bans" wrote:
>
> > Thanks, Michel,
> >
> > Your suggestion is working fine, if I run it as a stand alone PRG, However
> > if I compile it with my project with the top 5 lines changed, I get some
> > errors:
> >
> > My changed code is:
> > -------------------------
> >
> > loCaption = GetFullCaption("My Application")
> > mFLAG = 0
> > FOR I = 1 to loCaption.Count && number of matching windows
> > IF LEN(ALLTRIM(loCaption.Item(I))) > len("My Application")
> > mFLAG = 1
> > EXIT
> > ELSE
> > mFLAG = 0
> > ENDIF
> > NEXT
> >
> >
> > The Errors I get are :
> > --------------------------
> >
> > Compiling E:\TEST\check.prg
> > ENDDEFINE
> > Error in line 80: Statement is only valid within a class definition.
> >
> > Program E:\TEST\check.prg has the following errors:
> > Unknown GETDESKTOPWINDOW - Undefined
> > Unknown GETWINDOW - Undefined
> > Unknown GETCLASSNAME - Undefined
> > Unknown GETWINDOWTEXT - Undefined
> >
> > -------------------------------
> >
> > Incidentally, my knowledge of Programming is very basic. I am engaged in
> > some other vocation, and the small appliocations I develop or get developed
> > are mostly for my own use. So I might be commiting some very basic mistake
> > and getting these errors. I hope you will understand and guide me how to
> > solve it.
> >
> > Regards
> >
> > S Bans
> >
> >
> >
> >
> >
> > "Michel Roy" wrote:
> >
> > > this will iterate thrue open windows and return a collection of all windows
> > > matching the beginning caption text
> > >
> > > ex: loCaption = GetFullCaption("My Application")
> > > FOR I = 1 to loCaption.Count && number of matching windows
> > > ? loCaption.Item(I)
> > > NEXT
> > >
> > > #DEFINE WM_CLOSE 0x10
> > > #DEFINE GW_CHILD 5
> > > #DEFINE GW_HWNDNEXT 2
> > >
> > > PROCEDURE GetFullCaption(lcTxt AS STRING)
> > > LOCAL lcPrc AS STRING, lnHwnd AS INTEGER, lnDesktopHWND
> > > LOCAL lcTemp AS STRING, lcDir AS STRING
> > > LOCAL loWindows AS Collection
> > > loWindows = CREATEOBJECT("Collection")
> > >
> > > DECLARE LONG "GetWindow" IN WIN32API LONG HWND, LONG wCmd
> > >
> > > DECLARE LONG "FindWindow" IN WIN32API ;
> > > STRING lpClassName, STRING lpWindowName
> > >
> > > DECLARE LONG "PostMessage" IN WIN32API ;
> > > LONG HWND, LONG wMsg, LONG wParam, LONG LPARAM
> > >
> > > DECLARE LONG "IsWindowVisible" IN WIN32API LONG HWND
> > >
> > > DECLARE LONG "GetClassName" IN WIN32API ;
> > > LONG HWND, STRING lpClassName, LONG nMaxCount
> > >
> > > DECLARE LONG "GetWindowText" IN WIN32API ;
> > > LONG HWND, STRING lpClassName, LONG nMaxCount
> > >
> > > DECLARE LONG "GetDesktopWindow" IN WIN32API
> > >
> > > lcPrc = ""
> > >
> > > TRY
> > > lnDesktopHWND = GetDesktopWindow()
> > > lnHwnd = GetWindow(lnDesktopHWND, GW_CHILD)
> > >
> > > DO WHILE lnHwnd <> 0
> > > lnHwnd = GetWindow(lnHwnd, GW_HWNDNEXT)
> > > ccc = GWT(lnHwnd)
> > > IF UPPER(ccc) = UPPER(lcTxt)
> > > loWindows.Add(ccc)
> > > ENDIF
> > > ENDDO
> > >
> > > CATCH
> > > ENDTRY
> > > RETURN loWindows
> > > ENDPROC
> > >
> > > PROCEDURE GCN(HWND AS LONG)
> > > lcClass = SPACE(256)
> > > lnLen = GetClassName(HWND, @lcClass, LEN(lcClass))
> > > RETURN LEFT(lcClass, lnLen)
> > > ENDPROC
> > >
> > > PROCEDURE GWT(HWND AS LONG)
> > > lcText = SPACE(256)
> > > lnLen = GetWindowText(HWND, @lcText, LEN(lcText))
> > > RETURN LEFT(lcText, lnLen)
> > > ENDPROC
> > >
> > > ENDDEFINE
> > >
> > >
> > > "S Bans" wrote:
> > >
> > > > Friends,
> > > >
> > > > Recently I posted a question with the SUBJECT heading of "Sending KeyStrokes
> > > > to another Windows Application". The replies have been very helpful and did
> > > > what I wanted. I further need to know the FULL title bar caption of the
> > > > window activated by the the command:
> > > >
> > > > WshShell.AppActivate("My application")
> > > >
> > > > Actually the title bar can be more than just "My application" - In this case
> > > > it can be 'My application + some more strings'
> > > >
> > > > I will look forward to guidance of member for doing it in my VFP8 application
> > > >
> > > > Regards
> > > >
> > > > S Bans
> > > >

Re: Get FULL Title Bar string of Active window. by Bernhard

Bernhard
Tue Nov 29 08:19:47 CST 2005

Hi S Bans

> I removed the extra 'ENDDEFINE', however the following errors still remain:
>
> Program E:\TEST\check.prg has the following errors:
> Unknown GETDESKTOPWINDOW - Undefined
> Unknown GETWINDOW - Undefined
> Unknown GETCLASSNAME - Undefined
> Unknown GETWINDOWTEXT - Undefined

The function name in a DECLARE statement (and only there) is case sensitive. You
should use the writing as in the original post of Michel.
The qoutes around the function names are not necessary. I would take them away.

>>>> DECLARE LONG "GetWindow" IN WIN32API LONG HWND, LONG wCmd
>>>>
>>>> DECLARE LONG "FindWindow" IN WIN32API ;
>>>> STRING lpClassName, STRING lpWindowName
>>>>
>>>> DECLARE LONG "PostMessage" IN WIN32API ;
>>>> LONG HWND, LONG wMsg, LONG wParam, LONG LPARAM
>>>>
>>>> DECLARE LONG "IsWindowVisible" IN WIN32API LONG HWND
>>>>
>>>> DECLARE LONG "GetClassName" IN WIN32API ;
>>>> LONG HWND, STRING lpClassName, LONG nMaxCount
>>>>
>>>> DECLARE LONG "GetWindowText" IN WIN32API ;
>>>> LONG HWND, STRING lpClassName, LONG nMaxCount
>>>>
>>>> DECLARE LONG "GetDesktopWindow" IN WIN32API

Regards
Bernhard Sander

Re: Get FULL Title Bar string of Active window. by MichelRoy

MichelRoy
Tue Nov 29 08:40:14 CST 2005

the quotes aren't aren't needed that's true, but it prevents accidental
changes to the case sensitive function names when you beautify the code.

"Bernhard Sander" wrote:

> Hi S Bans
>
> > I removed the extra 'ENDDEFINE', however the following errors still remain:
> >
> > Program E:\TEST\check.prg has the following errors:
> > Unknown GETDESKTOPWINDOW - Undefined
> > Unknown GETWINDOW - Undefined
> > Unknown GETCLASSNAME - Undefined
> > Unknown GETWINDOWTEXT - Undefined
>
> The function name in a DECLARE statement (and only there) is case sensitive. You
> should use the writing as in the original post of Michel.
> The qoutes around the function names are not necessary. I would take them away.
>
> >>>> DECLARE LONG "GetWindow" IN WIN32API LONG HWND, LONG wCmd
> >>>>
> >>>> DECLARE LONG "FindWindow" IN WIN32API ;
> >>>> STRING lpClassName, STRING lpWindowName
> >>>>
> >>>> DECLARE LONG "PostMessage" IN WIN32API ;
> >>>> LONG HWND, LONG wMsg, LONG wParam, LONG LPARAM
> >>>>
> >>>> DECLARE LONG "IsWindowVisible" IN WIN32API LONG HWND
> >>>>
> >>>> DECLARE LONG "GetClassName" IN WIN32API ;
> >>>> LONG HWND, STRING lpClassName, LONG nMaxCount
> >>>>
> >>>> DECLARE LONG "GetWindowText" IN WIN32API ;
> >>>> LONG HWND, STRING lpClassName, LONG nMaxCount
> >>>>
> >>>> DECLARE LONG "GetDesktopWindow" IN WIN32API
>
> Regards
> Bernhard Sander
>

Re: Get FULL Title Bar string of Active window. by SBans

SBans
Tue Nov 29 12:34:02 CST 2005

Michel and Bernhard,

Removing the QUOTES did the trick, I was using the code as given in the
original post of Michel, VFP gives error report in all CAPS. However, the
thing is done.

Secondly, I use SET EXACT ON in my programs, so changing the follwing first
line of code to second was necessary for me:

*IF UPPER(ccc) = UPPER(lcTxt)
IF ATC(UPPER(lcTxt),UPPER(ccc))>0

Finally, I removed some declarations from the code like:

*!* LOCAL lcTemp AS STRING, lcDir AS STRING

*!* DECLARE LONG "FindWindow" IN WIN32API STRING lpClassName,;
STRING lpWindowName

*!* DECLARE LONG "PostMessage" IN WIN32API LONG HWND, ;
LONG wMsg, LONG wParam, LONG LPARAM

*!* DECLARE LONG "IsWindowVisible" IN WIN32API LONG HWND

It is working fine now. Thanks again.

Regards

S Bans



"Michel Roy" wrote:

> the quotes aren't aren't needed that's true, but it prevents accidental
> changes to the case sensitive function names when you beautify the code.
>
> "Bernhard Sander" wrote:
>
> > Hi S Bans
> >
> > > I removed the extra 'ENDDEFINE', however the following errors still remain:
> > >
> > > Program E:\TEST\check.prg has the following errors:
> > > Unknown GETDESKTOPWINDOW - Undefined
> > > Unknown GETWINDOW - Undefined
> > > Unknown GETCLASSNAME - Undefined
> > > Unknown GETWINDOWTEXT - Undefined
> >
> > The function name in a DECLARE statement (and only there) is case sensitive. You
> > should use the writing as in the original post of Michel.
> > The qoutes around the function names are not necessary. I would take them away.
> >
> > >>>> DECLARE LONG "GetWindow" IN WIN32API LONG HWND, LONG wCmd
> > >>>>
> > >>>> DECLARE LONG "FindWindow" IN WIN32API ;
> > >>>> STRING lpClassName, STRING lpWindowName
> > >>>>
> > >>>> DECLARE LONG "PostMessage" IN WIN32API ;
> > >>>> LONG HWND, LONG wMsg, LONG wParam, LONG LPARAM
> > >>>>
> > >>>> DECLARE LONG "IsWindowVisible" IN WIN32API LONG HWND
> > >>>>
> > >>>> DECLARE LONG "GetClassName" IN WIN32API ;
> > >>>> LONG HWND, STRING lpClassName, LONG nMaxCount
> > >>>>
> > >>>> DECLARE LONG "GetWindowText" IN WIN32API ;
> > >>>> LONG HWND, STRING lpClassName, LONG nMaxCount
> > >>>>
> > >>>> DECLARE LONG "GetDesktopWindow" IN WIN32API
> >
> > Regards
> > Bernhard Sander
> >