Go Back   Winamp Forums > Winamp3 > Wasabi Development

 
Thread Tools Search this Thread Display Modes
Old 15th April 2003, 04:49   #1
citruz
Junior Member
 
Join Date: Oct 2002
Location: Sweden
Posts: 13
Send a message via ICQ to citruz
Toggle EQ & Main

Hello,

Ive figured out how to toggle most windows thanks to the GUID's posted here, but there are still 2 windows that wont toggle...

one is EQ.. there is provied this GUID for it but it doesnt work
{ 0xB66F7CE8, 0x8BB9, 0x4DAF, { 0x95, 0xF5, 0x4C, 0x45, 0xB0, 0x5C, 0xF1, 0xB7 } };


and the other is MainWindow / whole Winamp... to Minimize & Restore Winamp Windows...
citruz is offline  
Old 15th April 2003, 16:37   #2
snq
Member
 
snq's Avatar
 
Join Date: Mar 2003
Posts: 52
I use this to minimize the main window:

HWND hwndWinamp = GetParent( GetParent( this->getRootParent()->gethWnd() ) );
ShowWindow( hwndWinamp, SW_MINIMIZE );

A bit dirty maybe and if you want to do it using wasabi you shouldn't use this But it works...
Hope this helps...
snq is offline  
Old 15th April 2003, 16:51   #3
citruz
Junior Member
 
Join Date: Oct 2002
Location: Sweden
Posts: 13
Send a message via ICQ to citruz
in what class do you call that function ? ie. what is 'this' ?
citruz is offline  
Old 15th April 2003, 16:53   #4
snq
Member
 
snq's Avatar
 
Join Date: Mar 2003
Posts: 52
this = my own class derived from BaseWnd.
The window that my plugin is running in.
snq is offline  
Old 15th April 2003, 17:24   #5
citruz
Junior Member
 
Join Date: Oct 2002
Location: Sweden
Posts: 13
Send a message via ICQ to citruz
Ok,

the problem is that I dont create any parent windows to Winamp..
is there any other way to retrive winamp handle thru the api's?
citruz is offline  
Old 15th April 2003, 18:35   #6
snq
Member
 
snq's Avatar
 
Join Date: Mar 2003
Posts: 52
Found this in bfc/msgbox.cpp:

sw = new SkinWnd("msgbox.custom.group", "modal", FALSE, NULL, 1, 1);
if (!sw->getWindow()) return -1;
RootWnd *grp = sw->getWindow();
RootWnd *l = grp->getDesktopParent();

I didn't test it, but that RootWnd *l might be the winamp main window.. Otherwise I don't know
snq is offline  
Old 16th April 2003, 08:43   #7
yonido
Senior Member
 
Join Date: Jul 2002
Location: The holy land
Posts: 227
use api->main_getRootWnd()

yonido
yonido is offline  
Old 17th April 2003, 20:25   #8
LlelanD
Junior Member
 
Join Date: Apr 2003
Posts: 6
Lightbulb

It seems more than reasonable that
code:
RootWnd *pRoot = api->main_getRootWnd();
should give you the main application window that you can then minimize, but it doesn't. It gives you a hidden window with a class of "BaseWindow_RootWnd", a name of "", located at (0, 0), and with a size of 320x200. This mysterious window has no Wasabi window parent, and no MSWindows parent or owner handle. Of all of the open Winamp3 windows, hidden or otherwise, it is the only window not owned by the actual application main window.

The actual Winamp3 application main window has a class of "STUDIO", a name of "Winamp3" (This is the OS window name and not the name you actually see in the main window), and a location and size matching the visible main window. It is the handle of this window that you need to use in a ::ShowWindow(hWnd, SW_MINIMIZE) call.

In Winamp3 Wasabi, if you have created a window, you can get the application window handle as follows:
code:
HWND hWnd = ::GetAncestor(pWindow->getRootParent()->gethWnd(), GA_ROOTOWNER);
Using this handle in a ::ShowWindow(hWnd, SW_MINIMIZE) call will minimize the application.

If you do not create a window, then you've got a problem. I can find no other ComponentAPI function that will get you a window that has the application main window as the owner. One solution is to enumerate all the top-level windows for the current thread (in case there is more than one instance of Winamp3 running) and compare the class name to the known Winamp3 application main window class name. Like so:

This code
code:
HWND hWnd = NULL;
::EnumThreadWindows(::GetCurrentThreadId(), enumThreadWindowProc, (LPARAM)&hWnd);
if (hWnd == NULL) return;


uses this callback function
code:
BOOL CALLBACK
enumThreadWindowProc(HWND hWnd, LPARAM lParam)
{
TCHAR buf[MAX_CLASS_NAME];
if ( ::GetClassName(hWnd, buf, MAX_CLASS_NAME) == 0
|| ::lstrcmp(buf, "STUDIO") != 0
) return TRUE;

*((HWND *)lParam) = hWnd;
return FALSE;
}



Both of these were tested on Winamp3 #488 (Wow! A submitted answer that was actually tested! ). Note that this is not platform independent, and it depends on the application main window class name remaining "STUDIO" through future versions. Not a good thing, but it works for now.

I don't know why the window we get from api->main_getRootWnd() is not the application main window nor why it is not at least owned by that window. Maybe one of the core engineers would like to enlighten as to why, if this is simply a bug, or if there is some other way to manipulate the application main window (Everybody hold your breath now <chuckle>).

I hope this is of some help.
LlelanD is offline  
 
Go Back   Winamp Forums > Winamp3 > Wasabi Development

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump