DOCERR: Initiating DDE Conversation w/ Instance of Win ExcelLast reviewed: July 22, 1997Article ID: Q29547 |
3.00 3.10
WINDOWS
kbprg kbdocerr
The information in this article applies to:
SUMMARYThe documentation for the EXEC() macro on page 70 of the "Microsoft Excel Function Reference" manual for version 3.0 and on page 138 of the "Microsoft Excel Function Reference" manual for version 4.0 incorrectly refers to its return value as "the Microsoft Windows task ID number of the started program." However, it is not the value returned by the Windows KERNEL routine GetCurrentTask(). EXEC() returns the instance handle to the EXEC()'d application.
MORE INFORMATIONWindows and Excel do not provide an easy way to find out which instance of Excel called the application. However, the correct value can be obtained. The following is a sample macro that uses the REGISTER and CALL functions to obtain the instance handle to the version of Excel that is running. That information then can be passed to the application inside the EXEC call. However, the value in hInstance must be appended as a string for the EXEC call. The following is the text version of the macro sheet:
A | BThis is an example of how to obtain the | instance and then pass that value to the| EXEC'd application: | | =STEP() |Get instance handle of current window. | =REGISTER("USER","GetFocus","H")" | =CALL(A7) | <== hWnd -6 | <==GWW_HINSTANCE=REGISTER("user","GetWindowWord","HHI")"| <==GetInstance =CALL(GetInstance,hWnd,GWW_HINSTANCE)" | <== hInstance =RETURN() | Exec("YourApp.exe hInstance",1)" | NOTE: For Microsoft Excel versions 2.x, the corresponding documentation for the EXEC() macro is on page 275 of the "Microsoft Excel Functions and Macros" manual.
|
Additional reference words: 3.00 3.10
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |