I want to run a windows startup program.
here my code: -
-
-
Public Declare Function RegCloseKey Lib "advapi32.dll" (ByVal Hkey As Long) As Long
-
Public Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal Hkey As Long, ByVal lpSubKey As String, ByVal phkResult As Long) As Long
-
Public Declare Function RegDeleteKey Lib "advapi32.dll" Alias "RegDeleteKeyA" (ByVal Hkey As Long, ByVal lpSubKey As String) As Long
-
Public Declare Function RegDeleteValue Lib "advapi32.dll" Alias "RegDeleteValueA" (ByVal Hkey As Long, ByVal lpValueName As String) As Long
-
Public Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal Hkey As Long, ByVal lpSubKey As String, ByVal phkResult As Long) As Long
-
Public Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal Hkey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, ByVal lpType As Long, ByVal lpData As String, ByVal lpcbData As Long) As Long
-
Public 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
-
Public Const REG_SZ = 1 ' Unicode nul terminated String
-
Public Const REG_DWORD = 4 ' 32-bit number
-
Public Const HKEY_CLASSES_ROOT = &H80000000
-
Public Const HKEY_CURRENT_USER = &H80000001
-
Public Const HKEY_LOCAL_MACHINE = &H80000002
-
Public Const HKEY_USERS = &H80000003
-
Public Const HKEY_PERFORMANCE_DATA = &H80000004
-
Public Const ERROR_SUCCESS = 0&
-
-
Public Sub SaveString(ByVal Hkey As Long, ByVal strPath As String, ByVal strValue As String, ByVal strdata As String)
-
Dim keyhand As Long
-
Dim r As Long
-
r = RegCreateKey(Hkey, strPath, keyhand)
-
r = RegSetValueEx(keyhand, strValue, 0, REG_SZ, strdata, Len(strdata))
-
r = RegCloseKey(keyhand)
-
End Sub
-
-
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
-
'Process.Start("c:\\startup.exe", "startup.txt")
-
SaveString(HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows\CurrentVersion\Run", _
-
"C:\Documents and Settings\vertical\Desktop\Startup\startup.txt", "C:\Documents and Settings\vertical\Desktop\Startup\startup.txt")
-
-
End Sub
when the program runs in VB.net , i get the following error
Error 1 Unable to write to output file 'C:\Documents and Settings\vertical\My Documents\startup\startup\obj\Debug\startup.exe': Access is denied.
Plz help me, i want to view the text file , How do i convert it
2 1555
probably you have already tried to run the program once.
does it end in anyway?
What you would need to do it go to task manager find the program and shut it down (it would already be running) and if it is running it is running the exe file as given in the path by you.
on building a project the exe file is created, and it can only be overwritten if it is not in use.
The exe file in not running in the task manger.
you arr not understand about my problem. when i click the start button , the error was occured directly.even not going to debug .
IN the program , when did the running path was written ? i dont know .. also i need to output in .txt file not in .exe file ,.. wat are the replacements i have do in my code. plz help me , thanks for yr reply
Sign in to post your reply or Sign up for a free account.
Similar topics
by: clr |
last post by:
I'm Using Windows XP and Visual Basic .Net 2002. When I press F5
<Debug/Start>, repeatedly, the program does not always function. However if
I consistently press F11 <Step into> and then press F5...
|
by: Chris Paul |
last post by:
I'm having trouble with PHP & PostgreSQL/OpenLDAP/Apache on Windows.
I've set this up countless times on BSD (piece of cake) but I'm trying
to do this on Windows now so that my developer can work...
|
by: duzinga |
last post by:
I am trying to have a server program that runs at startup and accepts several
commands from the clients. One of the commands is to play an audio file. I am
using...
|
by: Stealth3si |
last post by:
I hope this is the right thread /forum to place this topic in.
I'm trying to execute a .vbs file (double-click) on Windows 2000 Advanced Server with Service Pack 4 (on administrator account) and...
|
by: Jwe |
last post by:
Hi,
I've written a program which has both a command line interface
and Windows form interface, however it isn't quite working
correctly.
When run from command line with no arguments it should...
|
by: AmberJain |
last post by:
Windows Autorun FAQs: Description
NOTE- If you are unfamiliar with the concept of autoruns, then read "Windows Autorun FAQs: Overview".
Que-1: How can I safely remove or edit the autorun...
|
by: AmberJain |
last post by:
Windows Autorun FAQs: List of autostart locations
Linked from the Original article- "Windows Autorun FAQs: Description".
Que: Can you list all the autostart locations for windows?
Ans: Here is...
|
by: AmberJain |
last post by:
Windows Autorun FAQs: Programs dealing with autoruns
Linked from the Original article- "Windows Autorun FAQs: Description".
Que: Can you list programs that help me to view/modify the autoruns...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |