Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Flashing title bar
Message
 
À
05/09/2005 10:45:49
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01046787
Message ID:
01046906
Vues:
21
>
>1. Can I make my title bar flash, especially when minimised something like what happens in MSN.
>

Here is a ready VFP-Function I use in my private API-Class. This allows all flash-Options being transferred as parameters.
    #DEFINE FLASHWINFO_STRU_SIZE 20   && Größe der Struktur
    #DEFINE FLASHW_STOP 0             && Stop Flashing, wenn zuvor mit FLASHW_TIMER
                                      && aufgerufen
    #DEFINE FLASHW_CAPTION 1          && Flash die WindowCaption
    #DEFINE FLASHW_TRAY 2             && Flash den Taskbar - Button
    #DEFINE FLASHW_ALL BitOr(FLASHW_CAPTION, FLASHW_TRAY) && Taskbar + Caption
    #DEFINE FLASHW_TIMER 4             && Flash continuously until called with STOP
    #DEFINE FLASHW_TIMERNOFG 12        && Flash continuously until Window comes to foreground


    *=========================================================
    *
    *         PROCEDURE: FlashWindowEx             
    *
    *=========================================================
    PROCEDURE FlashWindowEx             
    *  Created...........:  25.September 2004, 18:15 Uhr
    *  Changed...........:   
    *  Description.......:  Flash the Window in the Taskbar
    *  Calling Samples...:  ? FlashWindowEx(<ExpN>[, <ExpN2>[, <ExpN2>]])
    *  Parameters........:  tnFlashTimes, tnFlashWhat, tnWindowHandle
    *
    *                        tnFlashTimes: 
    *                            -2 = Stop continuous flashing
    *                            -1 = Start continous flashing
    *                             0 = Start continuous flashing until
    *                                 window receives focus
    *
    *                        tnFlashWhat
    *                             0 = Taskbar-Button + Caption
    *                             1 = Taskbar-Button 
    *                             2 = WindowCaption
    *
    *  Returns...........:  boolean
    lparameters    tnFlashTimes, tnFlashWhat, tnWindowHandle

    *-- typedef struct 
    *--  {  
    *--     UINT cbSize;            && Größe der Struktur -> 5*DWord = 5*4 = 20  
    *--     HWND hwnd;              && Window-Handle
    *--     DWORD dwFlags;          && FlashFlags, wie oft, was
    *--     UINT uCount;              && Number of times to flash the window
    *--     DWORD dwTimeout;        && Timeout zwischen den Flashs in ms, wenn 0, 
    *--  } FLASHWINFO,                 && dann ist es die CursorBlinkRate
    *--  *PFLASHWINFO;


    tnFlashTimes       = iif(vartype(tnFlashTimes) = "N", tnFlashTimes, 0)
    tnFlashWhat        = iif(vartype(tnFlashWhat) = "N", tnFlashWhat, 3)
    tnWindowHandle     = iif(vartype(tnWindowHandle) = "N", tnWindowHandle, _vfp.hWnd)

    LOCAL hWindow, pfwi, lnFlags, lnTimes, lnInterval 
    
    DECLARE INTEGER FlashWindowEx IN user32 STRING @pfwi 
    *DECLARE INTEGER GetActiveWindow IN user32 
    
    hWindow        = tnWindowHandle
    lnInterval     = 0 && default cursor blink rate applied 
    lnTimes        = 0 && flash how many times?

    *-- Aufbauen der Optionen je nach Parameter
    lnFlags        = 0
    
    *-- Was soll flashen
    do case 
    case tnFlashWhat = 1  && TaskBarButton
        lnFlags = lnFlags + FLASHW_TRAY
    case tnFlashWhat = 2  && Caption
        lnFlags = lnFlags + FLASHW_CAPTION
    other
        lnFlags = lnFlags + FLASHW_ALL
    endcase
    
    *-- wie lange flashen
    do case 
    case tnFlashTimes = -2    && STOP
        lnFlags = lnFlags + FLASHW_STOP
        
    case tnFlashTimes = -1  && START until Stop
        lnFlags = lnFlags + FLASHW_TIMER
    
    case tnFlashTimes = 0    && Start until Activate
        lnFlags = lnFlags + FLASHW_TIMERNOFG  && NOFG => NoForeground
    
    other
        lnTimes = tnFlashTimes
    endcase

    pfwi = This.Num2dword(FLASHWINFO_STRU_SIZE) +; 
    This.Num2dword(hWindow) +; 
    This.Num2dword(lnFlags) +; 
    This.Num2dword(lnTimes) +; 
    This.Num2dword(lnInterval) 

    = FlashWindowEx (@pfwi)         
    
    clear dlls FlashWindowEx
    
    return .T.
    *-- eop FlashWindowEx
while Num2DWord is
    #DEFINE Byte1	     1		&& 2^ 0
    #DEFINE Byte2      256 		&& 2^ 8
    #DEFINE Byte3    65536 		&& 2^16
    #DEFINE Byte4 16777216 		&& 2^24


    *=========================================================
    *
    *         PROCEDURE: Num2DWord             
    *
    *=========================================================
    PROCEDURE Num2DWord             
    *  Created...........:  25.September 2004, 18:12 Uhr
    *  Changed...........:   
    *  Description.......:  Umwandlung eines numerischen Wertes in ein DWord (string). 
    *                        Liefert das gleiche Ergebnis wie Long2String
    *  Calling Samples...:  ? Num2DWord(<ExpN>)
    *  Parameters........:  tnValue
    *  Returns...........:  String (dWord) = String with a length of four bytes
    lparameters    tnValue

    LOCAL b0, b1, b2, b3 
    b3 = Int(tnValue / Byte4) 
    b2 = Int((tnValue - b3*Byte4) / Byte3) 
    b1 = Int((tnValue - b3*Byte4 - b2*Byte3) / Byte2) 
    *-- Konsequenterweise müßte die letzte Zeile heißen:
    *-- b0 = int((tnValue - b3*Byte4 - b2*Byte3 - b1*Byte2) / Byte1)
    *-- Byte1 ist aber 1, daher die Division überflüssig
    *-- der Ausdruck in Mod() entspricht dem Klammerausdruck oben
    b0 = Mod(tnValue, Byte2) 
    RETURN Chr(b0)+Chr(b1)+Chr(b2)+Chr(b3) 
    *-- eop Num2DWord
>
> 2. Can I change the colour of my title bar depending on some parameters like User Level or any other.
>

As already said that is done by the Windows color shemes. If You like that, Each user could have its Windows color scheme. Or You'd have to create Your own forms class that does not use the standard title bar. You'd have to do something with the _screen too.

HTH
Regards from Berlin

Frank

Dietrich Datentechnik (Berlin)
Softwarekombinat Teltow (Teltow)

Frank.Dietrich@dd-tech.de
DFPUG # 327
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform