[ctrl+alt+del] envoyer l'interruption clavier en code
Bonjour
je cherche un code c# pour envoyer un CTRL+ALT+SUPP en c#
je sais qu'envoyer les touches ne marche pas puisqu'il s'agit d'une interruption clavier
j'ai tenté le postmessage mais ce ne marche pas avec le code suivant
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("user32.dll", SetLastError = true)]
static extern bool PostMessage(long hWnd, uint Msg, IntPtr wParam, int lParam);
public const long HWND_BROADCAST = 0xFFFFFFFF;
public const uint WM_HOTKEY = 0x312;
public const short MOD_ALT = 0x1;
public const short MOD_CONTROL = 0x2;
public const short VK_DELETE = 0x2e;
private void button6_Click(object sender, RoutedEventArgs e)
{
PostMessage(HWND_BROADCAST, WM_HOTKEY, IntPtr.Zero, MakeLong(MOD_ALT | MOD_CONTROL, VK_DELETE));
} //Undocument API.
public int MakeLong(short lowPart, short highPart)
{
return (int)(((ushort)lowPart) | (uint)(highPart << 16));
} |
si vous avez du code ...
merci