
Thejuster (Member)
Guru^2
    
Messaggi: 1810
Iscritto: 04/05/2008
|
qui trovi un mio progetto vecchiotto con delle funzioni per manipolare finestre attive con il relativo handle, e anche con funzione per ricercare un relativo handles di una finestra, e molto altro materiale utile.
http://www.pierotofy.it/pages/projects/project.php?id=518
se vuoi solo quella funzione te la illustro,
e situata nel progetto stesso
Codice sorgente - presumibilmente C# / VB.NET |
/// <summary>
/// Funzione Usata per trovare l'handle
/// </summary>
/// <param name="ZeroOnly">Parametro statico di base</param>
/// <param name="lpWindowName">Nome della finestra</param>
/// <returns>Restituisce il valore</returns>
[DllImport("user32.dll", EntryPoint = "FindWindow", SetLastError = true)]
static extern IntPtr FindWindowByCaption(IntPtr ZeroOnly, string lpWindowName);
/// <summary>
/// Cerca l'handle di un applicazione Specificandone il Nome
/// </summary>
/// <param name="ApplicationName">Richiede il nome di un Applicazione</param>
/// <returns>Ritorna l'handles cercato</returns>
public IntPtr FindWindowText(string ApplicationName)
{
IntPtr hWnd = FindWindowByCaption(IntPtr.Zero, ApplicationName);
HandleSearched = hWnd;
return hWnd;
}
|
poi cliccando su un pulsante
Codice sorgente - presumibilmente C# / VB.NET |
private void button1_Click(object sender, EventArgs e)
{
label3.Text = wd.FindWindowText(textBox1.Text).ToString();
}
|
|