Results 1 to 5 of 5

Thread: [RESOLVED] "Method 'ShowOpen' of object 'ICommonDialog' failed"

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2003
    Posts
    1,945

    Resolved [RESOLVED] "Method 'ShowOpen' of object 'ICommonDialog' failed"

    Whenever I try to open a common dialog box using the ShowOpen method, I get the following error:

    Run-time error '32765':

    Method 'ShowOpen' of object 'ICommonDialog' failed
    After doing some searching (with Google and the MSDN search feature) I found out that the cmdlg32.hlp help file, MSDN and a few other websites all provide this very helpful piece of information:

    cdlInitialization &H&H7FFD
    & The function failed during initialization
    This is what I found out myself:
    -This error does not occur while running under Microsoft Windows 98.
    -Reinstalling Visual Basic does not solve the problem.
    -Compatibility mode does not help.
    -Using another version of Comdlg32.ocx does not help.

    I'm pretty much at a loss as to the cause and how to solve it, if any one can help out, it will be appreciated. The file Project1.zip contains some code that reproduces the error.

    btw:
    I'm using the Cmdlg32.ocx activeX control version 6.0.84.18.

    EDIT:
    New information added.
    Last edited by Peter Swinkels; Aug 3rd, 2006 at 09:34 AM.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: "Method 'ShowOpen' of object 'ICommonDialog' failed"

    The only thing in your attachment is a .bas module.

    Are you not using any forms with this?

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2003
    Posts
    1,945

    Re: "Method 'ShowOpen' of object 'ICommonDialog' failed"

    No, I'm not using forms. Therefore I need to access the common dialog box in a different way than you would otherwise do. But, I think it's highly unlikely that this is the cause of my problem, the code works fine under Windows 98. Although I will admit that the common dialog control does work when using it inside a form.

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2003
    Posts
    1,945

    Re: "Method 'ShowOpen' of object 'ICommonDialog' failed"

    Here is some information produced by Microsoft Dependency Walker: http://www.euronet.nl/users/swinkels/procsort.dwi

    Hopefully some one can make sense of all that information, and tell me something about what is causing the error described in my message above.
    Last edited by Peter Swinkels; Dec 30th, 2006 at 03:45 PM.

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2003
    Posts
    1,945

    Re: "Method 'ShowOpen' of object 'ICommonDialog' failed"

    I solved the problem by opening the common dialog box using the API.

    Here is some example code:
    Code:
    Option Explicit
    
    'The open file dialog information.
    Private Type OPENFILENAME
     lStructSize As Long
     hwndOwner As Long
     hInstance As Long
     lpstrFilter As String
     lpstrCustomFilter As String
     nMaxCustomFilter As Long
     nFilterIndex As Long
     lpstrFile As String
     nMaxFile As Long
     lpstrFileTitle As String
     nMaxFileTitle As Long
     lpstrInitialDir As String
     lpstrTitle As String
     flags As Long
     nFileOffset As Integer
     nFileExtension As Integer
     lpstrDefExt As String
     lCustData As Long
     lpfnHook As Long
     lpTemplateName As String
    End Type
    
    'The common dialog flag constants.
    Private Const cdlOFNAllowMultiselect As Long = &H200
    Private Const cdlOFNExplorer As Long = &H80000
    Private Const cdlOFNHideReadOnly As Long = &H4
    Private Const cdlOFNFileMustExist As Long = &H1000
    Private Const cdlOFNLongNames As Long = &H200000
    Private Const cdlOFNPathMustExist As Long = &H800
    
    'Some Microsoft Windows API's used by Procedure Sorter.
    Private Declare Function CommDlgExtendedError Lib "Comdlg32.dll" () As Long
    Private Declare Function GetOpenFileNameA Lib "Comdlg32.dll" (lpofn As OPENFILENAME) As Long
    
    Sub Main()
    Dim Dialog As OPENFILENAME
    
    Dialog.lStructSize = Len(Dialog)
    GetOpenFileNameA Dialog
    End Sub
    The above code works without forms. Initially I got the same error as described in my earlier posts when using the API. I don't know exactly how, but I got it to work now.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width