This article has been archived. It is offered "as is" and will no longer be updated.
When hosting the Internet Explorer 4.0x WebBrowser control, it is possibleto move the control to both virtual and file folders on the user'slocal computer. These are folders such as the desktop and My Computer. Theproblem is that when the user opens a folder in the control, a new InternetExplorer window is opened to display the contents of the selected folder.This might not always be the desired behavior.
To solve this problem, the host application must respond to and handle aDynamic Data Exchange (DDE) conversation that is initiated by the controlwhen the control calls ShellExecuteEx. WebApp.exe is a sample applicationthat hosts the Internet Explorer 4.0x WebBrowser control that is initiallyset to the user's desktop. It demonstrates how to establish the DDEconversation, get the DDE command string, parse the DDE command string, andaccess and free the PIDL that is included in the DDE command. It alsohandles the special cases described in the MORE INFORMATION section.
The following file is available for download from the Microsoft Download Center:
For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:
119591 How to Obtain Microsoft Support Files from Online Services
Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file.For folders that exist in the file system, the path name can be retrievedfrom the DDE command and the WebBrowser control can be moved to the newfolder by name. However, with virtual folders (such as My Computer), thereis no path contained in the DDE command. In these cases, you need tomove the control to an ITEMIDLIST pointer (PIDL), which is alsoincluded in the DDE command.
The host application is always responsible for freeing the PIDL, whether afolder name is included or not. This PIDL is created in shared memory bythe shell so that the PIDL can be used between different processes. Becauseof this, you need to use special functions to access and free the PIDL.Unfortunately, these functions are not public and must be loaded by ordinalnumber.
There are two other special cases that you also need to consider. The firstis when the user selects Explore instead of Open. In this case, the hostapplication will not know the actual command until the DDE conversation hasalready been established. By this time, it is too late to allow the DDEconversation to be handled by the default shell implementation. To workaround this, the host application must call ShellExecuteEx itself to getthe default behavior. While doing this, it must prevent itself fromresponding the new DDE conversation.
The second special case that you must handle is when another applicationcalls ShellExecuteEx to navigate to a folder. This can happen if the userSelects Run from the Start Menu and types in a folder name, like "C:\".This triggers a call to ShellExecuteEx. In this case, the host applicationmust not respond to the DDE conversation. To avoid this, the hostapplication must only respond to DDE conversations that are being initiatedby a window that is in the same process as the host application. This canbe determined by getting the process ID of the window handle that is passedin the WM_DDE_INITITIATE message. If the window's process ID is not thesame as the host application's process ID, the host application shouldsimply return 0 from the WM_DDE_INITITIATE message.