⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 subject_51703.htm

📁 vc
💻 HTM
字号:
<p>
序号:51703 发表者:James 发表日期:2003-09-03 15:56:12
<br>主题:一个菜菜问题!
<br>内容:给定一个文件的路径名称,如何让这个文件所在的系统窗口弹出啊!?<BR>
<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>回复者:BenDan 回复日期:2003-09-03 16:05:01
<br>内容:&nbsp;&nbsp;&nbsp;&nbsp;CString sPath=&#34;c:\\pub&#34;;<BR>&nbsp;&nbsp;&nbsp;&nbsp;::ShellExecute(NULL,&#34;explore&#34;,sPath,NULL,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>
回复者:goldenfaith 回复日期:2003-09-03 16:46:56
<br>内容:要弹出,ShellExecute的第二个参数该用&#34;open&#34;吧<BR>explore是做什么的?
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:BenDan 回复日期:2003-09-03 16:58:40
<br>内容:ShellExecute<BR>Performs an operation on a specified file. <BR><BR><BR><BR>HINSTANCE ShellExecute(<BR>&nbsp;&nbsp;&nbsp;&nbsp;HWND hwnd, <BR>&nbsp;&nbsp;&nbsp;&nbsp;LPCTSTR lpOperation,<BR>&nbsp;&nbsp;&nbsp;&nbsp;LPCTSTR lpFile, <BR>&nbsp;&nbsp;&nbsp;&nbsp;LPCTSTR lpParameters, <BR>&nbsp;&nbsp;&nbsp;&nbsp;LPCTSTR lpDirectory,<BR>&nbsp;&nbsp;&nbsp;&nbsp;INT nShowCmd<BR>);<BR><BR>Parameters<BR>hwnd <BR>[in] Handle to a parent window. This window receives any message boxes that an application produces, such as error reporting. <BR>lpOperation <BR>[in] Pointer to a null-terminated string, referred to in this case as a verb, that specifies the action to be performed. The set of available verbs depends on the particular file or folder. Generally, the actions available from an object's shortcut menu are available verbs. For more information about verbs and their availability, see Object Verbs. See Extending Shortcut Menus for further discussion of shortcut menus. The following verbs are commonly used. <BR><BR>Verb Description <BR>edit&nbsp;&nbsp;Launches an editor and opens the document for editing. If lpFile is not a document file, the function will fail. <BR>explore Explores the folder specified by lpFile.&nbsp;&nbsp;<BR>find Initiates a search starting from the specified directory. <BR>open&nbsp;&nbsp;Opens the file specified by the lpFile parameter. The file can be an executable file, a document file, or a folder. <BR>print&nbsp;&nbsp;Prints the document file specified by lpFile. If lpFile is not a document file, the function will fail. <BR><BR>If you set this parameter to NULL:<BR><BR>For systems prior to Microsoft&amp;reg; Windows&amp;reg; 2000, the default verb is used if it is valid and available in the registry. If not, the &#34;open&#34; verb is used. <BR>For Windows 2000 and later systems, the default verb is used if available. If not, the &#34;open&#34; verb is used. If neither verb is available, the system uses the first verb listed in the registry. <BR>lpFile <BR>[in] Pointer to a null-terminated string that specifies the file or object on which to execute the specified verb. To specify a Shell namespace object, pass the fully-qualified parse name. Note that not all verbs are supported on all objects. For example, not all document types support the &#34;print&#34; verb. <BR>lpParameters <BR>[in] If the lpFile parameter specifies an executable file, lpParameters is a pointer to a null-terminated string that specifies the parameters to be passed to the application. The format of this string is determined by the verb that is to be invoked. If lpFile specifies a document file, lpParameters should be NULL. <BR>lpDirectory <BR>[in] Pointer to a null-terminated string that specifies the default directory. <BR>nShowCmd <BR>[in] Flags that specify how an application is to be displayed when it is opened. If lpFile specifies a document file, the flag is simply passed to the associated application. It is up to the application to decide how to handle it. <BR><BR>SW_HIDE&nbsp;&nbsp;Hides the window and activates another window. <BR>SW_MAXIMIZE&nbsp;&nbsp;Maximizes the specified window. <BR>SW_MINIMIZE&nbsp;&nbsp;Minimizes the specified window and activates the next top-level window in the z-order. <BR>SW_RESTORE&nbsp;&nbsp;Activates and displays the window. If the window is minimized or maximized, Windows restores it to its original size and position. An application should specify this flag when restoring a minimized window. <BR>SW_SHOW&nbsp;&nbsp;Activates the window and displays it in its current size and position.&nbsp;&nbsp;<BR>SW_SHOWDEFAULT&nbsp;&nbsp;Sets the show state based on the SW_ flag specified in the STARTUPINFO structure passed to the CreateProcess function by the program that started the application. An application should call ShowWindow with this flag to set the initial show state of its main window. <BR>SW_SHOWMAXIMIZED&nbsp;&nbsp;Activates the window and displays it as a maximized window. <BR>SW_SHOWMINIMIZED&nbsp;&nbsp;Activates the window and displays it as a minimized window. <BR>SW_SHOWMINNOACTIVE&nbsp;&nbsp;Displays the window as a minimized window. The active window remains active. <BR>SW_SHOWNA&nbsp;&nbsp;Displays the window in its current state. The active window remains active. <BR>SW_SHOWNOACTIVATE&nbsp;&nbsp;Displays a window in its most recent size and position. The active window remains active. <BR>SW_SHOWNORMAL&nbsp;&nbsp;Activates and displays a window. If the window is minimized or maximized, Windows restores it to its original size and position. An application should specify this flag when displaying the window for the first time. <BR><BR>Return Values<BR>Returns a value greater than 32 if successful, or an error value that is less than or equal to 32 otherwise. The following table lists the error values. The return value is cast as an HINSTANCE for backward compatibility with 16-bit Microsoft&amp;reg; Windows&amp;reg; applications. It is not a true HINSTANCE, however. The only thing that can be done with the returned HINSTANCE is to cast it to an integer and compare it with the value 32 or one of the error codes below.<BR><BR>0&nbsp;&nbsp;The operating system is out of memory or resources. <BR>ERROR_FILE_NOT_FOUND&nbsp;&nbsp;The specified file was not found. <BR>ERROR_PATH_NOT_FOUND&nbsp;&nbsp;The specified path was not found. <BR>ERROR_BAD_FORMAT&nbsp;&nbsp;The .exe file is invalid (non-Win32&amp;reg; .exe or error in .exe image). <BR>SE_ERR_ACCESSDENIED&nbsp;&nbsp;The operating system denied access to the specified file.&nbsp;&nbsp;<BR>SE_ERR_ASSOCINCOMPLETE&nbsp;&nbsp;The file name association is incomplete or invalid. <BR>SE_ERR_DDEBUSY&nbsp;&nbsp;The DDE transaction could not be completed because other DDE transactions were being processed. <BR>SE_ERR_DDEFAIL&nbsp;&nbsp;The DDE transaction failed. <BR>SE_ERR_DDETIMEOUT&nbsp;&nbsp;The DDE transaction could not be completed because the request timed out. <BR>SE_ERR_DLLNOTFOUND&nbsp;&nbsp;The specified dynamic-link library was not found.&nbsp;&nbsp;<BR>SE_ERR_FNF&nbsp;&nbsp;The specified file was not found.&nbsp;&nbsp;<BR>SE_ERR_NOASSOC&nbsp;&nbsp;There is no application associated with the given file name extension. This error will also be returned if you attempt to print a file that is not printable. <BR>SE_ERR_OOM&nbsp;&nbsp;There was not enough memory to complete the operation. <BR>SE_ERR_PNF&nbsp;&nbsp;The specified path was not found. <BR>SE_ERR_SHARE&nbsp;&nbsp;A sharing violation occurred. <BR><BR>Remarks<BR>This method allows you to execute any commands in a folder's shortcut menu or stored in the registry. <BR><BR>To open a folder, use either of the following calls: <BR><BR>ShellExecute(handle, NULL, path_to_folder, NULL, NULL, SW_SHOWNORMAL);<BR><BR>or <BR><BR>ShellExecute(handle, &#34;open&#34;, path_to_folder, NULL, NULL, SW_SHOWNORMAL);<BR><BR>To explore a folder, use: <BR><BR>ShellExecute(handle, &#34;explore&#34;, path_to_folder, NULL, NULL, SW_SHOWNORMAL);<BR><BR>To launch the Shell's Find utility for a directory, use:<BR><BR>ShellExecute(handle, &#34;find&#34;, path_to_folder, NULL, NULL, 0);<BR><BR>If lpOperation is NULL, the function opens the file specified by lpFile. If lpOperation is &#34;open&#34; or &#34;explore&#34;, the function will attempt to open or explore the folder. <BR><BR>To obtain information about the application that is launched as a result of calling ShellExecute, use ShellExecuteEx. <BR><BR>Windows 95/98/Me: ShellExecute 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>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:泽心 回复日期:2003-09-03 17:09:07
<br>内容:hehe ,竟然拷这么多……<BR><BR>bendan的回复已经能拿分了……
<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 + -