Announcement

Collapse
No announcement yet.

XP woes (sometimes)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • XP woes (sometimes)

    The following snippet runs as it should on two machines, but fails on another two. All machines running XP SP2, installed from four different CDs.

    <CODE>
    FilePath=DataDirectory
    cancelflag=0
    ?"going to Save file dialog
    templong=SaveFileDialog (gmain, "MasterDrain",filename1,FilePath,Filter,DExt,Flags)
    IF templong<>%IDOK THEN cancelflag=1: ?"cancelled":ShowWindow CBHNDL,%sw_shownormal:EXIT SELECT
    ?"back from Save file dialog"
    filenumber=FREEFILE
    OPEN filename1 FOR OUTPUT AS filenumber
    </CODE>

    On the failing machines, the dialog is not shown and the message 'cancelled' is displayed. This routine functions normally in other sections of the program - any thoughts on this one

    Iain Johnstone
    Last edited by Iain Johnstone; 13 Feb 2008, 08:31 AM. Reason: typo
    “None but those who have experienced them can conceive of the enticements of science” - Mary Shelley

  • #2
    Well, you're missing a " on the third line...

    ?"going to Save file dialog"<========== Missing that one
    John,
    --------------------------------
    John Strasser
    Phone: 480 - 273 - 8798

    Comment


    • #3
      The message boxes were just there to tell me what was going on and where the program had got to. What appears to be happening is that as soon as the program goes to the SaveFile dialog, it cancels itself and quits, hence the message box that says 'cancelled'. However, other identical code elsewhere in the program functions normally - this only happens on two new machines.

      I had initially thought that M$ had changed the return values of the buttons, but this would not prevent the dialog from showing in the first place. It is almost as if the program jumps the line and thus templong has a value of 0 (=Cancel), and exits the function. If it is jumping the line - why??? It does this with or without the message boxes. The missing " does not stop it compiling - indeed, the 'going' and 'coming' messages can be left out and it still does it!
      “None but those who have experienced them can conceive of the enticements of science” - Mary Shelley

      Comment


      • #4
        if isfalse SaveFileDialog() then
        dwErr = CommDlgExtendedError()

        from MSDN

        If the user cancels or closes the Save dialog box or an error such as the file name buffer being too small occurs, the return value is zero. To get extended error information, call the CommDlgExtendedError function, which can return one of the following values:


        CDERR_DIALOGFAILURE
        CDERR_FINDRESFAILURE
        CDERR_INITIALIZATION
        CDERR_LOADRESFAILURE
        CDERR_LOADSTRFAILURE
        CDERR_LOCKRESFAILURE
        CDERR_MEMALLOCFAILURE
        CDERR_MEMLOCKFAILURE
        CDERR_NOHINSTANCE
        CDERR_NOHOOK
        CDERR_NOTEMPLATE
        CDERR_STRUCTSIZE
        FNERR_BUFFERTOOSMALL
        FNERR_INVALIDFILENAME
        FNERR_SUBCLASSFAILURE

        Comment


        • #5
          Thank you Uwe - I shal have a look at this now. I still do not understand why it works on another computer with the same (?) operating system, and elsewhere in the program.

          Iain johnstone
          “None but those who have experienced them can conceive of the enticements of science” - Mary Shelley

          Comment

          Working...
          X