|
-
July 22nd, 2005, 05:17 AM
#1
Load text file on memo on startup
Hi all! Im rather new to c++ and windows related applications although Im pretty good in console related applications using pascal or c.
Im trying to build a "notepad" using c++ builder and there is something i cant manage to find. I dont know how to load a text file on startup when double clicked from the windows explorer (once my program is associated with *.txt files). Instead it just opens a blank file.
How can i retrieve the path of the file i double-clicked on explorer? What event should i use to load it on startup once my program knows the path?
I know my words are a bit confusing, but dont hesitate in asking further information about my questions.
Thx all for reading.
-
July 22nd, 2005, 06:10 AM
#2
Re: Load text file on memo on startup
The full qualified path to the text file selected by the user comes via the command line. So just check lpCmdLine from your WinMain.
-
July 22nd, 2005, 12:59 PM
#3
Re: Load text file on memo on startup
Thx, that helped, but how can i use the lpCmdLine variable on an event handler function? Borland Builder wont allow me to add any more parameters to function´s declaration and it seems lpCmdLine isnt reachable from the inside (undefined). Any tips?
-
July 22nd, 2005, 05:43 PM
#4
Re: Load text file on memo on startup
Option 1:
In your app's WinMain, cache the command line string into a variable and use this variable in future.
Option 2:
Use Win32 API GetCommandLine()
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|