Now for the actual problem, I suck at windows programming. Too lazy to read stuff regarding OS'es. :*(
But voodooattack was kind enough to give me some helper funnctions. After some editing, seaching this forum for the actuall datatypes (ie. Hkey****), I found them on one of yetifoot's posts. But well, it didn't work.
Any idea why?
Here are the zips.
This one is supposed to put my run my proggie at startup. But doesn't work.
Code: Select all
#include once "crt.bi"
#include once "windows.bi"
#include "win\winreg.bi"
#define HKEY_CLASSES_ROOT (CAST(HKEY, &H80000000))
#define HKEY_CURRENT_CONFIG (CAST(HKEY, &H80000005))
#define HKEY_CURRENT_USER (CAST(HKEY, &H80000001))
#define HKEY_DYN_DATA (CAST(HKEY, &H80000006))
#define HKEY_LOCAL_MACHINE (CAST(HKEY, &H80000002))
#define HKEY_PERFORMANCE_DATA (CAST(HKEY, &H80000004))
#define HKEY_USERS (CAST(HKEY, &H80000003))
const as integer CMAX_PATH = 255
Function GetExePath() as String
Dim sPath as ZString * CMAX_PATH
Call GetModuleFileName(NULL, sPath, CMAX_PATH)
Return Trim(sPath)
End Function
Sub AddToStartup(sTitle as String, sPath as string)
Dim k as HKEY
Call RegOpenKey(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Run", @k)
Call RegSetValueEx(k, STRPTR(sTitle), 0, REG_EXPAND_SZ, STRPTR(sPath), Len(sPath))
Call RegCloseKey(k)
End Sub
Function CheckStartup(sTitle as String, sPath as string)
Dim k as HKEY
Dim sVal as ZString * CMAX_PATH
Dim iLen as Integer = CMAX_PATH
sVal = Space(MAX_PATH)
Call RegOpenKey(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Run", @k)
Call RegQueryValueEx(k, STRPTR(sTitle), 0, 0, STRPTR(sVal), @iLen)
Call RegCloseKey(k)
If lcase(sVal) = lcase(sPath) then Return -1
End Function
Sub RemoveStartup(sTitle as String)
Dim k as HKEY
Call RegOpenKey(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Run", @k)
Call RegDeleteValue(k, STRPTR(sTitle))
Call RegCloseKey(k)
End Sub
AddToStartup("Password Manager", "password.exe")
Here's the whole package including the password.exe
http://fileanchor.com/46171-d
thanks.
PS. How do I disable ALT+ENTER in anf FBGFX window?
Thanks to voodoo for all his help. :*)
I would have gone to #freebasic but it won't let me enter the darn channel.