怎么获得指定路径的窗口句柄……
比如我放在D盘下的一个文件的句柄,
if(OpenDialog1->Execute())
{
char judgetext{256];
Edit1->Text=ExtractFileName(OpenDialog1->FileName);
ShellExecute(Handle,"open",OpenDialog1->FileName.c_str(),NULL,NULL,SW_SHOW);
hAndle=GetForegroundWindow();
GetWindowText(hAndle, judgetext, 256);
ShowMessage(judgetext);
//PostMessage(hAndle,WM_CLOSE,0,0);
}
我的本意是将那个文件打开,获得前台活动窗口的句柄,保存在judgetext里的。但SHOWMESSAGE里的是空的。请教各位高手。
或者有什么更好的方法?
我是菜鸟。 @_@