English
C ++ Forum

GetSaveFileName

 

Georg
Hovenbitzer
Hello Sebastian,

anhängender code not working More if one it Translated

the Dateiauswahlfenster won't opened, in the Interpreter and as Compilat functions everything fine.

I hope You can time again help
Def Getsavefilename(1) !"COMDLG32.DLL","GetSaveFileNameA"
Def Make256string(1) ((@$(1) + @Chr$(0)) + @Space$(256 - @Len(@$(1))))
Struct Tagofn = Lstructsize&,
Hwndowner&,
Hinstance&,
Lpstrfilter&,
Lpstrcustomfilter&,
Nmaxcustfilter&,
Nfilterindex&,
Lpstrfile&,
Nmaxfile&,
Lpstrfiletitle&,
Nmaxfiletitle&,
Lpstrinitialdir&,
Lpstrtitle&,
Flags&,
Nfileoffset%,
Nfileextension%,
Lpstrdefext&,
Lcustdata&,
Lpfnhook&,
Lptemplatename&,
Pvreserved&,
Dwreserved&,
Flagsex&
Declare Ofn#
Dim Ofn#,Tagofn
Struct _rect = Left&,
Top&,
Right&,
Bottom&
Declare Rect#
Dim Rect#,_rect
Declare Ergebnis&
Declare Icon&

Proc Iconload

    Declare name$
    Declare Dll&
    name$ = "#1001" + @Chr$(0)
    Dll& = @Usedll("SHELL32.DLL")
    Icon& = @External("USER32.DLL","LoadImageA",Dll&,@Addr(name$),1,48,48,0)
    Freedll Dll&

Endproc

