PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Richard Kelly on March 21, 2010, 09:25:16 AM

Title: FF_OpenFileDialog
Post by: Richard Kelly on March 21, 2010, 09:25:16 AM
I feel pretty silly here. When I compile my project, I get a 516 error on the FF_OpenFileDialog in the following code:


Function CTInit(ByRef hDB As Long,ByRef sPath As Asciiz * %MAX_PATH, ByRef nError As Long) As Long

Local sDBName             As Asciiz * %MAX_PATH
Local sDBPath             As Asciiz * %MAX_PATH
Local sFileName           As String   
Local nReturn             As Long

   nReturn = %TRUE
   nError = %SQLITE_OK

' Open Database

' Check if a path is available in INI folder, if not found DB folder location is assumed at this point

   GetPrivateProfileString ("Database", "Path", sPath + "DB\", sDBPath, SizeOf(sDBPath), sPath + "INI\CTConfig.INI")
   
   sDBName = sDBPath + "CTarget.DB3"
   
' Check if database file exists

   If IsFalse Isfile(sDBName) Then
   
      sFileName = "CTarget"   
   
      If FF_OpenFileDialog (HWND_MAIN,"CTarget Database Location",sFileName,sDBPath,"CTarget Database (CTarget.db3)|CTARGET.DB3","DB3",%OFN_EXPLORER Or %OFN_FILEMUSTEXIST Or %OFN_PATHMUSTEXIST,%TRUE) <> %FALSE Then
     
' Extract database path

         sDBPath = PathName$(PATH, sFileName)
         
         WritePrivateProfileString ("Database", "Path", sDBPath, sPath + "INI\CTConfig.INI")
         
         sDBName = sDBPath + "CTarget.DB3"
         
      Else
     
         nReturn = %FALSE
     
      End If
   
   End If
   
   If nReturn = %TRUE Then
   
      nError = sqlite3_open_v2 (VarPtr(sDBName), hDB, %SQLITE_OPEN_READWRITE, "")
   
      Select Case nError
   
         Case = %SQLITE_OK
     
' Activate extended error codes

            sqlite3_extended_result_codes (hDB,%TRUE)
           
         Case Else
         
            nReturn = %FALSE
     
      End Select
     
   End If
   
   Function = nReturn

End Function


I've been staring and staring for the past hour and just can't seem to see how this call is wrong...i :-[
Title: Re: FF_OpenFileDialog
Post by: Richard Kelly on March 21, 2010, 09:58:45 AM
Issue withdrawn. The line with the FF_OpenFileDialog was too long. And I feel even sillier now....
Title: Re: FF_OpenFileDialog
Post by: Roger Garstang on March 24, 2010, 02:31:49 PM
That is a very common thing to do. I've done it lots of times with Open/Save Dialog functions since they need so many parameters and flags.  I thought Paul and/or the compiler handled this better now, but I could be wrong.  I know the compiler will give line length errors now when compiled in IDE, and should have said it in the results of the compile giving the line numbers, etc.  I thought Paul had put in some code to wrap long lines too, but it may have missed it.