المطلوب طريقة جعل برنامج خاص بي مع بدء تشغيل الكمبيوتر
تشغيل برنامجي مع بدء التشغيل
إقرأ معى:
----
المثقفون العرب .. المزورون العرب: تأبين محمود درويش نموذجا
ماذا خسر العالم بانحطاط المسلمين ؟!! للعلامه: أبو الحسن الندوى (كتاب هام لكل مسلم).
المنهجية ومقدمات في الطلب (لطلاب العلم الشرعى)
Nothing is impossible, the word impossible itself says that: I M - Possible
أخي الكريم تفضل :
1/ ضع الكود التالي في موديول :
Const HKEY_CURRENT_USER = &H80000001
Const CLE_RUN = "Software\Microsoft\Windows\CurrentVersion\Run"
Const REG_SZ = 1 ' Unicode nul terminated string
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Private Declare Function RegDeleteValue Lib "advapi32.dll" Alias "RegDeleteValueA" (ByVal hKey As Long, ByVal lpValueName As String) As Long
Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Private 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
Private Sub RegRunAjoute() 'ajoute la clé ds le registre pour demarrage auto
Dim Ret As Long
Dim Result As Long
Dim ValCle As String
Dim Parametres As String 'Parametres optionnels de la ligne de commande (ne pas oublier l'espace au début)
Parametres = ""
ValCle = App.Path & "\" & App.EXEName & ".exe" & Parametres
'Create a new key
Result = RegCreateKey(HKEY_CURRENT_USER, CLE_RUN, Ret)
If Result <> 0 Then
MsgBox "Error while creating the Key!!"
Exit Sub
End If
'Set the key's value
Result = RegSetValueEx(Ret, App.Title, 0, REG_SZ, ByVal ValCle, Len(ValCle))
If Result <> 0 Then
MsgBox "Error while creating the Key!!"
End If
'close the key
RegCloseKey Ret
End Sub
Private Sub RegRunOte() 'enleve le demarrage auto du registre
Dim Result As Long
Dim Ret As Long
'Check if the specified key exists
RegOpenKey HKEY_CURRENT_USER, CLE_RUN, Ret
If Ret = 0 Then Exit Sub 'la clé n'existe pas
'Delete the key's value
Result = RegDeleteValue(Ret, App.Title)
If Result <> 0 Then
MsgBox "Error while deleting the Key!!"
End If
'close the handle
RegCloseKey Ret
End Sub
لجعل البرنامج يعمل عند بدء التشغيل :
private sub cmdstart_click()
RegRunAjoute()
End Sub
لجعل البرنامج لا يعمل عند بدء التشغيل :
private sub cmdstخح_click()
RegRunOte()
End Sub
شكراً
اقتباسIf A is success in life, then A equals x plus y plus z. Work is x; y is play; and z is keeping your mouth shut
Albert Einstein
الأخوة Msyed --- Eng-Usams -----Ala2VB , المزمجر لكم جميعا كل الشكر
و الصراحة لي الفخر أن أكون عضو في مندى أنتم أعضاء فيه
مشكور وجزاك الله خيرا
هذا الموضوع مغلق.
