public static int SendMessageToMainWindow(int Msg, int wParam, ref MyLParam lParam) { if (MainWindowPtr == IntPtr.Zero) { HwndSource hwndSource = PresentationSource.FromVisual(Application.Current.MainWindow) as HwndSource; MainWindowPtr = hwndSource.Handle; } return(SendMessage(MainWindowPtr, Msg, wParam, ref lParam)); }
public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, ref MyLParam lParam);