Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with startup EXE from Win.ini.
Message
From
04/05/2004 02:13:45
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Problem with startup EXE from Win.ini.
Miscellaneous
Thread ID:
00900613
Message ID:
00900613
Views:
87
Dear Experts

I am using VFP6 at Windows98 platform.

I took the following codes from www.foxite.com.
I use these codes to write the following command in win.ini
RUN=D:\TRAY\TRAY.EXE

When Windows startup, this exe runs automatically.

Now the problem details:
At windows startup if user presses SHIFT key then Windows bypasses this exe. As a result this exe does not run.

I want D:\TRAY\TRAY.EXE to be run with every windows startup session whether user press SHIFT key or not.

Is there anyother way to run this exe except win.ini. For example winodos registry etc. But everything must be programatically because I use the following codes in main prg file.

*--------------------------------------------------
LOCAL loIniLib, lnCount
* create our inifile object
loIniLib = CREATEOBJECT("inifile", "c:\windows\win.ini")
loIniLib.writeinivalue("WINDOWS", "RUN", "D:\TRAY\TRAY.EXE")

DEFINE CLASS inifile AS CUSTOM
cinifile = ""
nlasterror = 0
NAME = "inifile"
PROCEDURE readinivalue
* this method retrieves a value from the ini file
LPARAMETER tcSection, tcKeyName, tcIniFile
LOCAL lcIniFile, lnError, lnRetval, lcBuffer, lcRetval
IF EMPTY(tcIniFile)
lcIniFile = THIS.cinifile
ELSE
lcIniFile = tcIniFile
ENDIF
lcBuffer = SPACE(250) + CHR(0)
IF GetPrivateProfileString(tcSection, tcKeyName, "", @lcBuffer, LEN(lcBuffer), lcIniFile) > 0
* GetPrivateProfileString returns the number of characters copied to the buffer,
* not including the terminating null character.
lcRetval = ALLTRIM(CHRTRAN(lcBuffer, CHR(0), ""))
THIS.nlasterror = 0
ELSE
* retrieve the WIN32API error number
THIS.nlasterror = GetLastError()
lcRetval = ""
ENDIF
RETURN lcRetval
ENDPROC
PROCEDURE writeinivalue
* this method retrieves a value from the ini file
LPARAMETER tcSection, tcKeyName, tcValue, tcIniFile
LOCAL lcIniFile, lnError, lnRetval, lcBuffer, lnError
IF EMPTY(tcIniFile)
lcIniFile = THIS.cinifile
ELSE
lcIniFile = tcIniFile
ENDIF
lnError = WritePrivateProfileString(tcSection, tcKeyName, tcValue, lcIniFile)
* If the function successfully copies the string to the INI file, the return value is nonzero
IF lnError = 0
* retrieve the WIN32API error number
THIS.nlasterror = GetLastError()
ELSE
* call succeeded, return 0
THIS.nlasterror = 0
ENDIF
RETURN IIF(lnError = 0, THIS.nlasterror, 0)
ENDPROC
PROCEDURE clearinisection
* this method clears a complete section in the ini file
LPARAMETER tcSection, tcIniFile
LOCAL lcIniFile, lnError, lnRetval
IF EMPTY(tcIniFile)
lcIniFile = THIS.cinifile
ELSE
lcIniFile = tcIniFile
ENDIF
* clear all contents in the section
lnError = WritePrivateProfileSection(tcSection, "", lcIniFile)
* WritePrivateProfileSection returns 0 if an error has occured
IF lnError = 0
* retrieve the WIN32API error number
THIS.nlasterror = GetLastError()
ELSE
* call succeeded, return 0
THIS.nlasterror = 0
ENDIF
RETURN IIF(lnError = 0, THIS.nlasterror, 0)
ENDPROC
PROCEDURE INIT
LPARAMETER tcIniFile
IF NOT EMPTY(tcIniFile) AND TYPE("tcIniFile") = "C"
THIS.cinifile = tcIniFile
ELSE
THIS.cinifile = ""
ENDIF
* DECLARE DLL
DECLARE LONG GetPrivateProfileString IN WIN32API ;
STRING lpApplicationName, ;
STRING lpKeyName, ;
STRING lpDefault, ;
STRING @lpReturnedString, ;
LONG nSize, ;
STRING lpFileName

DECLARE LONG WritePrivateProfileString IN WIN32API ;
STRING lpApplicationName, ;
STRING lpKeyName, ;
STRING lpString, ;
STRING lpFileName

DECLARE LONG WritePrivateProfileSection IN WIN32API ;
STRING lpAppName, ;
STRING lpString, ;
STRING lpFileName

DECLARE LONG GetLastError IN WIN32API
ENDPROC
ENDDEFINE
*----------------------------------------------------
Next
Reply
Map
View

Click here to load this message in the networking platform