PRB: IShellFolder::CreateViewObject() Causes Access Violation

Last reviewed: October 25, 1996
Article ID: Q157247
The information in this article applies to:
  • Microsoft Win32 Software Development Kit (SDK) for Windows 95 4.0
  • Microsoft Win32 Software Development Kit (SDK) for Windows NT 4.0

SYMPTOMS

Calling IShellFolder::CreateViewObject() for a file system folder causes an Access Violation.

CAUSE

Using the file system implementation of IShellFolder::CreateViewObject() results in the shell sending a yet-to-be documented message, the WM_GETISHELLBROWSER message (currently WM_USER+7) to the hWndOwner. The shell assumes the HWND passed in as the owner responds properly to the WM_GETISHELLBROWSER message. If it doesn't, there is an access violation in Shell32.DLL.

RESOLUTION

The shell expects that the hWndOwner will supply the IShellBrowser interface to it in response to the WM_GETISHELLBROWSER message.

For example, if your window is a dialog, the following snippet of code would respond correctly to the message.

   ...
       #ifndef WM_GETISHELLBROWSER
           #define WM_GETISHELLBROWSER (WM_USER+7)
       #endif
   ...
       IShellBrowser *m_psb;
   ...
       BOOL DialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
       {
           switch(uMsg)
           {
   ...
           case WM_GETISHELLBROWSER:
               SetWindowLong(hDlg, DWL_MSGRESULT, (LONG)m_psb);
               break;
   ...

STATUS

Microsoft has confirmed this to be a problem in the products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.


KBCategory: kbprg kbprb
KBSubcategory: UsrShell
Additional reference words: 4.00 kbdsd



THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: October 25, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.