Sign in to follow this  
Followers 0
SBO

FileSaveDialog() and _WinAPI_GetSaveFileName() get @extended infos

3 posts in this topic

Hi guys (and girls),
 
I have to write code that saving for me *.txt or *.dat file to wanted location but here is problem. When I choose a filter from list of file save dialog is never be returned to function as @extended information. It is same problem for two functions listed in topic. Here is the code:

 

Func SaveTo()
;$h_path_filename = _WinAPI_GetSaveFileName("SaveTo", "Textual report (*.txt)|input file (*.dat)|", "", "", "", 1, 0, 0, $MainGui)
$h_path_filename = FileSaveDialog("SaveAs", @DesktopDir, "Textual report (*.txt)|input file (*.dat)|", 16)
If StringInStr($h_path_filename, ".", 0, -1) Then $h_path_filename = StringMid($h_path_filename, 1, StringInStr($h_path_filename, ".", 0, -1) - 1)
MsgBox(00,"",$iFilterIndex)
If $h_path_filename = "" Then
    Return
EndIf
If @extended = "Textual report (*.txt)" Then
    If (GUICtrlRead($InputB[1]) = "") Then
     MsgBox(16, "Error #800", "You can not create report file if main calculation function is not previously executed. Please, set up input data and run calculation function.")
     Return
 EndIf
    $hreport = $h_path_filename&".txt"
    WriteReport()
    FileClose($hreport)
ElseIf @extended = "input file (*.dat)" Then
    $hinput = $h_path_filename&".dat"
    WriteInput()
    Fileclose($hinput)
EndIf
EndFunc

Sorry for I'm not having comments in code but I think the main problem is obvious even without them.

Best regards,

SBO

Share this post


Link to post
Share on other sites



I am not sure how that is a problem. The helpfile doesn't say that either of the functions return anything in @extended.

Also you are reading @extended from MsgBox(), so it wouldn't work anyway (every function resets @error and @extended, so either use it directly or save to a variable for later).

1 person likes this

Share this post


Link to post
Share on other sites

OK, I will certainly try that. Msg box is something that I used to see what function returning to me. Sorry for that, it should not be there. It is only something that I'm using when I'm searching for a problems in my functions. Thanks very much for idea.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0