Open file in FileDialog problem

Windows specific questions.
Post Reply
aurelVZAB
Posts: 666
Joined: Jul 02, 2008 14:55
Contact:

Open file in FileDialog problem

Post by aurelVZAB »

hi
as in title FileDialog work returning full file path
but using txt as string not fill string with file , file is .bas or .txt
so what i am doing wrong ?

Code: Select all

 SELECT CASE wmID
           Case  102
              fName = OpnFile             'Open Files
              MessageBox GetActiveWindow(), fName,"Open,You Clicked on",MB_ICONASTERISK
            'SendMessage hEdit,WM_SETTEXT,0, cast(LPARAM,strptr(fName)) 
            'load file....
            'hfile = FreeFile
            If Open( fname For Binary Access Read As #hfile ) <> 0 Then  
                    MessageBox GetActiveWindow(), "OK","Open for binary",MB_ICONASTERISK  
                'If LOF(hfile) > 0 Then       
                   txt = String(LOF(hfile), 0) ' this not work ? txt is a string 
                    MessageBox GetActiveWindow(), txt,"Len of File",MB_ICONASTERISK
                   If Get( #hfile, ,txt ) <> 0 Then 
                      SendMessage hEdit,WM_SETTEXT,0, cast(LPARAM,strptr(txt))
                      MessageBox GetActiveWindow(), "OK","Get File",MB_ICONASTERISK
                   End if     
               ' End If   
                Close #hfile
            End if 
aurelVZAB
Posts: 666
Joined: Jul 02, 2008 14:55
Contact:

Re: Open file in FileDialog problem

Post by aurelVZAB »

Ok
I finally get it to work after 5 times reading help
FB programming is somehow slow for me ...
this work ..load text into edit control ..so i expect that on same way would work
with Scintilla too.

Code: Select all

 SELECT CASE wmID
           Case  102
              fName = OpnFile             'Open Files
              MessageBox GetActiveWindow(), fName,"Open,You Clicked on",MB_ICONASTERISK
            'SendMessage hEdit,WM_SETTEXT,0, cast(LPARAM,strptr(fName)) 
            'load file....
            'hfile = FreeFile
            Open fname For Binary Access Read As #1  
                    MessageBox GetActiveWindow(), "OK","Open for binary",MB_ICONASTERISK  
                'If LOF(hfile) > 0 Then       
                   txt = String(LOF(1), 0) ' this not work ? txt is a string 
                    MessageBox GetActiveWindow(), str(LOF(1)),"Len of File",MB_ICONASTERISK
                   Get #1, ,txt  
                      SendMessage hEdit,WM_SETTEXT,0, cast(LPARAM,strptr(txt))
                      MessageBox GetActiveWindow(), "OK","Get File",MB_ICONASTERISK
                      
               ' End If   
                Close #1
             
Post Reply