I am intercepting SC_MINIMIZE at WM_SYSCOMMAND to hide my app to the SysTray. Actually all I´m doing until now is a ShowWindow(Main, SW_HIDE);
Now I´m trying to create the Minimize to Tray animation, but of course I can´t use WM_MINIMIZE, it would minimize to the TaskBar, not the SysTray(or the "TaskBar Notification/Status Area" according to MS ).
So I´m trying to deal with AnimateWindow(). It looks like libuser32.a (MingW3.2, W32Api2) does not handle it? Well I can´t just use it like any other libuser32.a function. So, no other options left, I´m loading it dinamically from User32.dll like...
Code:
....
....
#define AW_HOR_POSITIVE 0x00000001
#define AW_HOR_NEGATIVE 0x00000002
#define AW_VER_POSITIVE 0x00000004
#define AW_VER_NEGATIVE 0x00000008
#define AW_CENTER 0x00000010
#define AW_HIDE 0x00010000
#define AW_ACTIVATE 0x00020000
#define AW_SLIDE 0x00040000
#define AW_BLEND 0x00080000
....
....
....
LoadLibrary(TEXT("user32.dll"));
typedef BOOL (WINAPI *lpfnAnimateWindow)(HWND hwnd, DWORD dwTime, DWORD dwFlags);
lpfnAnimateWindow AnimateWindow;
HMODULE hUser32 = GetModuleHandle(TEXT("user32.dll"));
AnimateWindow = (lpfnAnimateWindow)GetProcAddress(hUser32,"AnimateWindow");
AnimateWindow(hwndm,1000,AW_SLIDE | AW_HOR_POSITIVE | AW_VER_POSITIVE);
But it sux to load a dll just for a damned minimize action :\ I was thinking if maybe one of you knew of any other smarter way to
do it.
As on my Googlings around I could not find anyone complaining about MingW libs not supporting AnimateWindow() I´m guessing there´s a big chance that I´m doing something wrong, maybe not defining something I should, any stuff like that. Maybe one of you can just confirm to me that it is possible to use it.
Thank you!