Method for opening a file & shellexecuteinfo Structure

Source: Internet
Author: User

How to open a file & shellexecuteinfo structure favorites
How to open a file

Void cmainframe: execfile (cstring & strfile)
{
Shellexecuteinfo shexecinfo = {0 };

Shexecinfo. cbsize = sizeof (shellexecuteinfo );
Shexecinfo. fmask = see_mask_nocloseprocess;
Shexecinfo. hwnd = NULL;
Shexecinfo. lpverb = NULL;
Shexecinfo. lpfile = (lpcstr) strfile;
Shexecinfo. lpparameters = "";
Shexecinfo. lpdirectory = NULL;
Shexecinfo. nshow = sw_show;
Shexecinfo. hinstapp = NULL;

Shellexecuteex (& shexecinfo );
}

The following is the structure of shellexecuteinfo:

Http://kaweh.candy.blog.163.com/blog/static/36818772200827352870/

I am too lazy to sort it out. See the link.

Parameters of the shellexecuteinfo structure. In C ++, its structure is typedef struct _ shellexecuteinfo {DWORD cbsize; ulong fmask; hwnd; lpctstr lpverb; lpctstr lpfile; lpparameters of lpctstr lpdirectory; int nshow; hinstance hinstapp; lpvoid lpidlist; maid; fig; Union {handle hicon; handle hmonitor;} dummyunionname; handle hprocess;} shellexecuteinfo, * lpshellexecuteinfo; in C #, its structure is public struct shellexecuteinfo // used for Shel Lexecuteex {public int cbsize; Public int fmask; Public int hwnd; Public String lpverb; Public String lpfile; Public String lpparameters; Public String lpdirectory; Public int nshow; Public int hinstapp; public int lpidlist; Public String lpclass; Public int hkeyclass; Public int dwhotkey; Public int hicon; Public int hprocess;} parameter description: cbsize stores the length of the structure, in bytes. Fmask is a flag array that is used to set the validity of other members. Ask_no_console 0x8000see_mask_unicode 0x100000see_mask_fileandurl 0x4000000 hwnd call the window handle lpverb of the shellexecuteex to set the action of the shellexecuteex, including: Edit open the editor and edit the document, this function fails to use lpfile as the path to open the resource manager find. From the specified directory, start searching for Open. Open the corresponding file according to lpfile, this file can be an executable file, document, or folder print documents according to lpfile, if lpfile is not a document, the function will fail. properties displays the file or folder attribute lpfile string ending with/0, pointing out the path of the lpverb operation object, the operations supported by the system include open and print operations on the text. Print requires that Registered printer, and other types of documents will be queried and executed through System Association. To set an empty namespace, set the fmask value to see_mask_invokeidlist. NOTE: If see_mask_invokeidlist has been set, you can use lpfile or lpidlist to determine the system path of the item or the parameters for pidl lpparameters to run/open the program. If a document is opened, if this item is invalid, lpdirectory indicates the name of the working directory. If the member has no description, nshow indicates the current directory by default. If the function runs successfully, the value of this item will be greater than 32, otherwise, se_err_fnf does not find the file se_err_pnf, does not find the path, does not deny access to se_err_oom memory insufficiency, and does not find the dynamic link library se_err_share. The file se_err_associncomplete cannot be operated. incomplete se_err_ddetimeout DDE operation exceeds When se_err_ddefail DDE operation fails, se_err_ddebusy DDE busy se_err_noassoc does not find the address of an itemidlist structure associated with the file lpidlist, which is used to store the special identifier of the member, when fmask does not include see_mask_idlist or see_mask_invokeidlist, this option is ignored. The lpclass is used to specify the name or GUID of the file class, when fmask does not include see_mask_classname, this item is ignored. hkeyclass gets handle of the file type registered in the system. When fmask does not include see_mask_classkey, this item is ignored, the virtual key code of the low-level storage, the hotkeyf _ of the High-level storage, and the modifier flags. For a detailed list of the wm_sethotkey messages, see the description of the wm_sethotkey message, when fmask does not include see_mask _ When hotkey is used, dummyunionname hicon is ignored to get the handle of the corresponding file type icon. When fmask does not include see_mask_icon, this item is ignored. hmonitor displays the handle of the document on the display, when fmask does not include see_mask_hmonitor, this item is ignored. hprocess is used for return operations. If fmask is not set to see_mask_nocloseprocess, the value is null, even if fmask is set to see_mask_nocloseprocess, the value is still null. That is, if no new process is started, the value of this item is null.

 

This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/tracekk/archive/2008/06/07/2520420.aspx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.