It seems more than reasonable that
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:
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:
HWND hWnd = NULL;
::EnumThreadWindows(::GetCurrentThreadId(), enumThreadWindowProc, (LPARAM)&hWnd);
if (hWnd == NULL) return;
uses this callback function
enumThreadWindowProc(HWND hWnd, LPARAM lParam)
if ( ::GetClassName(hWnd, buf, MAX_CLASS_NAME) == 0
|| ::lstrcmp(buf, "STUDIO") != 0
) return TRUE;
*((HWND *)lParam) = hWnd;
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.