Save Files As....

Started by paulDiagnos, September 26, 2007, 05:50:33 AM

Previous topic - Next topic

paulDiagnos

Hey Guys,

I have been using the save file dialogue for a couple of years in my code. but recently i have had two or three customers that when using the software that i have produced do not see the file save dialogue appear.

the window is not initialised and my software therefore just seems to skip onto the next step.

are there any dependencies on dlls that i should distribute with my code? or is there another explanation . 

thanks Paul.

TechSupport

You may want to show the code that you are using to display the Save As dialog. I have never seen a problem with displaying the dialog and it only depends on the installed system DLL's. What operating system is your customer using?

paulDiagnos

#2
its a very odd problem, its only happened to 2 people in the last 6 months and they have XP. the code im using is as follows.


'------------------------------------------------------------------------------------------------------------------------
Function lev_savetodisk As Long
Dim BUFFER As String
Local sFilename As String
Local sFilter As String
Local nResult As Long
Local nFlags As Long
Dim FILENUM As Long
FILENUM = FreeFile

sFilter = findstring_(%lang_logs)+" (All files (*.*)|*.*"                   
nFlags = %OFN_HIDEREADONLY Or %OFN_LONGNAMES Or %OFN_OVERWRITEPROMPT Or %OFN_EXPLORER
sFilename = "C:\EMAIL_LEV3.PR"
nResult = FF_SaveFileDialog( hWnd_sendlogsvia, findstring_(%lang_savelogs_todisk), sFilename, "", sFilter, "", nFlags, %TRUE)

If sfilename <> "" Then
If sfilename <> "" Then Kill  sfilename                                   
ErrClear
Open gFTP_FILE For Binary Shared As FILENUM
Get$ FILENUM ,Lof(FILENUM) , BUFFER
Close FILENUM
Open SFILENAME For Binary As FILENUM
Put$ FILENUM , BUFFER
SetEof(filenum)
Close FILENUM    
If Err Then
MsgBox "ERROR :" + Str$(Err),%MB_TASKMODAL Or %MB_ICONWARNING,findstring_(%lang_Critical_Warning )
Else
SetAttr SFILENAME, %NORMAL
gMOUSE = 1     
MousePtr gMOUSE 
gBACKGROUND_SEND_LOGS = %false     
FF_TextBox_SetText hwnd_logsdisplay_status,findstring_(%lang_savelogs_todisk)
MessageBox(hWnd_sendlogs, findstring_(%Lang_Files_saved_todisk), ByCopy "host", %MB_ICONINFORMATION Or %MB_TASKMODAL)
End If
End If             
End Function


TechSupport

Not sure why it would fail. Try not centering the dialog (i.e. change the %TRUE to %FALSE for the centering parameter). Maybe the hook that centers the dialog is failing.

I wonder if your customer has any type of strict security rule enabled in XP that prevents the SaveDialog from defaulting to your file in the root directory (i.e. "C:\EMAIL_LEV3.PR"). Try leaving the sFilename = "" and se what happens.

Also, as an aside, you could more easily test for the dialog being cancelled by using code like the following:

If FF_SaveFileDialog( hWnd_sendlogsvia, findstring_(%lang_savelogs_todisk), _
                            sFilename, "", sFilter, "", nFlags, %TRUE) = %FALSE Then
   Exit Function
End If


Also, there is no need to do the FREEFILE before you show the dialog. May as wait until you actually need it (i.e. right before "Open gFTP_FILE For Binary Shared As FILENUM")

   
   

paulDiagnos

I shall try your suggestions.

thanks for the feedback and the tips.

because it happens so rare i cant promise any feed back, but when i get some il let you know.

thanks Paul .