Proc Savedateihook

    Parameters Hdlg&,Umsg&,Wparam&,Lparam&
    Clear Rect#
    Declare Parent&
    Declare Fenster&
    Declare Text&
    Declare Weiter&
    Declare Neu&
    Declare Abbruch&
    Declare Static&
    Declare Raus&

    If Umsg& = 49265

        If @Fileexists(@String $(Ofn#.Lpstrfile&,0)) = 1

            Parent& = @External("USER32","GetParent",Hdlg&)
            @External("USER32","GetWindowRect",Parent&,Rect#)
            Fenster& = @Create("Dialog",%Hwnd,"Datei existiert",-1,-1,-1,0)
            Setwindowpos Fenster& = (Rect#.Left& + (((Rect#.Right& - Rect#.Left&) / 2) - 160)),(Rect#.Top& + (((Rect#.Bottom& - Rect#.Top&) / 2) - 75))- 320,150
            Text& = @Create("Text",Fenster&,"Folgende action perform:",80,30,200,40)
            Usefont "Curier New",14,0,0,0,0
            Setdialogfont 1
            Weiter& = @Create("DefButton",Fenster&,"Anhängen",25,75,82,26)
            Neu& = @Create("Button",Fenster&,"Überschreiben",115,75,82,26)
            Abbruch& = @Create("Button",Fenster&,"Abbruch",205,75,82,26)
            Static& = @Control("Static","",$54000103,10,10,48,48,Fenster&,0,%Hinstance,$0)
            @Sendmessage(Static&,$170,Icon&,0)
            Setdialogfont 0
            Raus& = 0

            Whilenot Raus& = 1

                Waitinput

                If @Clicked(Weiter&)

                    Ergebnis& = 1
                    Raus& = 1

                Elseif @Clicked(Neu&)

                    Ergebnis& = 2
                    Raus& = 1

                Elseif (@Clicked(Abbruch&) Or (%Key = 2))

                    Ergebnis& = 0
                    Raus& = 1

                Endif

            Endwhile

            @Destroywindow(Fenster&)
            Return 1

        Endif

    Endif

    Return 0

Endproc

Proc Savedatei

    Parameters Hwnd&,cover$,Filespec$,Initialdir$,filter$,Defext$
    Declare Customfilter$
    Declare Filetitle$
    Declare Rcode&
    Declare selection$
    Clear Ofn#
    cover$ = Make256string(cover$)
    Filespec$ = Make256string(Filespec$)
    Initialdir$ = Make256string(Initialdir$)
    filter$ = @Translate$(filter$,"|",@Chr$(0)) + @Chr$(0)
    filter$ = Make256string(filter$)
    Defext$ = Make256string(Defext$)

    With Ofn#

        .Lstructsize&       = @Sizeof(Ofn#)
        .Hwndowner&         = Hwnd&
        .Hinstance&         = %Hinstance
        .Lpstrfilter&       = @Addr(filter$)
        .Lpstrcustomfilter& = @Addr(Customfilter$)
        .Nmaxcustfilter&    = 0
        .Nfilterindex&      = 1
        .Lpstrfile&         = @Addr(Filespec$)
        .Nmaxfile&          = 256
        .Lpstrfiletitle&    = @Addr(Filetitle$)
        .Nmaxfiletitle&     = 256
        .Lpstrinitialdir&   = @Addr(Initialdir$)
        .Lpstrtitle&        = @Addr(cover$)
        .Flags&             = ($4 | $20 | $80000 | $800)
        .Nfileoffset% = 0
        .Nfileextension% = 0
        .Lpstrdefext&       = @Addr(Defext$)
        .Lcustdata& = 0
        .Lpfnhook& = @Procaddr(Savedateihook,4)
        .Lptemplatename& = 0
        .Pvreserved& = 0
        .Dwreserved& = 0
        .Flagsex& = 0

    Endwith

    Ergebnis& = 2
    Rcode& = Getsavefilename(Ofn#)

    If Rcode& = 1

        If Ergebnis& <> 0

            selection$ = @Str $(Ergebnis&) + "|" + @String $(Ofn#.Lpstrfile&,0)

        Elseif Ergebnis& = 0

            selection$ = ""

        Endif

    Else

        selection$ = ""

    Endif

    @Procaddr(Savedateihook,-4)
    Return selection$

Endproc

#######################
Windowstyle 8 + 16 + 512 + 1024
Window 100,100-300,300
Declare Ende&
Declare Button&
Button& = @Create("Button",%Hwnd,"Button",10,10,100,40)
Iconload

Whilenot Ende& = 1

    Waitinput

    If %Key = 2

        Ende& = 1

    Elseif @Clicked(Button&)

        Savedatei(%Hwnd,"Ausgabe the Results to:","DLQueue",$Progdir,"DAT File (*.dat)|*.dat|Textfile (*.txt)|*.txt","*.dat")

    Endif

Endwhile

Dispose Rect#
Dispose Ofn#
@External("USER32.DLL","DestroyIcon",Icon&)
End
 
Viele Grüsse, Georg Hovenbitzer(Windows XP Pro, XProfan 11.2, Profan2Cpp 1.6a)
07/06/06  
 




Sebastian
König
Hello Georg,

first can I the trouble confirm - exit even too yet with the actually Beta-Version on....

The cause could I though not yet find - my first suspicion, that it with the Hook zusammenhängen could, has not confirm... CommDlgExtendedError() supply simply CDERR_INITIALIZATION.

unfortunately be I in momentum one little in the Stress (tommorrow a Klausur, monday same The next ), so I probably first monday evening intensiver to the cause search can. Sorry, that You one little Waiting must! i'll me naturally immediate therefore concern, if I again enough Time have.

MfG

Sebastian
 
Windows XP, XProfan/Profan² 4.5 bis 11
Profan2Cpp-Homepage:  [...] 
Alte Profan²-Seite:  [...] 
07/06/06  
 




Georg
Hovenbitzer
Hello Sebastian,

red you Please Time and integrally plenty Happiness for check !!
 
Viele Grüsse, Georg Hovenbitzer(Windows XP Pro, XProfan 11.2, Profan2Cpp 1.6a)
07/07/06  
 




Sebastian
König
Hello Georg,

so - i think, I habs . The crucial point is these row:

.Lpstrcustomfilter& = @Addr(Customfilter$)

after I simply time instead of the address a zero indicated have, funktionierte it suddenly too with Profan2Cpp. first could I me the none explain, To I the following noticed: In (X)Profan gives @Addr() with Leerstrings (and therefore deals it itself with Customfilter$, there no worth allocated becomes) always 0 back. the was me yet never noticed...

an Anpassung was but to that Happiness right simply possible. I have straight a new Beta-Version uploaded, in the the Error korrigiert is. Also there were another trouble by the Benutzung of WAITINPUT in the Hook-procedure, that I ditto have resolved.

The actually Beta (1.5.9c) find You on the Profan2Cpp-Homepage. If it so too with you free from problems functions, can I me open, The corrections on Version 1.5a zurückzuportieren.

over again thanks for patience!

MfG

Sebastian
 
Windows XP, XProfan/Profan² 4.5 bis 11
Profan2Cpp-Homepage:  [...] 
Alte Profan²-Seite:  [...] 
07/10/06  
 




Michael
Dell
Ähm,

the was sooner one Eingabefehler one need only .Nmaxcustfilter& on 255 To settle then GEHTS fine!
 
Salu Michael...

Hab zwar krumme Fieß awer dofir e' ecklich Gsicht! 
07/10/06  
 




Sebastian
König
Hello Michael,

is correct - the helps too . though functions it Yes in the ursprünglichen Version in XProfan self, what well on the Behavior of @Addr() lying. here one kurzer Testcode moreover:
declare Text$
print Addr(text $)
let Text$ = "Hallo"
print Addr(text $)
let Text$ = ""
print Addr(text $)
waitkey

MfG

Sebastian
 
Windows XP, XProfan/Profan² 4.5 bis 11
Profan2Cpp-Homepage:  [...] 
Alte Profan²-Seite:  [...] 
07/11/06  
 




Michael
Dell
Yes, is explicit To discern!

Intressant is the display if you the Test- Program with Prf2Cpp (v1.5a-new3) Translated have!!!
 
Salu Michael...

Hab zwar krumme Fieß awer dofir e' ecklich Gsicht! 
07/11/06  
 




Sebastian
König
Yes, is correct. here becomes of Addr() too with Leerstrings a address zurückgegeben. (what on it lying, that too The Leerstrings a short Puffer with of/ one 0 directly at the beginning using....). If you whom code with the actually Beta (1.5.9c) Translated, ought to the behaviour very the of (X)Profan correspond to

MfG

Sebastian
 
Windows XP, XProfan/Profan² 4.5 bis 11
Profan2Cpp-Homepage:  [...] 
Alte Profan²-Seite:  [...] 
07/11/06  
 




Sebastian
König
what me straight yet falls in: in the Beta-Version is naturally too The [...]  diskutierte Possibility to control the Translation of @Call() and @External() integrate. documents have I the whole in the Help under the new Rubrik other Features...
 
Windows XP, XProfan/Profan² 4.5 bis 11
Profan2Cpp-Homepage:  [...] 
Alte Profan²-Seite:  [...] 
07/11/06  
 




Michael
Dell
thought me already the each Variable/String a address has all the same whether empty or not is but eh everything only one addressierter Speicherbereich. its means sooner one, well say we time unerwartetes Behavior of XProfan or?
 
Salu Michael...

Hab zwar krumme Fieß awer dofir e' ecklich Gsicht! 
07/11/06  
 




Sebastian
König
unexpected - in the doing . has integrally beautiful gedauert, To me the finally noticed is... directly be I none on The idea come - notice have I it first, as i The complete OFN-structure with BlockWrite in a File written and then The Results with XProfan and Profan2Cpp compared have...

my Tests zufolge is it too first since Profan² 7.0 so - with 6.6 yet becomes too with Leerstrings always a address zurückgegeben. probably is it simply one of Delphi pretended quality the in Version 7.0 introduced long Strings....

however - it let itself to that Happiness with of/ one small Änderung in the File pstring.h too in Profan2Cpp very simply umsetzen .

MfG

Sebastian
 
Windows XP, XProfan/Profan² 4.5 bis 11
Profan2Cpp-Homepage:  [...] 
Alte Profan²-Seite:  [...] 
07/11/06  
 




Georg
Hovenbitzer
Hello Sebastian,

I hope The tests are well proceed

now To my trouble.
The new version of Profan2Cpp functions very well with the demonstration code here.
contact I these Version but the whole proposition on, crashes The exe directly to the Start with of/ one Schutzverletzung ex, with the Version 1.5a runs everything tidy except for that here named trouble.
If I the Source code compare there a crowd differences, i'll you these time as private Mail here zukommen let.

but otherwise time again super work
 
Viele Grüsse, Georg Hovenbitzer(Windows XP Pro, XProfan 11.2, Profan2Cpp 1.6a)
07/13/06  
 




Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

5.228 Views

Untitledvor 0 min.
liveFamilie03/28/12
Andreas Koch12/02/11

Themeninformationen



Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie