Folge dem Video um zu sehen, wie unsere Website als Web-App auf dem Startbildschirm installiert werden kann.
Anmerkung: Diese Funktion ist in einigen Browsern möglicherweise nicht verfügbar.
[DllImport("user32.dll")]
static extern IntPtr GetForegroundWindow();
[DllImport("user32.dll", CharSet=CharSet.Auto)]
public static extern int GetWindowTextLength(HandleRef hWnd);
[DllImport("user32.dll", CharSet=CharSet.Auto)]
public static extern int GetWindowText(HandleRef hWnd, StringBuilder lpString, int nMaxCount);
String getForegroundTitle()
{
IntPtr ip;
StringBuilder sb;
int i;
try
{
ip = GetForegroundWindow();
if(hr.Handle.Equals(0))
return null;
i = GetWindowTextLength(new HandleRef(this, ip)) * 2;
if(i < 1)
return null;
sb = new StringBuilder(i);
i = GetWindowText(new HandleRef(this, ip), sb, sb.Capacity);
if(i < 1)
return null;
}
catch(Exception) { }
return null;
}
[DllImport("user32.dll")]
static extern IntPtr GetForegroundWindow();
[DllImport("user32.dll", CharSet=CharSet.Auto)]
public static extern int GetWindowTextLength(HandleRef hWnd);
[DllImport("user32.dll", CharSet=CharSet.Auto)]
public static extern int GetWindowText(HandleRef hWnd, StringBuilder lpString, int nMaxCount);
String GetForegroundTitle()
{
IntPtr ip;
StringBuilder sb;
int i;
try
{
ip = GetForegroundWindow();
if(ip.Handle.Equals(0))
return null;
i = GetWindowTextLength(new HandleRef(this, ip)) * 2;
if(i < 1)
return null;
sb = new StringBuilder(i);
i = GetWindowText(new HandleRef(this, ip), sb, sb.Capacity);
if(i < 1)
return null;
}
catch(Exception) { }
return null;
}
private void button1_Click(object sender, EventArgs e)
{
String x;
x = GetForegroundTitle();
if(x != null)
label8.Text = x;
}