Ignazio Catanzaro

Sviluppatore Software

C# .Net

Archivio Posts
Anno 2012

Anno 2011

Anno 2010
Sondaggio
Introdurre argomenti di software engineering in un blog può essere utile?

Si
No

Start & SIP Icon su dispositivi WM 6.1/6.5

Salve a tutti!

Mi scuso vivamente per la mia assenza ma tra il lavoro e le altre cose il tempo è veramente , veramente poco!

Oggi vi lascio un piccolo tips per le piattaforme Windows Mobile 6.1/6.5, ovvero, gestire la visualizzazione/attivazione dei button "Start" e "SIP" nella taskbar utilizzando alcune API, a voi il codice :D :



namespace Utilies.Mobile
{
public static class SOUtilies
{
[DllImport("coredll.dll", SetLastError = true)]
internal static extern IntPtr GetForegroundWindow();

[DllImport("aygshell.dll", SetLastError = true)]
private static extern bool SHFullScreen(IntPtr hwndRequester, int dwState);

[DllImport("coredll.dll", SetLastError = true)]
private static extern IntPtr FindWindow(string caption, string className);

[DllImport("coredll.dll", SetLastError = true)]
private static extern bool ShowWindow(IntPtr hwnd, int state);

[DllImport("coredll.dll")]
private static extern IntPtr GetWindow(IntPtr hWnd, uint uCmd);


//Impostando IsEnabled a True l'icona start verra disabilitata nel form chiamante.
public static void SetStartIconEnabled(bool IsEnabled)
{
IntPtr foregroundWindow = GetForegroundWindow();

if (IsVisible)
SHFullScreen(foregroundWindow, 16);
else
SHFullScreen(foregroundWindow, 32);
}



//Impostando IsVisible a false l'icona SIP verra nascosta in qualsiasi programma/sezione del sistema operativo
public static void SetSIPIconVisible(bool IsVisible)
{
int VISIBLE;

if (IsVisible == true)
VISIBLE = 1;
else
VISIBLE = 0;

IntPtr hSipWindow = FindWindow("MS_SIPBUTTON", "MS_SIPBUTTON");
if (hSipWindow != IntPtr.Zero)
{
IntPtr hSipButton = GetWindow(hSipWindow, 5);
if (hSipButton != IntPtr.Zero)
{
bool res = ShowWindow(hSipButton, VISIBLE);
}
}
}
}

Categoria: Mobile Application
martedì, 05 apr 2011 Ore. 10.40

Calendario
aprile 2024
lmmgvsd
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345
Ora e Data
Statistiche
  • Views Home Page: 32.304
  • Views Posts: 44.961
  • Views Gallerie: 0
  • n° Posts: 24
  • n° Commenti: 12
Copyright © 2002-2007 - Blogs 2.0
dotNetHell.it | Home Page Blogs
ASP.NET 2.0 Windows 2003