Dateierweiterung wechseln. CDN_TYPECHANGE?



  • Hallo zusammen,
    ich versuche jetzt schon seit geraumer Zeit herauszufinden, wie ich in meinem Speichern Dialog, welchen ich von CFileDialog abgeleitet habe und den ich mit einem extra Dateifilter aufrufe, einen Wechsel des Dateityps in der Auswahlliste erkennen kann und entsprechend die Erweiterung meines eingegebenen Dateinamens automatisch ändern kann. Leider ohne Erfolg !! 😞

    Ich hab mich ein wenig in die MSDN eingelesen und unter CFileDialog die Funktion OnTypeChange() gefunden, aber auf die kann ich nicht zugreifen, da die Protected ist, außerdem weiß ich auch gar nicht, wie ich auf ne Funktion zugreifen kann, wenn ich DoModal() aufrufe und solange nichts passiert, bis ich einen Button meines Dialogfeldes gedrückt habe (z.B. IDOK)!
    Danach habe ich was mit CDN_TYPECHANGE gelesen, da aber (wie so oft) keine konkreten Beispiele in der Beschreibung gezeigt werden, kann ich damit nichts anfangen 😡

    Kann mir irgend jemand helfen?

    Grüße
    RG_Basser

    [ Dieser Beitrag wurde am 17.04.2003 um 12:51 Uhr von rg_Basser editiert. ]



  • class CMeinFileDialog : public CFileDialog
    {
      virtual void OnTypeChange()
      {
        // TueWasimmerDuwillst!
      }
    };
    


  • Ok, Danke, das hat mir schon mal weitergeholfen! Allerdings weiß ich jetzt immer noch nicht, was ich mit dieser Funktion anfangen soll, da sie ja weder Übergabeparameter noch Rückgabewerte enthält! Außerdem, wann soll diese Fkt aufgerufen werden? Solange DoModal() aktiv ist, kann ich ja nicht und danach ist der Zug ja schon abgefahren! 😕

    Oder hab ich irgendwas falsch verstanden?



  • Die Funktion wird vom Dialog während DoModal aufgerufen, wann anders GEHT ES DOCH GAR NICHT !

    In nFilterIndex steht dann, welcher Filter selektiert wurde.
    Mit SetControlText kannst Du dann den Text im Feld neu setzen.



  • nFilterIndex ??



  • Ok, vergiss das ich gefragt habe!! Habs gefunden! Kannst du mir noch sagen, was der erste Parameter in SetControlText(int nID, LPCSTR lpsz) soll?

    Mille Grazie!! Ich weiß, ich bin nervig! 🙄



  • Ok, ich hab auch das rausgefunden! Nun meine allerletzte Frage: Woher bekomme ich die ID Nummer des Feldes, in der der Filename steht??

    Gruß und vielen Dank für die Hilfe!



  • ->MSDN

    Explorer-Style Control Identifiers
    The Platform SDK provides the default dialog box template for the old-style dialog boxes, but does not include the default template for the Explorer-style dialog boxes. This is because the Explorer-style dialog boxes allow you to add your own controls but do not support modifying the template for the standard controls. However, in some cases, you may need to know the control identifiers used in the default templates. For example, the CDM_HIDECONTROL and CDM_SETCONTROLTEXT messages require a control identifier.

    The following table shows the identifiers of the standard controls in the Explorer-style Open and Save As dialog boxes. The identifiers are constants defined in Dlgs.h and Winuser.h.

    Control identifier Control description
    chx1 The read-only check box
    cmb1 Drop-down combo box that displays the list of file type filters
    stc2 Label for the cmb1 combo box
    cmb2 Drop-down combo box that displays the current drive or folder, and that allows the user to select a drive or folder to open
    stc4 Label for the cmb2 combo box
    cmb13 Drop-down combo box that displays the name of the current file, allows the user to type the name of a file to open, and select a file that has been opened or saved recently. This is for earlier Explorer-compatible applications without hook or dialog template. Compare with edt1.
    edt1 Edit control that displays the name of the current file, or allows the user to type the name of the file to open. Compare with cmb13.
    stc3 Label for the cmb13 combo box and the edt1 edit control
    lst1 List box that displays the contents of the current drive or folder
    stc1 Label for the lst1 list box
    IDOK The OK command button (push button)
    IDCANCEL The Cancel command button (push button)
    pshHelp The Help command button (push button)



  • @RenéG:

    Du bist der Beste 🕶 es funktioniert!!


Anmelden zum Antworten