30/07/2025
Windev et les Api WindowsNb de visiteurs en ligne : 2
>> Introduction << >> Codes et Forum << >> Download <<


Rubrique : 1 - Windows Général       Sujet : Barre de tâches
Auteur Message
 °¨¨ JL ¨¨° Posté le : 23/06/2000 12:00:00


// Enlever la fenêtre en cours
// Pour qu'une fenêtre n'apparaisse pas dans la barre de tâches, il faut lui donner le style étendu WS_EX_TOOLWINDOW

GW_EXSTYLE est un entier long = -20
WS_EX_TOOLWINDOW est un entier long = 0x80
{fenencours()}..etat=invisible
appeldll32("user32","SetWindowLongA",handle(),gw_exstyle,WS_EX_TOOLWINDOW)
{fenencours()}..etat=actif


// Masquer la barre
AppelDLL32("User32", "ShowWindow", AppelDLL32("User32", "FindWindowA", "Shell_TrayWnd",null), Faux) // Vrai pour l'afficher


//Masquer la barre de notification
hwndb est un entier long=AppelDLL32("User32", "FindWindowA", "Shell_TrayWnd",null)
hwndbt est un entier long=appeldll32("user32","FindWindowExA",hwndb,null,"TrayNotifyWnd",null)
appeldll32("user32","ShowWindow",hwndbt,0)


//Masquer le bouton Démarrer
hwndb est un entier long=AppelDLL32("User32", "FindWindowA", "Shell_TrayWnd",null)
hwndbt est un entier long=appeldll32("user32","FindWindowExA",hwndb,null,"Button",null)
appeldll32("user32","ShowWindow",hwndbt,0)


//Masquer l'horloge
hwndb est un entier long=AppelDLL32("User32", "FindWindowA", "Shell_TrayWnd",null)
hwndbt est un entier long=appeldll32("user32","FindWindowExA",hwndb,null,"TrayNotifyWnd",null)
hwndclock est un entier long=appeldll32("user32","FindWindowExA",hwndbt,null,"TrayClockWClass",null)
appeldll32("user32","ShowWindow",hwndclock,0)

//Masquer ou afficher la partie affichant les programmes en cours
hwndtray est un entier long=AppelDLL32("User32", "FindWindowA", "Shell_TrayWnd",null)
hwndtraychild est un entier long=appeldll32("user32","FindWindowExA",hwndtray,null,"RebarWindow32",null)
si hwndtraychild alors
    hwndtraychild =appeldll32("user32","FindWindowExA",hwndtraychild ,null,"MSTaskSwWclass",null)
    si hwndtraychild alors
        hwndtraychild =appeldll32("user32","FindWindowExA",hwndtraychild ,null,"SysTabControl32",null)
        si appeldll32("user32","IsWindowVisible",hwndtraychild) alors
            appeldll32("user32","ShowWindow",hwndtraychild,0)
        sinon
            appeldll32("user32","ShowWindow",hwndtraychild,1)
        fin
    fin
fin



//Iconiser l'application dans le systray

//A l'ouverture de la fenêtre

Global

numev est un entier long

IconeT est compose de
    cbSize est un entier long
    hWnd est un entier Long
    uID est un entier long
    uFlags est un entier long
    uCallbackMessage est un entier long
    Icon est un entier long
    szTip est une chaine asciiz de 64
fin

HIcon est un entier long
lpIconName est une chaine asciiz sur 100

// *****************************************
lpIconName="c:WdprojetImpEcrampoule-.ico"
// *****************************************

HIcon = AppelDLL32("user32","LoadImageA" ,instance(),&lpIconName,1,16,16,16)
si hicon alors
    IconeT.cbSize = dimension(iconet)
    IconeT.hWnd = handle()
    IconeT.uID = 50
    IconeT.uFlags = 7
    IconeT.uCallbackMessage = 0x8000
    IconeT.Icon = hicon
    IconeT.szTip = "Clic Droit pour afficher le Menu."

    // creation icone dans systemtray
    appeldll32("shell32.dll","Shell_NotifyIconA",0,&iconet)

    // supprime l'icone charge en memoire
    AppelDLL32("user32","DestroyIcon" , hIcon)

    // rend la fenetre invisible apres avoir insérer l'icone
    fenetat(fenencours(),invisible)
sinon
    info("hicon non valide")
fin

numev=evenement("clic_icone","",0x8000)


// A la fermeture de la fenêtre

// supprime l'icone du systemtray
appeldll32("shell32.dll","Shell_NotifyIconA",2,&iconet)

// supprime gestion evenements
finevenement(numev)


// La procédure clic_icone :  

Procédure clic_icone()

// Si vous voulez créer un menu et l'afficher, vous pouvez le faire içi..
si _EVE.lParam=0x204 alors // clic droit pour afficher la fenêtre
    fenetat(fenencours(),actif)
fin
si _EVE.lParam=0x201 alors // clic gauche pour la rendre invisible
    fenetat(fenencours(),invisible)
fin