Thread: AnimateWindow()

  1. #1
    Registered User
    Join Date
    Nov 2002
    Posts
    42

    AnimateWindow()

    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!

  2. #2
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Looks like the header and the library are missing AnimateWindow as is the most recent def file so what you're doing is probably the simplest way to use the fn.

    If you want, you could always modify user32.def, rebuild libuser32.a and add the missing defines/typedefs to winuser.h and submit your changes to mingw cvs....
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. AnimateWindow
    By Anuradh_a in forum Windows Programming
    Replies: 1
    Last Post: 06-12-2008, 01:04 AM
  2. AnimateWindow && Dev-C++ problems
    By willc0de4food in forum Windows Programming
    Replies: 4
    Last Post: 03-13-2006, 04:34 PM
  3. AnimateWindow
    By jmd15 in forum Windows Programming
    Replies: 1
    Last Post: 07-16-2005, 03:35 PM