Lost Password?

Go Back   CodeCall Programming Forum > Software Development > Visual Basic Programming

Visual Basic Programming Discussion forum for Visual Basic, an event driven programming language and associated development environment from Microsoft for its COM programming model.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #11 (permalink)  
Old 11-02-2007, 02:41 PM
Lop's Avatar   
Lop Lop is offline
Speaks fluent binary
 
Join Date: May 2006
Posts: 1,135
Rep Power: 15
Lop is on a distinguished road
Default

Are you using an installer for your program or do you want to clone your program once it is ran?
__________________
Lop
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #12 (permalink)  
Old 11-05-2007, 10:17 AM
TcM's Avatar   
TcM TcM is offline
Terminator - I'll be back
 
Join Date: Aug 2006
Location: In a technologic world :p
Posts: 5,748
Rep Power: 47
TcM is a jewel in the roughTcM is a jewel in the roughTcM is a jewel in the rough
Default

Ok so I found this and made it into a module, now just import the module into your project and use it as follows

Code:
Regedt True
Loads at startup if true or false so it does not load at startup

Hope it helped.
Attached Files To view attachments your post count must be 1 or greater. Your post count is 0 momentarily.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall


Business Directory | Technology Blog | Windows Help
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #13 (permalink)  
Old 11-05-2007, 10:20 AM
kresh7 kresh7 is offline
Learning Programmer
 
Join Date: Jun 2007
Posts: 99
Rep Power: 4
kresh7 is on a distinguished road
Default

nice tutorial
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #14 (permalink)  
Old 11-05-2007, 10:40 AM
TcM's Avatar   
TcM TcM is offline
Terminator - I'll be back
 
Join Date: Aug 2006
Location: In a technologic world :p
Posts: 5,748
Rep Power: 47
TcM is a jewel in the roughTcM is a jewel in the roughTcM is a jewel in the rough
Default

Thanks for the compliment
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall


Business Directory | Technology Blog | Windows Help
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #15 (permalink)  
Old 11-05-2007, 06:06 PM
zuric zuric is offline
Newbie
 
Join Date: Nov 2007
Posts: 2
Rep Power: 0
zuric is on a distinguished road
Default WoW

Wow thanks that has heled my problem too lol 2 birds with one coder
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #16 (permalink)  
Old 11-06-2007, 04:12 AM
TcM's Avatar   
TcM TcM is offline
Terminator - I'll be back
 
Join Date: Aug 2006
Location: In a technologic world :p
Posts: 5,748
Rep Power: 47
TcM is a jewel in the roughTcM is a jewel in the roughTcM is a jewel in the rough
Default

Haha, thanks! Actually I help everyone in here (try to) anyways so if you have any questions just make a new Thread in here and I'll do my best
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall


Business Directory | Technology Blog | Windows Help
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #17 (permalink)  
Old 11-22-2007, 01:26 PM
eyadox eyadox is offline
Newbie
 
Join Date: Nov 2007
Posts: 1
Rep Power: 0
eyadox is on a distinguished road
Thumbs up Startup Code

The following code will run your program at startup, without making a shortcut in the startup folder. This code is actually put your program in the registery in Software\Microsoft\Windows\CurrentVersion\Run.

To make your program run at startup only once (only at the first time you startup the computer after running this code) You should put your program at 'Software\Microsoft\Windows\CurrentVersion\RunOnce . To do so

>> Replace the 'two appearance of '...CurrentVersion\Run' in this code with '...CurrentVersion\RunOnce' Add a module to your project (In the menu choose Project -> Add Module Then click Open)
>> Add 2 Command Buttons To your Form. Press the first button to make your program run at startup. Press the seco and to delete it from running at startup.

Insert the following code to your module :
************************************
Code:
Public Type SECURITY_ATTRIBUTES 
nLength As Long 
lpSecurityDescriptor As Long 
bInheritHandle As Long 
End Type 

Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" _ 
(ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, _ 
ByVal samDesired As Long, phkResult As Long) As Long 
Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long 
Declare Function RegQueryValueEx Lib "advapi32" Alias "RegQueryValueExA" _ 
(ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As _ 
Long, ByRef lpType As Long, ByVal lpData As String, ByRef lpcbData As Long) As Long 
Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal _ 
hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal _ 
dwType As Long, ByVal lpData As String, ByVal cbData As Long) As Long 
Declare Function RegDeleteValue Lib "advapi32.dll" Alias "RegDeleteValueA" _ 
(ByVal hKey As Long, ByVal lpValueName As String) As Long 
Public Enum T_KeyClasses 
HKEY_CLASSES_ROOT = &H80000000 
HKEY_CURRENT_CONFIG = &H80000005 
HKEY_CURRENT_USER = &H80000001 
HKEY_LOCAL_MACHINE = &H80000002 
HKEY_USERS = &H80000003 
End Enum 

