Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

k this is what i wanna do.. plz help!

Status
Not open for further replies.

TDogg

MIS
Dec 11, 2000
11
US
i want this program to change system.ini under "[boot]" from "shell=explorer.exe" to "shell=myprogram.exe".. then reboot.. one it reboots.. have it check to see if "shell=myprogram.exe".. if it does it will run another program.. once that program is done it changes the shell back to "shell=explorer.exe" and reboots again.
 
Hello..,
I give you some "raw materials", and will you "cook" it based on your tastes


Private Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long

Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long



Private Function GetIT()
Dim ss As String * 128
Dim n As Integer
n = GetPrivateProfileString("boot", "shell", "", ss, 128, "c:\windows\system.ini")

GetIT = Left(ss, n)
' remember to store somewhere for later use
End function


Private Function TellIT()
dim n as Integer
n = WritePrivateProfileString("boot", "shell", "Myexe.exe", "c:\windows\system.ini")
' done
End Sub



Now, you just reboot PC by ExitWindows() API

Hope it helps. If anything is not clear, pls reply message

Jimmy
smiletiniest.gif
 
TDogg, perhaps if you tell us what you intend to do with the "other" program we could suggest an easier, and perhaps, less dangerous approach.

It is a fairly simple matter to launch a program at startup intended to control the desktop. This seems to be what you are trying to do. It is not so easy to write an Explorer shell replacement. It can be done, in fact, it is very easy to write an MS-DOS program that replaces Windows as the boot shell. But why would you want to do that? One can almost always find easier ways to accomplish a task if he steps back and considers the practicality of his approach, rather than the methods required to perform the task.
VCA.gif

Alt255@Vorpalcom.Intranets.com
 
that thing changes system.ini to read

shell=shell=C:\Windows\Explorer.exe
why 2 shells?

this is what i have:
n = WritePrivateProfileString("boot", "shell", WinDir$ & "\Explorer.exe", WinDir$ & "\system.ini")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top