my application is hanged when I send WM_COMMAND
Hello everybody,
I want to implement something like we do it many times,
suppose Media Player is open and playing a music
now for example I want to do this File-->Properties
when I do that,Properties window will open
now I want to implement it in my application exactly
I did as below(with help of this link http://www.codeproject.com/csharp/wmp_pinvoke.asp)
[code]
public const int WM_COMMAND = 0x111;
[DllImport("User32.dll")]
public static extern Int32 SendMessage(int hWnd, int Msg,int wParam, int lParam);
private void button1_Click(object sender, System.EventArgs e)
{
int iHandle=0x00010120;//the handle of Media Player
Form1.SendMessage(iHandle, Form1.WM_COMMAND,0x0000495b, 0x00000000);
//0x0000495b results in showing Properties Window
}
[/code]
But here there is a problem
it nicely open the propertise window but my program is hanged after it
I can get what is the cause of this problem
(I guess SendMessage cant return properly when I use PostMessage instead my application is not hanged but it doesnt work correctly and give me wrong results)
can anybody give me an idea?,
any help is appreciated.
Replies
Know the answer? Post it — somebody with the same question will find it here.