我在一个mfc程序中加入如下代码:
ShellExecute(this->GetSafeHwnd(),"open","notepad.exe",NULL,NULL,SW_SHOWNORMAL); //调用可执行文件函数
执行后可以打开记事本. 
我用spy++软件观察,记事本的父进程竟然不是我的程序.
难道第一个参数不对?网上的资料都是如此设置的啊.
我应该怎么弄啊.请高手指点一二~~~,小弟先拜谢了

解决方案 »

  1.   

    HWND
    A handle to the owner window used for displaying a UI or error messages.
      

  2.   

     ShellExecute(NULL,"open","NOTEPAD.EXE",NULL,NULL,SW_SHOWNORMAL); 
      ●hWnd:用于指定父窗口句柄。当函数调用过程出现错误时,它将作为Windows消息窗口的父窗口。例如,可以将其设置为应用程序主窗口句柄,即Application.Handle,也可以将其设置为桌面窗口句柄(用GetDesktopWindow函数获得)。 
      

  3.   

    MSDN上的说明和百度百科上不一样的:
    hwnd
    [in] Handle to the owner window used for displaying a user interface (UI) or error messages. This value can be NULL if the operation is not associated with a window.