Private Const SYNCHRONIZE = &H100000 
Private Const STANDARD_RIGHTS_ALL = &H1F0000 
Private Const KEY_QUERY_VALUE = &H1 
Private Const KEY_SET_VALUE = &H2 
Private Const KEY_CREATE_LINK = &H20 
Private Const KEY_CREATE_SUB_KEY = &H4 
Private Const KEY_ENUMERATE_SUB_KEYS = &H8 
Private Const KEY_EVENT = &H1 
Private Const KEY_NOTIFY = &H10 
Private Const READ_CONTROL = &H20000 
Private Const STANDARD_RIGHTS_READ = (READ_CONTROL) 
Private Const STANDARD_RIGHTS_WRITE = (READ_CONTROL) 
Private Const KEY_ALL_ACCESS = ((STANDARD_RIGHTS_ALL Or _ 
KEY_QUERY_VALUE Or KEY_SET_VALUE Or KEY_CREATE_SUB_KEY _ 
Or KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY Or KEY_CREATE_LINK) _ 
And (Not SYNCHRONIZE)) 
Private Const KEY_READ = ((STANDARD_RIGHTS_READ Or _ 
KEY_QUERY_VALUE Or KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY) _ 
And (Not SYNCHRONIZE)) 
Private Const KEY_EXECUTE = (KEY_READ) 
Private Const KEY_WRITE = ((STANDARD_RIGHTS_WRITE Or _ 
KEY_SET_VALUE Or KEY_CREATE_SUB_KEY) And (Not SYNCHRONIZE)) 
Private Const REG_BINARY = 3 
Private Const REG_CREATED_NEW_KEY = &H1 
Private Const REG_DWORD = 4 
Private Const REG_DWORD_BIG_ENDIAN = 5 
Private Const REG_DWORD_LITTLE_ENDIAN = 4 
Private Const REG_EXPAND_SZ = 2 
Private Const REG_FULL_RESOURCE_DESCRIPTOR = 9 
Private Const REG_LINK = 6 
Private Const REG_MULTI_SZ = 7 
Private Const REG_NONE = 0 
Private Const REG_SZ = 1 
Private Const REG_NOTIFY_CHANGE_ATTRIBUTES = &H2 
Private Const REG_NOTIFY_CHANGE_LAST_SET = &H4 
Private Const REG_NOTIFY_CHANGE_NAME = &H1 
Private Const REG_NOTIFY_CHANGE_SECURITY = &H8 
Private Const REG_OPTION_BACKUP_RESTORE = 4 
Private Const REG_OPTION_CREATE_LINK = 2 
Private Const REG_OPTION_NON_VOLATILE = 0 
Private Const REG_OPTION_RESERVED = 0 
Private Const REG_OPTION_VOLATILE = 1 
Private Const REG_LEGAL_CHANGE_FILTER = (REG_NOTIFY_CHANGE_NAME _ 
Or REG_NOTIFY_CHANGE_ATTRIBUTES Or _ 
REG_NOTIFY_CHANGE_LAST_SET Or _ 
REG_NOTIFY_CHANGE_SECURITY) 
Private Const REG_LEGAL_OPTION = (REG_OPTION_RESERVED Or _ 
REG_OPTION_NON_VOLATILE Or REG_OPTION_VOLATILE Or _ 
REG_OPTION_CREATE_LINK Or REG_OPTION_BACKUP_RESTORE) 

Public Sub DeleteValue(rClass As T_KeyClasses, Path As String, sKey As String) 
Dim hKey As Long 
Dim res As Long 
res = RegOpenKeyEx(rClass, Path, 0, KEY_ALL_ACCESS, hKey) 
res = RegDeleteValue(hKey, sKey) 
RegCloseKey hKey 
End Sub 

