Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords:
I ran the same code in Windows XP and it executed as I thought it should. I modified "FileMenu for all filetypes.mnw" and entered the code as an item in the menu and it returned the title of the "Explorer" window.
trgDir = wingetactive() Cnts = itemcount(trgDir, '\') if Cnts==1 display(5, 'Can''t Gather Vids to Root!', 'Try a different folder.') endif Trg = itemextract(Cnts, trgDir, '\') dirchange('..')Beyond getting my script to work I think WinGetActive() should work the same whether I'm using a FileMenu script in XP or Windows 7 but it doesn't. The active window is the Explorer window from which the script is invoked not the script invoked from the context menu or the context menu itself.
I have found the cGetFocus can be used in this instance. Once you get the window with focus you can get that parents owner handle to get the title. This seems to work for me on Windows 7 from FileMenu:
_Get Active Window Name From Filemenu ; Load Appropriate Extender AddExtender("wwctl44i.dll",0,"wwctl64i.dll") hwndFocus = cGetFocus() owner = cWndInfo(hwndFocus,9) thistext = cWndInfo(owner,0) Pause('cGetFocus Focused Window',thistext)Note: WinGetActive and cGetFocus are returning the same window. The difference is that cGetFocus is returning a window handle that can be passed to cWndInfo to obtain the window's owner window. Because FileMenu is a shell extension, that owner window is the current running shell's app window.
Here is another way to get the shell window's caption which is also the caption of the window the was returned by WinGetActive() of the old 32-bit FileMenu:
_Get Active Window Name From Filemenu strCaption = WinName() Message("Shell Window Caption", strCaption)
Article ID: W18518
Filename: WinGetActive in FileMenu.txt
File Created: 2014:06:24:07:42:00
Last Updated: 2014:06:24:07:42:00