📄 subject_50621.htm
字号:
<p>
序号:50621 发表者:petpet 发表日期:2003-08-25 10:52:00
<br>主题:请问怎么在vc++里调用xp里的cmd的命令啊!?
<br>内容:我想在vc++里调用xp命令提示符下的可以用的好象netsh -f c:\ll.txt这样的命令应该怎么办啊!
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:iamhere 回复日期:2003-08-25 10:55:26
<br>内容:使用ShellExecute,你的情况试试下面的调用:<BR>ShellExecute( NULL , "open" , "netsh" , "-f C:\\ll.txt" , NULL , SW_SHOW );
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:michael 回复日期:2003-08-25 11:03:54
<br>内容:ShellExecuteEx Function<BR><BR>--------------------------------------------------------------------------------<BR><BR>Performs an action on a file. <BR><BR>Syntax<BR><BR>BOOL ShellExecuteEx( LPSHELLEXECUTEINFO lpExecInfo<BR>);<BR>Parameters<BR><BR>lpExecInfo<BR>Address of a SHELLEXECUTEINFO structure that contains and receives information about the application being executed. <BR>Return Value<BR><BR>Returns TRUE if successful, or FALSE otherwise. Call GetLastError for error information. <BR><BR>Remarks<BR><BR>With multiple monitors, if you specify an HWND and set the lpVerb member of lpExecInfo to "Properties", any windows created by ShellExecuteEx may not appear in the correct position. <BR><BR>If the function succeeds, it sets the hInstApp member of the SHELLEXECUTEINFO structure to a value greater than 32. If the function fails, hInstApp is set to the SE_ERR_XXX error value that best indicates the cause of the failure. Although hInstApp is declared as an HINSTANCE for compatibility with 16-bit Microsoft&reg; Windows&reg; applications, it is not a true HINSTANCE. It can only be cast to an int and compared to either 32 or the SE_ERR_XXX error codes.<BR><BR><BR>Note The SE_ERR_XXX error values are provided for compatibility with ShellExecute. To retrieve more accurate error information, use GetLastError. It may return one of the following values:<BR><BR>Error Description <BR>ERROR_FILE_NOT_FOUND The specified file was not found. <BR>ERROR_PATH_NOT_FOUND The specified path was not found. <BR>ERROR_DDE_FAIL The Dynamic Data Exchange (DDE) transaction failed. <BR>ERROR_NO_ASSOCIATION There is no application associated with the given file name extension. <BR>ERROR_ACCESS_DENIED Access to the specified file is denied. <BR>ERROR_DLL_NOT_FOUND One of the library files necessary to run the application can't be found. <BR>ERROR_CANCELLED The function prompted the user for additional information, but the user canceled the request. <BR>ERROR_NOT_ENOUGH_MEMORY There is not enough memory to perform the specified action. <BR>ERROR_SHARING_VIOLATION A sharing violation occurred. <BR><BR><BR>Windows 95/98/Me: ShellExecuteEx is supported by the Microsoft Layer for Unicode. To use this, you must add certain files to your application, as outlined in Microsoft Layer for Unicode on Windows 95/98/Me Systems.<BR><BR>Function Information<BR><BR>Minimum DLL Version shell32.dll version 4.0 or later <BR>Custom Implementation No <BR>Header shellapi.h <BR>Import library shell32.lib <BR>Minimum operating systems Windows NT 4.0, Windows 95 <BR><BR> 摘自MSDN
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -