كيف اجعل برنامجي بمجرد تشغيله يكون مع بدء تشغيل الويندوز؟؟
*********************************************
او كيف اجعله اذا جمعته مثلا package او install sheld
ان يضع له اختصار في بدء التشغيل؟؟؟
ممكن اخوتي
كيف اجعل برنامجي بمجرد تشغيله يكون مع بدء تشغيل الويندوز؟؟
*********************************************
او كيف اجعله اذا جمعته مثلا package او install sheld
ان يضع له اختصار في بدء التشغيل؟؟؟
ممكن اخوتي
السلام عليكم
عسى ان يكون هذا هو المطلوب:-
يتم تشغيل البرنامج عن طريق الرجستري
في كل مرة يتم تشغيل وندوز
أولا : ضعي هذا الكود في موديل
'====================================='
Public 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
Public Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Public Declare Function RegCreateKeyEx Lib "advapi32.dll" Alias "RegCreateKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal Reserved As Long, ByVal lpClass As String, ByVal dwOptions As Long, ByVal samDesired As Long, lpSecurityAttributes As SECURITY_ATTRIBUTES, phkResult As Long, lpdwDisposition 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, lpType As Long, lpData As Any, lpcbData As Long) As Long ' Note that if you declare the lpData parameter as String, you must pass it By Value.
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, lpData As Any, ByVal cbData As Long) As Long ' Note that if you declare the lpData parameter as String, you must pass it By Value.
Public Type SECURITY_ATTRIBUTES
nLength As Long
lpSecurityDescriptor As Long
bInheritHandle As Long
End Type
Public Const REG_SZ = 1
Public Const KEY_WRITE = &H20006
Public Const KEY_READ = &H20019
Public Const HKEY_LOCAL_MACHINE = &H80000002
ثانيا:- ضع هذا في كوماند بوتن
'====================================='
Private Sub Command1_Click()
On Error Resume Next
Dim hregkey As Long
Dim secattr As SECURITY_ATTRIBUTES
Dim neworused As Long
Dim stringbuffer As String
Dim slength As Long
Dim retval As Long
subkey = "SoftwareMicrosoftWindowsCurrentversionrun"
secattr.nLength = Len(secattr)
secattr.lpSecurityDescriptor = 0
secattr.bInheritHandle = True
retval = RegCreateKeyEx(HKEY_LOCAL_MACHINE, subkey, 0, "", 0, KEY_WRITE, secattr, hregkey, neworused)
If retval <> 0 Then
Debug.Print "Error opening or creating registry key ---aborting"
End
End If
stringbuffer = App.Path & "" & App.EXEName & ".exe" & vbNullChar
retval = RegSetValueEx(hregkey, Trim("Display"), 0, REG_SZ, ByVal stringbuffer, Len(stringbuffer))
retval = RegCloseKey(hregkey)
Command1.Caption = "Thanx For Using Our Code"
Command1.Enabled = False
End Sub
'======================================'
هذا الموضوع مغلق.