Mystery window when program starts

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
elmo
Posts: 113
Joined: 09 Oct 2013, 09:08

Mystery window when program starts

07 Jun 2020, 19:41

Help ! Does anybody know how to keep this window from displaying when a program starts ?

I do not even know what it is so unable to research here on the forum.

get-rid-of-other-window.png
get-rid-of-other-window.png (34.67 KiB) Viewed 825 times
elmo
Posts: 113
Joined: 09 Oct 2013, 09:08

Re: Mystery window when program starts

08 Jun 2020, 15:37

@Xtra
@lexikos

Dear Xtra,

So appreciate your response and quite fond of SetTimer... I 'assume' you mean use SetTimer to close the rogue window if it is present... I will try that if necessary...

I was hoping to understand WHAT that window was so I could try to search for a pre-emptive resolution... As of this writing I have no idea what to search on because I have never seen it before and know not what to call it...

To that end, and staying within the confines of this request, I am hoping that lexikos can spare a moment to help me understand... I would hope to know what to avoid or instantiate before it pops up intermitently...

Many thanks.
gregster
Posts: 9000
Joined: 30 Sep 2013, 06:48

Re: Mystery window when program starts

08 Jun 2020, 16:17

It's unclear what you are asking. So, this is your own AHK script showing the window?

I guess you should show some code that allows to reproduce the problem...
elmo
Posts: 113
Joined: 09 Oct 2013, 09:08

Re: Mystery window when program starts

08 Jun 2020, 16:47

Hello @gregster ,

Thanks for taking a crack at this. My code:

Code: Select all

#SingleInstance , Force
#NoEnv
#NoTrayIcon
#Persistent

DetectHiddenWindows , On

Gui , 1:New  ,  , Get Rid Of Extra Window
Gui , 1:Margin , 8 , 8
Gui , 1:Add  , Text , xm ym w0320 Center , How do I get rid of that other window at startup ?
Gui , 1:Show

WinGet , id , List , , , Program Manager

Loop %id%
{
  this_id := id%A_Index%
  WinGetTitle, title, ahk_id %this_id%
  
  If ( title = "" )
    continue
  
  WinGet, Style, Style, ahk_id %this_id%
  
  if !( Style & 0x10000000 ) ; WS_VISIBLE
    continue
  
  listOfWindows .= title ? title "`n" : ""
}

MsgBox , 4096 , %A_AhkVersion% is 64 %A_Is64bitOS% , % listOfWindows

return

GuiClose:
ExitApp
return
The result:
get-rid-of-extra-window.png
get-rid-of-extra-window.png (77.09 KiB) Viewed 732 times
Do you even know what the heck that window is? Seems like some sort of information window. Again, have never seen it before and hoping to give it a 'name'.

As you can see, it is the latest version of AHK_L compiled to 64-Bit running from a network shared folder.
gregster
Posts: 9000
Joined: 30 Sep 2013, 06:48

Re: Mystery window when program starts

08 Jun 2020, 17:13

That's the script's main window (each script has it - it's usually hidden, unless you - for example - double-click the uncompiled script's systray icon, or choose 'Open' from its context menu; or you use some command like ListLines to call it up - the latter works for compiled ones, too.).

Why your compiled script would show it, we'll have to see. From your posted code, I don't see a reason yet.
Is this really your complete code, or does this code really show that window?


Edit: Sorry, I can't reproduce it with the code you showed. There must be something else going on - more relevant code, other scripts... Do you have other code in your script which unhides certain windows?
elmo
Posts: 113
Joined: 09 Oct 2013, 09:08

Re: Mystery window when program starts

08 Jun 2020, 17:44

Hello @gregster,

Yes, that is the complete code. I can not reproduce on my Windows system either. In this case it is running as a published application on a virtual server so that is causing this anomalous behaviour; as noted, intermittently.

Thank you so much for revealing that it is the "script's main window" and referencing "Listlines". I am starting to read and research those hoping there is some command line or other instruction to keep it from popping up in the first place.

Xtra suggested SetTimer which I understand, but that is a brute force method. Would really like to 'tell' the 'Main Window' to just stay away altogether ;-)

Again, thank you so much for your time, and I welcome any other thoughts or insights that you can offer.
gregster
Posts: 9000
Joined: 30 Sep 2013, 06:48

Re: Mystery window when program starts

08 Jun 2020, 17:56

I rarely compile or use compiled scripts - perhaps someone else has seen this before.

Btw, closing this main window will also close the complete script, afaik. So if you do something with it, you should just hide it again.
lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: Mystery window when program starts

08 Jun 2020, 18:07

If you click the close button, it is designed to hide rather than close the window. The script will terminate if it is closed by some other means.

You can "permanently" prevent the window from being shown by making it a message-only window:

Code: Select all

DllCall("SetParent", "ptr", A_ScriptHwnd, "ptr", HWND_MESSAGE := -3)
This also hides it from view by WinTitle and other programs enumerating top-level windows. I'm not entirely sure whether there's any other way to find the window if you don't have the HWND.
elmo
Posts: 113
Joined: 09 Oct 2013, 09:08

Re: Mystery window when program starts

08 Jun 2020, 20:00

O H M Y G A W D ! ! !

Thank you so much @lexikos :bravo:

It worked !!! The main window is NOT showing... I think not at all... At least not so far...

Once again, zero chance I would have solved by myself...

Totally appreciated...

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Joey5, justcop, Rohwedder and 146 guests