English
Forum

GetSaveFileName and OFNHookProc trouble

 

Georg
Hovenbitzer
Hello together,

i see time again windows not
The code under functions, only if I by .Flag OFN_ENABLEHOOK einschalte becomes the window not any more in the Explorer Style displayed. means it are missing left The large Buttons. where it loudly win32.hlp so weg should.
testing can this, if one in the code under .Flag& the $20 deletes. The HookProc becomes called if is a File selecting The present is and OK pressing.

another Zusatzfrage:
I have whom code time so changed, that one dialog in the HookProc opened becomes.
The type in the Messagebox and in the dialog are different, How I get whom dialog in the same Font as Messagebox. with SetDialogfont 0 have I it already probiert, bring but nothing.
CompileMarkSeparation
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&
Declare ofn#
Dim ofn#,tagOFN
Struct _Rect = Left&,
Top&,
Right&,
Bottom&
Declare Rect#
Dim Rect#,_Rect

Proc SaveDateiHook

    Parameters hdlg&,uMsg&,wParam&,lParam&
    Declare Parent&
    Clear Rect#

    If uMsg& = 49265

        If @FileExists(@String$(ofn#.lpstrFile&,0)) = 1

            Parent& = @External("USER32","GetParent",hdlg&)
            @External("USER32","GetWindowRect",Parent&,Rect#)
            Declare Fenster&
            Declare Weiter&
            Declare Neu&
            Declare Abbruch&
            Fenster& = @Create("Dialog",Parent&,"Datei existiert",10,10,300,150)
            Weiter& = @Create("DefButton",Fenster&,"Anhängen",20,60,120,30)
            Neu& = @Create("Button",Fenster&,"Überschreiben",150,60,120,30)
            @MessageBox("Left = "+@Str$(Rect#.Left&)+"
            "+"Top = "+@Str$(Rect#.Top&)+"
            "+"Right = "+@Str$(Rect#.Right&)+"
            "+"Bottom = "+@Str$(Rect#.Bottom&)+"
            "+"File = "+@String$(ofn#.lpstrFile&,0),"Info",1)
            Return 1

        EndIf

    EndIf

    Return 0

EndProc

Proc SaveDatei

    Parameters hWnd&,Titel$,FileSpec$,InitialDir$,Filter$,DefExt$
    Declare CustomFilter$
    Declare FileTitle$
    Declare rCode&
    Declare Auswahl$
    Clear ofn#
    Titel$ = Make256String(Titel$)
    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(Titel$)
        .Flags&             = ($4 | $20 | $80000 | $800)
        OFN_HIDEREADONLY $4
        OFN_ENABLEHOOK $20
        OFN_PATHMUSTEXIST $800
        OFN_EXPLORER $80000
        .lpstrDefExt&       = @Addr(DefExt$)
        .lpfnHook&					= @ProcAddr(SaveDateiHook,4)

    EndWith

    rCode& = GetSaveFileName(ofn#)

    If rCode& <> 0

        Auswahl$ = @String$(ofn#.lpstrFile&,0)

    Else

        Auswahl$ = ""

    EndIf

    Dispose ofn#
    Return Auswahl$

EndProc

Window 100,100-800,600
Print SaveDatei(%hWnd,"Datei speichern unter:","DLQueue",$ProgDir,"Download File (*.dat)|*.dat|Textfile (*.txt)|*.txt","*.dat")
WaitInput
Dispose ofn#
../function-references/XProfan/dispose/'>Dispose Rect#
End
 
Viele Grüsse, Georg Hovenbitzer(Windows XP Pro, XProfan 11.2, Profan2Cpp 1.6a)
06/02/06  
 



I had the whole here  [...]  something differently resolved, but I faith me To remind the that trouble the same was.
 
06/02/06  
 



I can present the WinXP through one own Hooks these bar created, what then not happens if one a owner-Hook definiert.
 
06/02/06  
 




Georg
Hovenbitzer
Hello iF,

your demonstration know I very well
I tentacle still gladly

but with you becomes the Explorer Sytle neither displayed

time the statement from the Win32.hlp:

[quote:d1a14d6a62]
By default, windows 95 and windows NT Version 4.0 display a new Version of the Save dialog box that provides user-interface features that are similar to the windows Explorer. You can provide on OFNHookProc hook procedure for on Explorer-style Save dialog box. To enable the hook procedure, set the OFN_EXPLORER and OFN_ENABLEHOOK flags in the ? Happen? member of the OPENFILENAME structure and specify the address of the hook procedure in the lpfnHook member.
[/quote:d1a14d6a62]
 
Viele Grüsse, Georg Hovenbitzer(Windows XP Pro, XProfan 11.2, Profan2Cpp 1.6a)
06/02/06  
 



is imho still too correctly. How the Win there reacted. there standing Yes ultimately not the OFN_EXPLORER for bar zuständig is. for me is it coherent the windows there whom default LoadSaveDialog indicating there hold a Own HookProc for these Extras care should.

I have none council How one both together vereinen can.
 
06/02/06  
 




Georg
Hovenbitzer
Hello iF,

What is because then the Explorer Style ?!
there both mutants itself only by the bar on the left Page discern.
 
Viele Grüsse, Georg Hovenbitzer(Windows XP Pro, XProfan 11.2, Profan2Cpp 1.6a)
06/02/06  
 




Uwe
''Pascal''
Niemeier
Hello people!

since Win2000 watts The OpenFileName-structure circa 3 optionale Parameter complement (see MSDN). becomes The Size the structure properly extended (The three LongInts end must zero his) ought to it klappen.
here a demonstration, circa a dialog by Hook in the Miniatur-view to open (order Image-selection):
CompileMarkSeparation
!
window 10,10-700,500
 $H Messages.ph
 $H Windows.ph

proc OpenFileHook-------------------------------OpenFileHook----------------------------

    parameters dlg&,msg&,wparam&,lparam&
    case Status%:return 1-----Ansicht muss nur einmal angepasst werden
    casenot msg&=~WM_NOTIFY:return 1

    if long(lparam&,8)=-603---Bei  Init existieren DefView und LV noch nicht!

        Status%=1
        DefView&=~FindWindowEx(~GetParent(dlg&),0,"SHELLDLL_DefView","")
        sendmessage(DefView&,~WM_COMMAND,$702D,0)--Undokumentierte Message

    endif

    return 1
    endproc---------------------------------------------------------------------------------

    proc LoadPicDialog------------------------------LoadPicDialog---------------------------

        parameters Pfad$,Titel$,Name$
        declare ofn#,Result$,Result&
        declare DefView&,Status%------Variablen für Hook
        Name$=Name$+"z*.bmp;*.jpe;*.jpeg;*.jpg;*.gifzz"--Filter (bei Bedarf anpassen)
        dim ofn#,88+256---------------Struktur (Win2000/NT/XP) + Puffer
        clear ofn#
        long ofn#,0=88----------------Grösse Struktur für GetOpenFileName (76 für Win9x)
        long ofn#,4=%hwnd-------------übergeordnetes Fenster
        long ofn#,12=addr(Name$)------Filter/Typ
        long ofn#,28=ofn#+88----------Beginn Puffer
        long ofn#,32=255--------------Puffergrösse
        long ofn#,44=addr(Pfad$)------Anfangspfad
        long ofn#,48=addr(Titel$)-----Titel
        long ofn#,52=$880024----------Flags
        long ofn#,68=procaddr("OpenFileHook",4)
        Result&=external("COMDLG32","GetOpenFileNameA",ofn#)
        Result$=string$(ofn#,88)
        casenot Result&:Result$=""
        procaddr("OpenFileHook",-4)
        dispose ofn#
        return Result$
        endproc---------------------------------------------------------------------------------
        print LoadPicDialog("","Bitte Bild wählen","Bild")
        waitkey

HTH
Pascal
 
06/02/06  
 



it functions.
 
06/02/06  
 




Georg
Hovenbitzer
The Pascal time again

it functions class

The thing left name itself places bar and can in the advanced Variante with 1 in FlagsEx (last Parameter) from- and 0 eingeschaltet go.
 
Viele Grüsse, Georg Hovenbitzer(Windows XP Pro, XProfan 11.2, Profan2Cpp 1.6a)
06/02/06  
 




Georg
Hovenbitzer
Hello together,

me falls there in the code of Pascal nochwas on I not knew.

is it allows The variables for Hook Proc in the Hauptproc To deklarieren, so How in the example of Pascal ?
under Profan works this very well, only it can itself by Profan2CPP not translate.
 
Viele Grüsse, Georg Hovenbitzer(Windows XP Pro, XProfan 11.2, Profan2Cpp 1.6a)
06/07/06  
 




Sebastian
König
[quote:beab6f0e39]is it allows The variables for Hook Proc in the Hauptproc To deklarieren, so How in the example of Pascal ?
under Profan works this very well, only it can itself by Profan2CPP not translate.[/quote:beab6f0e39]
Yes, in (X)Profan works the (unfortunately ). with Profan2Cpp ought to it functions, if you into Übersetzungsoptionen any variables global deklarieren activate.

MfG

Sebastian
 
Windows XP, XProfan/Profan² 4.5 bis 11
Profan2Cpp-Homepage:  [...] 
Alte Profan²-Seite:  [...] 
06/08/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

2.396 Views

Untitledvor 0 min.
Andreas Koch04/19/12
liveFamilie03/28/12

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