Announcement

Collapse
No announcement yet.

2 problems in ComDlg32

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

  • Borje Hagsten
    replied
    I like to lift out the OpenFileDialog function from COMDLG32.INC and
    do own stunts there, different depending on app'. Then, no problem to
    let a global var store the returned nFilterIndex member, etc. Another
    advantage - one can also decide filter index on opening.

    Know you already know all this stuff, but in case you still want to
    see, and for eventual lurkers - in my editor control sample I lift out
    those functions for desired index selection, etc.

    It also shows proper way to handle Save dialog in 32-bit Windows. Save
    dialog must never have dual file prefixes per filter index, because then file
    will end up with double file ends (like PBedit's mycode.bas.inc, for example)

    See http://www.tolken99.com/edm32.zip (117KB)

    Oh yes - Should think the limit is the limit of what a combo box can handle,
    so should be possible to use as many as one needs (would be fun to release a
    good text editor with 32000 file types to chose from - all in random order..
    ------------------
    Eh, what was the question again (typical me - answer, but don't read question)
    The OpenFileDialog function can be modified to own needs. No problems to add
    a BYREF FilterIndex member to it, but best is to lift out function and do own
    version inside code, something like:
    Code:
    FUNCTION MyOpenFileDialog (BYVAL hWnd AS DWORD, _           ' parent window
                               BYVAL Caption AS STRING, _       ' caption
                               Filespec AS STRING, _            ' filename
                               BYVAL InitialDir AS STRING, _    ' start directory
                               BYVAL Filter AS STRING, _        ' filename filter
                               BYVAL DefExtension AS STRING, _  ' default extension
                             FilterIndex AS DWORD              '<- NOTE: added!
                               Flags AS DWORD ) AS LONG         ' flags
     
    '..
    '..
      FUNCTION = GetOpenFilename(ofn)
     
      FilterIndex = ofn.nFilterIndex
    '..

    [This message has been edited by Borje Hagsten (edited September 20, 2001).]

    Leave a comment:


  • Michael Mattias
    replied
    In GetOpenFileName?
    Filterindex is returned in OPENFILENAME structure

    lpStrFilter has no published limitation on size.

    Or are you talking about the OpenFileDialog function PB wrote as a wrapper for GetOpenFileName? If this, just modify it.

    MCM


    Leave a comment:


  • Edwin Knoppert
    started a topic 2 problems in ComDlg32

    2 problems in ComDlg32

    1) Already mentioned, can the selected filterindex be returned? (byref)
    2) I use quite a lot of filter entries, the asciiz is limmited, i copied this code and adapted it.
    The filter is now~2k
    Can this be increased, i like to use the PB stuff instead.

    Thanks,


    ------------------
Working...
X