Public Function SetRegValue(KeyRoot As T_KeyClasses, Path As String, sKey As _ 
String, NewValue As String) As Boolean 
Dim hKey As Long 
Dim KeyValType As Long 
Dim KeyValSize As Long 
Dim KeyVal As String 
Dim tmpVal As String 
Dim res As Long 
Dim i As Integer 
Dim x As Long 
res = RegOpenKeyEx(KeyRoot, Path, 0, KEY_ALL_ACCESS, hKey) 
If res <> 0 Then GoTo Errore 
tmpVal = String(1024, 0) 
KeyValSize = 1024 
res = RegQueryValueEx(hKey, sKey, 0, KeyValType, tmpVal, KeyValSize) 
Select Case res 
Case 2 
KeyValType = REG_SZ 
Case Is <> 0 
GoTo Errore 
End Select 
Select Case KeyValType 
Case REG_SZ 
tmpVal = NewValue 
Case REG_DWORD 
x = Val(NewValue) 
tmpVal = "" 
For i = 0 To 3 
tmpVal = tmpVal & Chr(x Mod 256) 
x = x \ 256 
Next 
End Select 
KeyValSize = Len(tmpVal) 
res = RegSetValueEx(hKey, sKey, 0, KeyValType, tmpVal, KeyValSize) 
If res <> 0 Then GoTo Errore 
SetRegValue = True 
RegCloseKey hKey 
Exit Function 
Errore: 
SetRegValue = False 
RegCloseKey hKey 
End Function 

'Insert the following code to your form: 

Private Sub Command1_Click() 
'Replace the two 'NotePad' below with your application name, and the two 
'c:\windows\notepad.exe' below with your application file. 
SetRegValue HKEY_LOCAL_MACHINE, _ 
"Software\Microsoft\Windows\CurrentVersion\Run", "NotePad", "c:\windows\notepad.exe" 
End Sub 

Private Sub Command2_Click() 
DeleteValue HKEY_LOCAL_MACHINE, _ 
"Software\Microsoft\Windows\CurrentVersion\Run", "NotePad" 
End Sub
******************************

That's a easy api for Visual Basic to run your application when windows starts, without leaving any shortcut in the start up folder for the user to delete easily!

Last edited by TcM; 01-17-2008 at 11:36 AM. Reason: Please Use Code Tags.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #18 (permalink)  
Old 11-23-2007, 01:29 AM
TcM's Avatar   
TcM TcM is offline
Terminator - I'll be back
 
Join Date: Aug 2006
Location: In a technologic world :p
Posts: 5,748
Rep Power: 47
TcM is a jewel in the roughTcM is a jewel in the roughTcM is a jewel in the rough
Default

Lol that is way too long! And use the code tags.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall


Business Directory | Technology Blog | Windows Help
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #19 (permalink)  
Old 01-17-2008, 10:51 AM
ckpro ckpro is offline
Newbie
 
Join Date: Jan 2008
Posts: 1
Rep Power: 0
ckpro is on a distinguished road
Default

Yo, thanks for this. I have been looking for one for ages.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #20 (permalink)  
Old 01-17-2008, 11:37 AM
TcM's Avatar   
TcM TcM is offline
Terminator - I'll be back
 
Join Date: Aug 2006
Location: In a technologic world :p
Posts: 5,748
Rep Power: 47
TcM is a jewel in the roughTcM is a jewel in the roughTcM is a jewel in the rough
Default

Welcome
If you found this useful please leave some + rep for my post.

Thanks
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall


Business Directory | Technology Blog | Windows Help
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Best program for SQL database manipulation Rhadamanthys Database & Database Programming 3 07-02-2007 02:32 PM
How do I Program another Program? ! bosco General Programming 1 06-15-2007 11:15 AM
Need help w/ word count program (ASAP) siren C and C++ 1 04-23-2007 08:14 AM
How to modify a program written in .NET 2.0? jackyjack C# Programming 7 03-27-2007 12:26 PM


All times are GMT -5. The time now is 01:28 AM.

Contest Stats

dargueta ........ 93.00000
John ........ 87.50000
Xav ........ 70.00000
MeTh0Dz ........ 20.00000
gaylo565 ........ 18.00000
Johnnyboy ........ 3.00000

Contest Rules

Ads