Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
How to change display settings: screen resolution, screen refresh rate
Capturing keyboard activity of another application with the Raw Input API (VFP9)
Adding and deleting Scheduled Tasks using NetScheduleJob API functions
Custom GDI+ class
Converting Unicode data from the Clipboard to a character string using a given code page
Custom HttpRequest class (WinINet)
Custom FTP Class for Visual FoxPro application
How to make a VFP form fading out when released (GDI+ version)
How to make a VFP form fading out when released (GDI version)
Using FlashWindowEx to flash the taskbar button of the VFP application
Establishing connection using the SQLDriverConnect
Splash Screen for the VFP application
How to create non-blocking Winsock server
Peer-to-peer LAN messenger built with Mailslot API functions
Using WM_COPYDATA for interprocess communication (VFP9)
Winsock: sending email messages (SMTP, port 25)
Creating a mailslot
Class for sound recording
GDI+: copying to the Clipboard (a) image of active FoxPro window/form, (b) image file
How to print a bitmap file
Enumerating raw input devices attached to the system (keyboard, mouse, human interface device)
How to create MD-5 and SHA-1 hash values from a string
Enumerating data formats currently available on the clipboard
Displaying animated images on FoxPro form with BitBlt and StretchBlt functions
Using FlashWindowEx to flash the taskbar button of the VFP application

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
More code examples    Listed functions    Add comment     W32 Constants      Translate this page Printer friendly version of this code sample
Versions:
click to open
Before you begin:
This code sample shows how to turn user to the monitor`s screen by flashing the icon of an application in the Windows taskbar. There are several other ways of alerting the user using various visual effects:

  • Flashing caption of a VFP application in the Windows task bar using FlashWindow
  • Shaking VFP form controls
  • Placing On-screen Alert on top of all windows
  •  
    namespace FlashWindowApi
    {
        using System;
        using System.Runtime.InteropServices;
        using System.Windows.Forms;
     
        [StructLayout(LayoutKind.Sequential)]
        public struct FlashWinInfo
        {
            public uint Size;
            public IntPtr Handle;
            public FlashWinFlags Flags;
            public uint Count;
            public uint Timeout;
        }
     
        [Flags]
        public enum FlashWinFlags : uint
        {
            FlashStop = 0x0000,
            FlashCaption = 0x0001,
            FlashTray = 0x0002,
            FlashAll = 0x0003,
            FlashTimer = 0x0004,
            FlashTimerNoForeground = 0x000c,
        }
     
        public static class FlashWindowManager
        {
            public static void FlashWindow(
                IntPtr winHandle,
                FlashWinFlags flags = FlashWinFlags.FlashAll,
                int count = int.MaxValue,
                int timeout = 0)
            {
                var flashWinInfo = new FlashWinInfo();
                flashWinInfo.Size = (uint)Marshal.SizeOf(flashWinInfo);
     
                flashWinInfo.Handle = winHandle;
                flashWinInfo.Flags = flags;
                flashWinInfo.Count = (uint)count;
                flashWinInfo.Timeout = (uint)timeout;
     
                FlashWindowEx(ref flashWinInfo);
            }
     
            public static void FlashWindow(
                this Form form, 
                FlashWinFlags flags = FlashWinFlags.FlashAll,
                int count = int.MaxValue, 
                int timeout = 0)
            {
                FlashWindow(form.Handle, flags, count, timeout);
            }
     
            public static void FlashStop(IntPtr winHandle)
            {
                FlashWindow(winHandle, FlashWinFlags.FlashStop);
            }
     
            public static void FlashStop(this Form form)
            {
                FlashStop(form.Handle);
            }
     
            [DllImport("user32.dll")]
            [return: MarshalAs(UnmanagedType.Bool)]
            private static extern bool FlashWindowEx(
                ref FlashWinInfo flashWinInfo);
        }
    }
     

    User rating: 0/10 (0 votes)
    Rate this code sample:
    • ~
    1989 bytes  
    Created: 2002-01-29 22:56:25  
    Modified: 2012-04-27 16:14:04  
    Visits in 7 days: 221  
    Listed functions:
    FlashWindowEx
    GetActiveWindow
    Printer friendly API declarations
    My comment:
    This is an asynchronous function, that means it returns immediately after beginning the flashing.

    Once the handle of a window is known, it is possible to flash the window with a caption and/or taskbar button.

    Another code sample shows how to enumerate handles for the child windows of the main VFP window. Apply the FlashWindowEx to any of these windows and watch the result.

    * * *
    The FlashWindowManager class shown here once added to C# WinForm project automatically adds FlashWindow and FlashStop extension methods to every form in the project.

    With fairly small changes the FlashWindowManager class can be used with .NET WPF forms.
    public static void FlashWindow(
            this Window window,
            FlashWinFlags flags = FlashWinFlags.FlashAll,
            int count = int.MaxValue,
            nt timeout = 0)
    {
            var windowInteropHelper = new WindowInteropHelper(window);
            FlashWindow(windowInteropHelper.Handle, flags, count, timeout);
    }
    Word Index links for this example:
    Translate this page:
      Spanish    Portuguese    German    French    Italian  
    FreeTranslation.com offers instant, free translations of text or web pages.
    User Contributed Notes:
    There are no notes on this subject.


    Copyright © 2001-2013 News2News, Inc. Before reproducing or distributing any data from this site please ask for an approval from its owner. Unless otherwise specified, this page is for your personal and non-commercial use. The information on this page is presented AS IS, meaning that you may use it at your own risk. Microsoft Visual FoxPro and Windows are trade marks of Microsoft Corp. All other trademarks are the property of their respective owners. 

    Privacy policy
    Credits: PHP (4.4.9), an HTML-embedded scripting language, MySQL (5.1.55-log), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
    Last Topics Visited (54.234.42.16)
    3.28 hrs.Function: 'SQLTables'
     Example: 'GDI+ fun: roach-infested desktop'
    3.7 hrs.Function: 'ShowCursor'
    Function group: 'Cursor'
    Google
    Advertise here!