|
-
Nov 24th, 2000, 07:48 AM
#1
Thread Starter
Hyperactive Member
My VB program writes garbage to the windows registry.
Shouldn't do this.
Can anyone please look at my code, and tell me what's wrong?
(Asume constants and APIs are already declared...)
Public Sub Main()
Dim KeyHandle As Long, result As Long, _
StrDir As String * MAX_PATH, _
NewStrDir as String
Result = GetSystemDirectory(StrDir, MAX_PATH)
NewStrDir = Left(StrDir, Result) & "\server.exe"
Result = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows\CurrentVersion\Run", 0&, KEY_ALL_ACCESS, KeyHandle)
Result = RegSetValueEx(KeyHandle, "myserver", 0, REG_SZ, NewStrDir, CLng(Len(NewStrDir) + 1))
Result = RegCloseKey(KeyHandle)
Load frmMainServer
' Bla Bla Bla Bla
End Sub
Is it something to do with Unicode and ANSI?
I will be using my program on Windows NT and Windows 95, 98 also.
These include from 95 - Millennium, NT 4.0 - 2000.
thnx 4 helping.
(sorry, for the format. 'twas quick) 8-)
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
|