[AccessD] WindowsXP not recognizing ape Call

Gustav Brock gustav at cactus.dk
Wed Jul 21 10:56:33 CDT 2004


Hi Dan

Or you may simply comment this line out:

    '    .strCustomFilter = ""

Again, I'm not sure how the code will run on Win9x.

/gustav


> Hi Dan the Monkey (ape call?)

> You probably need to set these values of the OFN structure:

>        .strCustomFilter = String(255, 0)
>        .nMaxCustFilter = 255
            
> If that works, could you please report if these settings work with Win9x too?

> /gustav


>> I use the code I downloaded from Candace Tripp's website for this.  It's
>> been a while, but I remember that she has separate downloads for these
>> operating systems, and that the code is slightly different, although I
>> didn't understand the differences.  I use the code as is on Windows XP PC's,
>> and it works.

>> Look at www.candace-tripp.com.

>> Good Luck!
>> Dan Waters

>> -----Original Message-----
>> From: accessd-bounces at databaseadvisors.com
>> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
>> connie.kamrowski at agric.nsw.gov.au
>> Sent: Tuesday, July 20, 2004 8:26 PM
>> To: accessd at databaseadvisors.com
>> Subject: [AccessD] WindowsXP not recognising api Call


>> Ok further to last week I have been trying to find the problem with my
>> inherited app. The api call works fine on windows98 and when taken to
>> windows XP machines does not work.
>> It throws no errors just does not open the Windows Open Save dialog box.
>> The code is word for word to the Getz API call but when the XP machine
>> reaches the
>> If OpenFile Then
>>         fResult = adh_apiGetOpenFileName(OFN)
>>     Else
>>         fResult = adh_apiGetSaveFileName(OFN)
>>     End If

>> It does not open the dialogue box. Running the same code side by side on
>> the win98 machine I get the popup box every time. I have run a reference
>> checker and it says all references are OK.
>> The code is below if that helps.

>> Connie Kamrowski

>> Analyst/Programmer
>> Information Technology
>> NSW Department of Primary Industries
>> Orange

>> Ph: 02 6391 3250
>> Fax:02 6391 3290

>> Function adhCommonFileOpenSave( _
>>  Optional ByRef Flags As Variant, _
>>  Optional ByVal InitialDir As Variant, _
>>  Optional ByVal Filter As Variant, _
>>  Optional ByVal FilterIndex As Variant, _
>>  Optional ByVal DefaultExt As Variant, _
>>  Optional ByVal FileName As Variant, _
>>  Optional ByVal DialogTitle As Variant, _
>>  Optional ByVal hwnd As Variant, _
>>  Optional ByVal OpenFile As Variant) As Variant

>>     ' This is the entry point you'll use to call the common
>>     ' file open/save dialog. The parameters are listed
>>     ' below, and all are optional.
>>     '
>>     ' From Access 97 Developer's Handbook
>>     ' by Litwin, Getz and Gilbert. (Sybex)
>>     ' Copyright 1997. All Rights Reserved.
>>     '
>>     ' In:
>>     '    Flags: one or more of the adhOFN_* constants, OR'd together.
>>     '    InitialDir: the directory in which to first look
>>     '    Filter: a set of file filters, set up by calling
>>     '            AddFilterItem.  See examples.
>>     '    FilterIndex: 1-based integer indicating which filter
>>     '            set to use, by default (1 if unspecified)
>>     '    DefaultExt: Extension to use if the user doesn't enter one.
>>     '            Only useful on file saves.
>>     '    FileName: Default value for the file name text box.
>>     '    DialogTitle: Title for the dialog.
>>     '    OpenFile: Boolean(True=Open File/False=Save As)
>>     ' Out:
>>     '    Return Value: Either Null or the selected filename

>>     Dim OFN As tagOPENFILENAME
>>     Dim strFileName As String
>>     Dim strFileTitle As String
>>     Dim fResult As Boolean

>>     ' Give the dialog a caption title.
>>     'If IsMissing(InitialDir) Then InitialDir = ""
>>     If IsMissing(InitialDir) Then
>>         InitialDir = CurDir
>>     Else
>>         If Dir(InitialDir, vbDirectory) = "" Then InitialDir = CurDir
>>     End If
>>     If IsMissing(Filter) Then Filter = ""
>>     If IsMissing(FilterIndex) Then FilterIndex = 1
>>     If IsMissing(Flags) Then Flags = 0&
>>     If IsMissing(DefaultExt) Then DefaultExt = ""
>>     If IsMissing(FileName) Then FileName = ""
>>     If IsMissing(DialogTitle) Then DialogTitle = ""
>>     If IsMissing(hwnd) Then hwnd = Application.hWndAccessApp
>>     If IsMissing(OpenFile) Then OpenFile = True

>>     ' Allocate string space for the returned strings.
>>     strFileName = Left(FileName & String(256, 0), 256)
>>     strFileTitle = String(256, 0)

>>     ' Set up the data structure before you call the function
>>     With OFN
>>         .lStructSize = Len(OFN)
>>         .hwndOwner = hwnd
>>         .strFilter = Filter
>>         .nFilterIndex = FilterIndex
>>         .strFile = strFileName
>>         .nMaxFile = Len(strFileName)
>>         .strFileTitle = strFileTitle
>>         .nMaxFileTitle = Len(strFileTitle)
>>         .strTitle = DialogTitle
>>         .Flags = Flags
>>         .strDefExt = DefaultExt
>>         '.strInitialDir = CurDir
>>         .strInitialDir = InitialDir

>>         ' Didn't think most people would want to deal with
>>         ' these options.
>>         .hInstance = 0
>>         .strCustomFilter = ""
>>         .nMaxCustFilter = 0
>>         .lpfnHook = 0
>>     End With

>>     ' This will pass the desired data structure to the
>>     ' Windows API, which will in turn it uses to display
>>     ' the Open/Save As Dialog.

>>     If OpenFile Then
>>         fResult = adh_apiGetOpenFileName(OFN)
>>     Else
>>         fResult = adh_apiGetSaveFileName(OFN)
>>     End If

>>     ' The function call filled in the strFileTitle member
>>     ' of the structure. You'll have to write special code
>>     ' to retrieve that if you're interested.

>>     If fResult Then
>>         ' You might care to check the Flags member of the
>>         ' structure to get information about the chosen file.
>>         ' In this example, if you bothered to pass in a
>>         ' value for Flags, we'll fill it in with the outgoing
>>         ' Flags value.
>>         If Not IsMissing(Flags) Then Flags = OFN.Flags
>>         adhCommonFileOpenSave = adhTrimNull(OFN.strFile)
>>         msgbox adhCommonFileOpenSave
>>     Else
>>         adhCommonFileOpenSave = Null
>>     End If
>> End Function




More information about the AccessD mailing list