Animatewindow to beautify your dialog box (fade in and fade out, automatically rise and fall)

Source: Internet
Author: User

Http://blog.sina.com.cn/s/blog_455245fc01000a42.html

 

Method:

/************************** Animatewindow () **************************/
 

# 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

Void cpagedlg: onclose () // implement fade out function
{
// Define the animation window function pointer
Typedef uint (callback * lpfun) (hwnd, DWORD dwtime, DWORD dwflags );
Lpfun pp;
Hinstance hinst =: loadlibrary ("user32.dll ");

If (hinst)
{
Pp = (lpfun): getprocaddress (hinst, "animatewindow ");
PP (getsafehwnd (), 300, aw_blend | aw_hide); // The red is the animation type.
: Freelibrary (hinst); // The green value is time.
} // The Same below

Cdialog: onclose ();
}

Likewise:

Void chipdlg: onshowwindow (bool bshow, uint nstatus)
{
Cdialog: onshowwindow (bshow, nstatus); // scroll when the display is not inactive
// Different parameters
// Todo: add your message handler code here
// Define the animation window function pointer
Typedef uint (callback * lpfun) (hwnd, DWORD dwtime, DWORD dwflags );
Lpfun pp;
Hinstance hinst =: loadlibrary ("user32.dll ");

If (hinst)
{
Pp = (lpfun): getprocaddress (hinst, "animatewindow ");
PP (getsafehwnd (), 500, aw_slide | aw_ver_negative );
: Freelibrary (hinst );
}

}

 

 

Parameter questions:

Function prototype: bool animatewindow (hwnd, DWORD dwtime, DWORD dwflags ).

Function: this function can display and hide windows with two special types of animation effects: Scroll animation and slide animation.

Parameter description:
Hwnd: Specifies the handle of the window that generates the animation.
Dwtime: Specifies the animation duration (in microseconds). The standard time for completing an animation is 200 microseconds.
Dwfags: Specifies the animation type. This parameter can be a combination of one or more of the following labels. Description:
Aw_slide: Use the slide type. The default value is the scroll animation type. When the aw_center flag is used, this flag is ignored.
Aw_activate: Activation window. This flag cannot be used after the aw_hide flag is used.
Aw_blend: fades out. This flag can be used only when hwnd is a top-level window.
Aw_hide: hides the window. The window is displayed by default.
Aw_center: If the aw_hide flag is used, the window overlaps inwards, that is, the window is shrunk. If the aw_hide flag is not used, the window is extended, that is, the window is expanded.
Aw_hor_positive: the window is displayed from left to right. This flag can be used in rolling and sliding animations. When the aw_center flag is used, the flag is ignored.
Aw_ver_positive: the window is displayed from top to bottom. This flag can be used in rolling and sliding animations. When the aw_center flag is used, the flag is ignored.
Aw_ver_negative: the window is displayed from bottom to top. This flag can be used in rolling and sliding animations. When the aw_center flag is used, the flag is ignored.


Return Value: If the function succeeds, the return value is non-zero. If the function fails, the return value is zero. The function will fail in the following cases:

The window uses the window boundary. The window is visible, and the window is hidden.
 
$ Hwnd = guicreate ("animations window", 300,300)

Dllcall ("user32.dll", "int", "animatewindow", "hwnd", $ hwnd, "int", 1000, "long", 0x00080000); fade-in
Guisetstate ()
Dllcall ("user32.dll", "int", "animatewindow", "hwnd", $ hwnd, "int", 1000, "long", 0x00090000); fade-out
Dllcall ("user32.dll", "int", "animatewindow", "hwnd", $ hwnd, "int", 1000, "long", 0x00040001); slide in from left
Dllcall ("user32.dll", "int", "animatewindow", "hwnd", $ hwnd, "int", 1000, "long", 0x00050002); slide out to left
Dllcall ("user32.dll", "int", "animatewindow", "hwnd", $ hwnd, "int", 1000, "long", 0x00040002); slide in from right
Dllcall ("user32.dll", "int", "animatewindow", "hwnd", $ hwnd, "int", 1000, "long", 0x00050001); slide out to right
Dllcall ("user32.dll", "int", "animatewindow", "hwnd", $ hwnd, "int", 1000, "long", 0x00040004 ); slide-in from top
Dllcall ("user32.dll", "int", "animatewindow", "hwnd", $ hwnd, "int", 1000, "long", 0x00050008 ); slide-out to top
Dllcall ("user32.dll", "int", "animatewindow", "hwnd", $ hwnd, "int", 1000, "long", 0x00040008 ); slide-in from bottom
Dllcall ("user32.dll", "int", "animatewindow", "hwnd", $ hwnd, "int", 1000, "long", 0x00050004 ); slide-out to bottom
Dllcall ("user32.dll", "int", "animatewindow", "hwnd", $ hwnd, "int", 1000, "long", 0x00040005 ); diag slide-in from top-left
Dllcall ("user32.dll", "int", "animatewindow", "hwnd", $ hwnd, "int", 1000, "long", 0x0005000a ); diag slide-out to top-left
Dllcall ("user32.dll", "int", "animatewindow", "hwnd", $ hwnd, "int", 1000, "long", 0x00040006 ); diag slide-in from top-Right
Dllcall ("user32.dll", "int", "animatewindow", "hwnd", $ hwnd, "int", 1000, "long", 0x00050009 ); diag slide-out to top-Right
Dllcall ("user32.dll", "int", "animatewindow", "hwnd", $ hwnd, "int", 1000, "long", 0x00040009 ); diag slide-in from bottom-left
Dllcall ("user32.dll", "int", "animatewindow", "hwnd", $ hwnd, "int", 1000, "long", 0x00050006 ); diag slide-out to bottom-left
Dllcall ("user32.dll", "int", "animatewindow", "hwnd", $ hwnd, "int", 1000, "long", 0x0004000a ); diag slide-in from bottom-Right
Dllcall ("user32.dll", "int", "animatewindow", "hwnd", $ hwnd, "int", 1000, "long", 0x00050005 ); diag slide-out to bottom-Right
Dllcall ("user32.dll", "int", "animatewindow", "hwnd", $ hwnd, "int", 1000, "long", 0x00040010); explode
Dllcall ("user32.dll", "int", "animatewindow", "hwnd", $ hwnd, "int", 1000, "long", 0x00050010); implode

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.