Handle for ShellExecute () - parent window?

I am trying to use ShellExecute to open a file in Excel. I read about the function on the MSDN forums, and I found the following information about the handle, which is the first parameter:

"hwnd [in] Handle to the owner window used to display the user interface (UI) or error messages. This value may be NULL if the operation is not associated with the window."

I also heard that this is called a handle to the parent window. What is a parent / owner window? As you see below, I use NULL for the descriptor, but since the operation is really related to the window, I probably need a descriptor, but I don’t know what to use for the descriptor.

ShellExecute(NULL, "open" ,"Excel.exe", 
    "C:\\Documents and Settings\\Lab1\\My Documents\\Test.xls", 
    NULL, SW_SHOWNORMAL);
+3
source share
4 answers

This is usually 0

hwnd: the parent window that will receive the possible mailbox. This parameter is usually 0.

This applies to the top-level window: the opened window does not have a parent element and is the main window for the running application.

When you switch between applications (ALT-TAB), you show the next top-level window (the next application with the parent descriptor is 0) in z-order (for example).

Of course, the parent of your application cannot be the desktop window itself :

GetDesktopWindow(), . - MessageBox(), , , , - .

, : " ' ... ' "

"'C:\\Documents and Settings\\Lab1\\My Documents\\Test.xls'"

() : " "" ... "" "

"""C:\\Documents and Settings\\Lab1\\My Documents\\Test.xls"""

.


, Andy Mesidin, ShellExecute .

ShellExecute( NULL, "open", 
              "Test.xls", "C:\\Documents and Settings\\Lab1\\My Documents\\", 
              NULL, SW_SHOWNORMAL);

, Excel .xls.

+2

, " ", , , , . , , - ShellExecute, .

+2

ShellExecuting Excel? OpenOffice.org, - "Open" , "Excel", ShellExecute.

+1

- , ShellExecute?

xls [System.Diagnostics.] Process.Start [ ]
, , .net

0

All Articles