GetOpenFileName in NT

I'm using API to show the Open File... common dialog box. It works fine in Win95/98 but it does nothing on Win NT?
This is my code:


'-----------------------------------
Public Function OpenFileDlg(hWndParent As Long, sFilter As String, sTitle As String, sInitDir As String, lpszFileNameBuf As String, bMustExist As Boolean, Optional sDefExt) As Boolean
    Dim ofn As OPENFILENAME
    Dim sFileName As String
    Dim i As Integer
   
    sFileName = Space(255)
   
'    sInitDir = Space(255)
'    Call GetWindowsDirectory(sInitDir, Len(sInitDir))
    With ofn
        .lStructSize = Len(ofn)
        .hwndOwner = hWndParent
        .hInstance = App.hInstance
        .lpstrFilter = sFilter
        '.lpstrCustomFilter
        '.nMaxCustFilter
        .nFilterIndex = 1
        .lpstrFile = sFileName
        .nMaxFile = Len(sFileName)
        '.lpstrFileTitle
        '.nMaxFileTitle
        .lpstrInitialDir = Trim(sInitDir)
        .lpstrTitle = sTitle
        .FLAGS = OFN_EXPLORER Or OFN_HIDEREADONLY Or OFN_LONGNAMES Or OFN_PATHMUSTEXIST
        If bMustExist Then
            .FLAGS = .FLAGS Or OFN_FILEMUSTEXIST
        End If
        '.nFileOffset
        '.nFileExtension
        If Not IsMissing(sDefExt) Then
            .lpstrDefExt = sDefExt
        End If
        '.lCustData
        '.lpfnHook
        '.lpTemplateName
    End With
    If (GetOpenFileName(ofn) = 0) Then  'Operación Cancelada
        OpenFileDlg = False
    Else
        OpenFileDlg = True
        lpszFileNameBuf = Trim(ofn.lpstrFile)
        i = InStr(1, lpszFileNameBuf, vbNullChar, vbBinaryCompare)
        If i > 0 Then
            lpszFileNameBuf = Trim(Left(lpszFileNameBuf, i - 1))
        Else
            lpszFileNameBuf = Trim(lpszFileNameBuf)
        End If
    End If
End Function
'-----------------------------------

What is wrong with this?

Thanks
LVL 2
trilloAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Erick37Commented:
Try running the example code from MS to see if it will run on your system.

http://support.microsoft.com/support/kb/articles/Q161/2/86.asp
0
trilloAuthor Commented:
Erick37: Please come back and say "hello" as an answer!!
0
Erick37Commented:
"Hello as an answer"
:-)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
trilloAuthor Commented:
Fine!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.