A
Anand Ganesh
Hello Everybody,
I am writing a Windows Application to control Windows Media Player which is
required in my project.
I am sending the following code to "Pause" or "Play" the video file in
Windows Media Player. This is equivalent to pressent "Control-P".
For some reason my SendMessage Command is not working. Any suggestions
please?
Thanking you for your time.
Regards
Anand Ganesh
Here is my code
public class Win32
{
[DllImport("User32.dll")]
public static extern Int32 FindWindow(String lpClassName, String
lpWindowName);
[DllImport("User32.dll")]
public static extern UInt32 SendMessage(IntPtr hWnd, UInt32 Msg, UInt32
wParam, UInt32 lParam);
}
private void button1_Click(object sender, EventArgs e)
{
System.Diagnostics.Process[] TheProcessList =
System.Diagnostics.Process.GetProcesses();
foreach (System.Diagnostics.Process EachProcess in TheProcessList)
{
string theProcessName = EachProcess.ProcessName.ToString();
if (theProcessName.ToUpper() == "WMPLAYER")
{
MessageBox.Show("Found Media Player");
uint retval1 = Win32.SendMessage(EachProcess.Handle, 0x100, 0x32, 0x2E631);
uint retval2 = Win32.SendMessage(EachProcess.Handle, 0x101, 0x32, 0x2E631);
}
}
}
I am writing a Windows Application to control Windows Media Player which is
required in my project.
I am sending the following code to "Pause" or "Play" the video file in
Windows Media Player. This is equivalent to pressent "Control-P".
For some reason my SendMessage Command is not working. Any suggestions
please?
Thanking you for your time.
Regards
Anand Ganesh
Here is my code
public class Win32
{
[DllImport("User32.dll")]
public static extern Int32 FindWindow(String lpClassName, String
lpWindowName);
[DllImport("User32.dll")]
public static extern UInt32 SendMessage(IntPtr hWnd, UInt32 Msg, UInt32
wParam, UInt32 lParam);
}
private void button1_Click(object sender, EventArgs e)
{
System.Diagnostics.Process[] TheProcessList =
System.Diagnostics.Process.GetProcesses();
foreach (System.Diagnostics.Process EachProcess in TheProcessList)
{
string theProcessName = EachProcess.ProcessName.ToString();
if (theProcessName.ToUpper() == "WMPLAYER")
{
MessageBox.Show("Found Media Player");
uint retval1 = Win32.SendMessage(EachProcess.Handle, 0x100, 0x32, 0x2E631);
uint retval2 = Win32.SendMessage(EachProcess.Handle, 0x101, 0x32, 0x2E631);
}
}
}