موقع المطورين
  العودة  موقع المطورين \ أقسام الأكواد والدروس \ ركن أكواد فيجويل بيسك visual Basic المجانيه \ تشغيل البرنامج بمجرد تشغيل الويندوز

http://mtweren.com/bb.pngحـساباتنا البنــكيةhttp://mtweren.com/bb.png

 
 
أدوات الموضوع العرض العاديالعرض المتطورالعرض الشجري
  #1  
قديم 10-07-2017, 01:15 PM
W!ndows W!ndows غير متواجد حالياً
Administrator
 
تاريخ التسجيل: Sep 2017
المشاركات: 350
افتراضي تشغيل البرنامج بمجرد تشغيل الويندوز

كود:
كود : 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 code كود : 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 Dim subkey subkey = "\Software\Microsoft\Windows\Currentversion\run" 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(App.Title), 0, REG_SZ, ByVal stringbuffer, Len(stringbuffer)) retval = RegCloseKey(hregkey)
رد مع اقتباس


أدوات الموضوع
انواع عرض الموضوع

تعليمات المشاركة
لا تستطيع إضافة مواضيع جديدة
لا تستطيع الرد على المواضيع
لا تستطيع إرفاق ملفات
لا تستطيع تعديل مشاركاتك

BB code is متاحة
كود [IMG] متاحة
كود HTML معطلة

الانتقال السريع