/// <summary> /// Send a command to Skype /// </summary> /// <param name="command"></param> /// <returns></returns> public static bool SendSkypeMessage(string command) { // Make a new message COPYDATASTRUCT message = new COPYDATASTRUCT() { dwData = "1", lpData = command }; message.cbData = message.lpData.Length + 1; IntPtr result; IntPtr iResult = SendMessageTimeout(HWND_BROADCAST, WM_COPYDATA, hWnd, ref message, SendMessageTimeoutFlags.SMTO_NORMAL, 100, out result); if (iResult.ToInt32() == 0) return false; return true; }
public static extern IntPtr SendMessageTimeout(IntPtr windowHandle, uint Msg, IntPtr wParam, ref COPYDATASTRUCT lParam, SendMessageTimeoutFlags flags, uint timeout, out IntPtr result);