|
-
Feb 8th, 2010, 08:02 PM
#1
Thread Starter
New Member
How do i save program state?
I'm new to this forum, so please tell me if I'm posting in the wrong place...
I am making a program for my workplace. The program is going to close explorer.exe on start up and launch only applications i select. (I know that there are other ways to do this, but I'm getting paid to make a custom program W/ Co. Logo)
-------------------------------------------------------------
1st question: How do i make the program close explorer.exe on start up
2nd question: End users will be able to change the background of this app. My question is, How do i save the background the end user pick on program exit and load it on program start?
any code will help..... thx in advanced, Jake.

My Code - (keep in mind that its not finished yet )
------------
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ColorDialog1.ShowDialog()
Me.BackColor = ColorDialog1.Color
End Sub
______________________________________________________________
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Process.Start("Notepad.exe")
End Sub
____________________________________________________________
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Process.Start("C:\Program Files\Internet Explorer\iexplore.exe")
End Sub
______________________________________________________________
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim t As Single
Dim objWMIService, objComputer As Object
'Now get some privileges
objWMIService = GetObject("Winmgmts:{impersonationLevel=impersonate,(Debug,Shutdown)}")
For Each objComputer In objWMIService.InstancesOf("Win32_OperatingSystem")
t = objComputer.Win32Shutdown(0, 0)
If t <> 0 Then
MsgBox("Error occurred!!!")
Else
'LogOff your system
End If
Next
End Sub
______________________________________________________________
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Dim t As Single
Dim objWMIService, objComputer As Object
'Now get some privileges
objWMIService = GetObject("Winmgmts:{impersonationLevel=impersonate,(Debug,Shutdown)}")
For Each objComputer In objWMIService.InstancesOf("Win32_OperatingSystem")
t = objComputer.Win32Shutdown(8 + 4, 0)
If t <> 0 Then
MsgBox("Error occurred!!!")
Else
'LogOff your system
End If
Next
End Sub
______________________________________________________________
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
Dim t As Single
Dim objWMIService, objComputer As Object
'Now get some privileges
objWMIService = GetObject("Winmgmts:{impersonationLevel=impersonate,(Debug,Shutdown)}")
For Each objComputer In objWMIService.InstancesOf("Win32_OperatingSystem")
t = objComputer.Win32Shutdown(2 + 4, 0)
If t <> 0 Then
MsgBox("Error occurred!!!")
Else
'LogOff your system
End If
Next
End Sub
______________________________________________________________
Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click
Process.Start("C:\Program Files\Internet Explorer\iexplore.exe")
End Sub
______________________________________________________________
Private Sub PictureBox2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox2.Click
Process.Start("notepad.exe")
End Sub
______________________________________________________________
Private Sub SaveFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs)
______________________________________________________________
End Sub
Private Sub Button2_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
WebBrowser1.Navigate(TextBox1.Text)
End Sub
______________________________________________________________
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
End Sub
______________________________________________________________
End Class
-
Feb 9th, 2010, 01:16 AM
#2
Re: How do i save program state?
Next time, wrap your program's code in [code ][/code] blocks. helps out a lot.
1st Question: Don't recommend this, but it looks like you're working on an....explorer rewrite? I don't recommend doing this step until your program is more stable.
2nd Question: Look into My.Settings
-
Feb 9th, 2010, 01:20 AM
#3
Re: How do i save program state?
or even better wrap in [H IGHLIGHT="vb"][/H IGHLIGHT] ... with out the space between h and i ... to syntax color
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
|