Trouver une ressource (Nouvelle version du moteur, plus rapide & pertinent, essayez le !)
Vous ne trouvez pas de réponse à votre problème ? Alors posez la question dans le forum.
Souvenez-vous qu'il n'y a jamais de question bête, mais rester dans l'ignorance parce que l'on n'ose pas poser une question, ça c'est une erreur !
MASQUER, AFFICHER LA BARRE DE MENU
Information sur la source
Description
Voici 2 methodes pour Masquer ou Afficher la barre de menu. Pourquoi cette source? Tout simplement car cela fait un moment que je cherche à masquer ma barre de menu, et que j'ai mis un peu de temps avant de trouvé la solution. Je met 2 methodes selon les gouts de chacun mais aussi selon les pda (j'en est 2 qui ne réagissent pas exectement pareil). En esperant que cela vous seras utile.
Source
- Première Methode
- ---------------------------------------------------------------------------------------------------
- public static class pdaTaskBar
- {
- [DllImport("Coredll.dll", EntryPoint = "FindWindow")]
- private static extern System.IntPtr FindWindow(string lpClassName, string lpWindowName);
-
- [DllImport("Coredll.dll", EntryPoint = "SetWindowPos", SetLastError = true)]
- private static extern bool SetWindowPos(System.IntPtr IntPtr, System.IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, int uFlags);
-
- const int TASKBAR_SHOW = 0x40;
- const int TASKBAR_HIDE = 0x64;
-
- public static void HideTaskbar()
- {
- IntPtr taskBarHandle;
- taskBarHandle = FindWindow("HHTaskBar", "");
- SetWindowPos(taskBarHandle, IntPtr.Zero, 0, 0, 0, 0, TASKBAR_HIDE);
- }
- public static void ShowTaskbar()
- {
- IntPtr taskBarHandle;
- IntPtr HWND_TOPMOST = new IntPtr(-1);
-
- taskBarHandle = FindWindow("HHTaskBar", "");
- SetWindowPos(taskBarHandle, HWND_TOPMOST, 0, 295, 240, 25, TASKBAR_SHOW);
-
- //Pourrait eventuellement fonctionner
- //IntPtr taskBarHandle;
- //taskBarHandle = FindWindow("shell_traywnd", "");
- //SetWindowPos(taskBarHandle, IntPtr.Zero, 0, 0, 0, 0, TASKBAR_SHOW);
- }
- }
- ---------------------------------------------------------------------------------------------------
- Seconde Methode
-
- public static class pdaTaskVisibility
- {
-
- private const int SW_HIDE = 0x00;
-
- private const int SW_SHOW = 0x0001;
-
- [DllImport("coredll.dll", CharSet = CharSet.Auto)]
-
- private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
-
- [DllImport("coredll.dll", CharSet = CharSet.Auto)]
-
- private static extern bool ShowWindow(IntPtr hwnd, int nCmdShow);
-
- [DllImport("coredll.dll", CharSet = CharSet.Auto)]
-
- private static extern bool EnableWindow(IntPtr hwnd, bool enabled);
-
- public static void ShowTaskbar()
- {
-
- IntPtr h = FindWindow("HHTaskBar", "");
-
- ShowWindow(h, SW_SHOW);
-
- EnableWindow(h, true);
-
- }
- public static void HideTaskbar()
- {
-
- IntPtr h = FindWindow("HHTaskBar", "");
-
- ShowWindow(h, SW_HIDE);
-
- EnableWindow(h, false);
-
- }
- }
- ---------------------------------------------------------------------------------------------------
Première Methode
---------------------------------------------------------------------------------------------------
public static class pdaTaskBar
{
[DllImport("Coredll.dll", EntryPoint = "FindWindow")]
private static extern System.IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("Coredll.dll", EntryPoint = "SetWindowPos", SetLastError = true)]
private static extern bool SetWindowPos(System.IntPtr IntPtr, System.IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, int uFlags);
const int TASKBAR_SHOW = 0x40;
const int TASKBAR_HIDE = 0x64;
public static void HideTaskbar()
{
IntPtr taskBarHandle;
taskBarHandle = FindWindow("HHTaskBar", "");
SetWindowPos(taskBarHandle, IntPtr.Zero, 0, 0, 0, 0, TASKBAR_HIDE);
}
public static void ShowTaskbar()
{
IntPtr taskBarHandle;
IntPtr HWND_TOPMOST = new IntPtr(-1);
taskBarHandle = FindWindow("HHTaskBar", "");
SetWindowPos(taskBarHandle, HWND_TOPMOST, 0, 295, 240, 25, TASKBAR_SHOW);
//Pourrait eventuellement fonctionner
//IntPtr taskBarHandle;
//taskBarHandle = FindWindow("shell_traywnd", "");
//SetWindowPos(taskBarHandle, IntPtr.Zero, 0, 0, 0, 0, TASKBAR_SHOW);
}
}
---------------------------------------------------------------------------------------------------
Seconde Methode
public static class pdaTaskVisibility
{
private const int SW_HIDE = 0x00;
private const int SW_SHOW = 0x0001;
[DllImport("coredll.dll", CharSet = CharSet.Auto)]
private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("coredll.dll", CharSet = CharSet.Auto)]
private static extern bool ShowWindow(IntPtr hwnd, int nCmdShow);
[DllImport("coredll.dll", CharSet = CharSet.Auto)]
private static extern bool EnableWindow(IntPtr hwnd, bool enabled);
public static void ShowTaskbar()
{
IntPtr h = FindWindow("HHTaskBar", "");
ShowWindow(h, SW_SHOW);
EnableWindow(h, true);
}
public static void HideTaskbar()
{
IntPtr h = FindWindow("HHTaskBar", "");
ShowWindow(h, SW_HIDE);
EnableWindow(h, false);
}
}
---------------------------------------------------------------------------------------------------
Conclusion
Pour la seconde methode il y a un petit effet graphique qui donne l'impression que la barre de menu arrive du fond de l'écran. Second point. Si l'on cache la barre avec la methode 2 on peut la reafficher avec la methode 1 mais l'inverse n'est pas vrai.
Historique
- 22 août 2006 13:07:17 :
- corrections syntaxique
Sources de la même categorie
Commentaires
Discussions en rapport avec ce code source
|
CalendriCode
| | | L | M | M | J | V | S | D |
| | | | | 1 | 2 | 3 |
| 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| 25 | 26 | 27 | 28 | 29 | 30 | 31 |
|
Téléchargements
Logiciels à télécharger sur le même thème :
|