I made program to view 'log' files. But I don't know how to open it in my program by double-clicking it in Windows(98)
Can someone please help me??
(The one that will help me will get free football game that I made :)
Printable View
I made program to view 'log' files. But I don't know how to open it in my program by double-clicking it in Windows(98)
Can someone please help me??
(The one that will help me will get free football game that I made :)
There is two ways:
1. Open the file in NotePad use that code:
private Sub OpenFile(sFileName as string)
Shell "Notepad.exe " & sFile, vbNormalFocus
End Sub
2. Open the file into some TextBox in your program. You have to Use FileSystemObject Try this Code:
private Sub OpenFile(sFileName as string)
Dim ObjFileSys as new Scripting.FileSystemObject
Dim ObjFile as Scripting.File, ObjStream as Scripting.TextStream
Dim strFile as string
'get the file
set ObjFile = ObjFileSys.GetFile(sFileName)
set ObjStream = ObjFile.OpenAsTextStream(ForReading)
strFile = ObjStream.ReadAll
'Show the file in the textbox
Text1.Text = strFile
End Sub
I hope it help you.
Notice me if is (or not).
Don't forget the football game !!!
You need to "Associate" the filename .log with your application.
First make sure your app accepts the filename as a command line parameter.
Then in Explorer choose the View:Options menu,
switch the resulting box to File Types and press the New Type button to create the new association.
Once this is set up then double-clicking a .log file will launch it with your application.
HTH,
Duncan
-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com