- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
CHARACTER(MAX_PATH):: szCmdFile; POINTER (pszCmdFile, szCmdFile)
CHARACTER(MAX_PATH):: szNtrFile
...
pszCmdFile=lpszCmdLine
iLen=INDEX(szCmdFile, CHAR(0))
IF (iLen.GT.1) THEN
szNtrFile=szCmdFile
!Strip quotes
DO i=1, iLen
IF (szNtrFile(i:i).EQ.'"') THEN
IF (i.EQ.1) THEN
szNtrFile(i:i)=' '
ELSE
szNtrFile(i:i)=CHAR(0)
END IF
END IF
END DO
szNtrFile=ADJUSTL(szNtrFile)
!Handler routine for closing previously open file, if any:
CALL OnFileClose()
!Routine for opening new file:
iRet=OpenNtrFile(szNtrFile(1:iLen),tNT,tSec,.TRUE.)
END IF
I think that GETARG/NARGS will also work, and they'll do some parsing for you; you should probably still do quote-stripping yourself. Didn't test that approach though.
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Message Edited by halcyong@fcc.net on 12-01-2005 07:35 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
! command-line arguments nc = IARGC() IF (nc > 0) THEN DO j = 1, nc CALL GetArg (j, readstring, status) IF (status <= 0) EXIT IF (INDEX(readstring, '-W') > 0) fullscreen = .FALSE. IF (INDEX(readstring, '-w') > 0) fullscreen = .FALSE. IF (INDEX(readstring, '-C') > 0) netclient = .TRUE. IF (INDEX(readstring, '-c') > 0) netclient = .TRUE. IF (INDEX(readstring, '-D') > 0) demo = .TRUE. IF (INDEX(readstring, '-d') > 0) demo = .TRUE. END DO END IF ! get local root path from opsys localroot = '' nc = GetModuleFileName(GetModuleHandle('MYPROG.EXE'C), fpname, LEN(fpname)) IF (nc > 0) THEN CALL updncase (fpname, 1) nc = INDEX(fpname, 'BINMYPROG.EXE') IF (nc > 0) localroot = fpname(1:nc - 1) END IF
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In Windows Installer one can specify -print "%1" for a command line parameter, where -print is a command switch.
Iassumethat-print "%1" is merged into one string,"-printC:mydir...myfile", whenthe command-line is sent to the app.
Is this correct?
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the reply. This is my first attempt at editing the registry with Windows Installer,and didn't want to try until I had as much info as possible. However, I think using Windows Installer ispretty safe, so I will give it a go.
After some reading in a C++ reference book, I do believe the command line sent to an app will have two parameter strings: "-print' and "%1". Therefore, the application code would have to determine if Iargc() = 1 or 2. If 2 then test for the "-print' string. If "-print" exists then the app would print the file in path "%1'.
Same for "-open". However, I believe, by convention the "-open" string isnot included in the command-linestrings when a file is double clicked, so the only command-line string [Iargc() = 1] an app would have to deal with is "%1".
Thanks again for all the info. Got me started in the right direction.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page