الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

اكواد جديدة

مغلق
بدأه walid_t22t في 26 يونيو 2004 · 7 رد · 1,236 مشاهدة · في لغة Ms Visual Basic 6 وما قبلها من إصدارات
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم

اسف على التأخير

هده مجموعه جديدة من الاكواد إن شاء الله تعجب الجميع

كود يعمل اتصال باالانترنت

'Place the following code under a command button or in a menu, etc...

Dim X

'"MyConnectionsName" is the name under the icon in Dial-up Networking

X = Shell("rundll32.exe rnaui.dll,RnaDial " & "MyConnectionsName", 1)

DoEvents

'You can type in your password before the { below.

SendKeys "{enter}", True

DoEvents

'End Sub

#2

تنزيل ملف من الانترنت بالفيجول

Declarations

Private Declare Function URLDownloadToFile Lib "urlmon" Alias _

"URLDownloadToFileA" (ByVal pCaller As Long, _

ByVal szURL As String, _

ByVal szFileName As String, _

ByVal dwReserved As Long, _

ByVal lpfnCB As Long) As Long

)))))))

Public Function DownloadFile(URL As String, _

LocalFilename As String) As Boolean

Dim lngRetVal As Long

lngRetVal = URLDownloadToFile(0, URL, LocalFilename, 0, 0)

If lngRetVal = 0 Then DownloadFile = True

End Function

Private Sub Form_Load() 'replace the first argument with the URL of the file you want to download, ' and the second argument with the local file you want to save this file to. ret = DownloadFile("http://www25.brinkster.com/ihab/arabmap/so1over.gif", _

"c:\filename.gif")

End Sub

#3

لأخفاء البرنامج من قائمة ctrl+alt+del

Declarations

Option Explicit

Private Const RSP_SIMPLE_SERVICE = 1

Private Const RSP_UNREGISTER_SERVICE = 0

Private Declare Function GetCurrentProcessId Lib "kernel32" () As Long

Private Declare Function RegisterServiceProcess Lib "kernel32" _

(ByVal dwProcessID As Long, ByVal dwType As Long) As Long

Private Declare Function GetCurrentProcess Lib "kernel32" () As Long

******

code

Private Sub HideApp(lbValue As Boolean)

Dim lngProcessID As Long

Dim lngReturn As Long

lngProcessID = GetCurrentProcessId()

If lbValue Then

lngReturn = RegisterServiceProcess(pid, RSP_SIMPLE_SERVICE)

Else

lngReturn = RegisterServiceProcess(pid, RSP_UNREGISTER_SERVICE)

End If

End Sub

#4

This Will Disable Ctrl + Alt + Del, Alt + Tab, And Ctrl + Esc For Whatever Purpose You May Need

Declarations

Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, lpvParam As Any, ByVal fuWinIni As Long) As Long

****

code

Dim lReturn As Long

Dim lBool As Long

lReturn = SystemParametersInfo(97, False, lBool, vbNull)

#5

اجعل برنامجك يشتغل مع تشغيل الويندوز عن طريق الريجيستري

Add your program to the registry to startup when windows starts

Declarations

*********

'To use the procedures here's an example;

'---------

'If StartUp Then

' Call MakeStartUp(AddFile(App.Path, (App.EXEName & ".exe")))

'Else

' Call DeleteFromStartup(AddFile(App.Path, (App.EXEName & ".exe")))

'End If

'==================================

Option Explicit

Public Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long

Public Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long

Public Declare Function RegDeleteKey Lib "advapi32.dll" Alias "RegDeleteKeyA" (ByVal hKey As Long, ByVal lpSubKey As String) As Long

Public Declare Function RegDeleteValue Lib "advapi32.dll" Alias "RegDeleteValueA" (ByVal hKey As Long, ByVal lpValueName As String) As Long

Public Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult 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

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

Public Const REG_SZ = 1 ' Unicode nul terminated String

Public Const REG_DWORD = 4 ' 32-bit number

Public Const HKEY_CLASSES_ROOT = &H80000000

Public Const HKEY_CURRENT_USER = &H80000001

Public Const HKEY_LOCAL_MACHINE = &H80000002

Public Const HKEY_USERS = &H80000003

Public Const HKEY_PERFORMANCE_DATA = &H80000004

Public Const ERROR_SUCCESS = 0&

'Option Explicit

Const UNIT_NAME = "UTILITY"

*******

code

Public Sub MakeStartUp(FileName As String)

Dim Counter As Integer

Dim MarkPos As Integer

Dim Application As String

Application = GetFileName(FileName)

Application = Left(Application, (Len(Application) - 4)) 'Replace(Application, ".exe", "", , , vbTextCompare) & "~@#"

Call SaveString(HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows\CurrentVersion\Run", Application, FileName)

End Sub

Public Sub SaveKey(hKey As Long, strPath As String)

Dim KeyHand&

Dim r As Long

r = RegCreateKey(hKey, strPath, KeyHand&)

r = RegCloseKey(KeyHand&)

End Sub

Public Function GetString(hKey As Long, strPath As String, strValue As String)

'EXAMPLE:

'

'text1.text = getstring(HKEY_CURRENT_USE

'

' R, "Software\VBW\Registry", "String")

'

Dim KeyHand As Long

Dim datatype As Long

Dim lResult As Long

Dim strBuf As String

Dim lDataBufSize As Long

Dim intZeroPos As Integer

Dim r As Long

Dim lValueType As Long

r = RegOpenKey(hKey, strPath, KeyHand)

lResult = RegQueryValueEx(KeyHand, strValue, 0&, lValueType, ByVal 0&, lDataBufSize)

If lValueType = REG_SZ Then

strBuf = String(lDataBufSize, " ")

lResult = RegQueryValueEx(KeyHand, strValue, 0&, 0&, ByVal strBuf, lDataBufSize)

If lResult = ERROR_SUCCESS Then

intZeroPos = InStr(strBuf, Chr$(0))

If intZeroPos > 0 Then

GetString = Left(strBuf, intZeroPos - 1)

Else

GetString = strBuf

End If

End If

End If

End Function

Public Sub SaveString(hKey As Long, strPath As String, strValue As String, strdata As String)

'EXAMPLE:

'

'Call savestring(HKEY_CURRENT_USER, "Sof

'

' tware\VBW\Registry", "String", text1.t

' ex

' t)

'

Dim KeyHand As Long

Dim r As Long

r = RegCreateKey(hKey, strPath, KeyHand)

r = RegSetValueEx(KeyHand, strValue, 0, REG_SZ, ByVal strdata, Len(strdata))

r = RegCloseKey(KeyHand)

End Sub

Function GetDWord(ByVal hKey As Long, ByVal strPath As String, ByVal strValueName As String) As Long

'EXAMPLE:

'

'text1.text = getdword(HKEY_CURRENT_USER

'

' , "Software\VBW\Registry", "Dword")

'

Dim lResult As Long

Dim lValueType As Long

Dim lBuf As Long

Dim lDataBufSize As Long

Dim r As Long

Dim KeyHand As Long

r = RegOpenKey(hKey, strPath, KeyHand)

' Get length/data type

lDataBufSize = 4

lResult = RegQueryValueEx(KeyHand, strValueName, 0&, lValueType, lBuf, lDataBufSize)

If lResult = ERROR_SUCCESS Then

If lValueType = REG_DWORD Then

GetDWord = lBuf

End If

'Else

'Call errlog("GetDWORD-" & strPath, Fals

'

' e)

End If

r = RegCloseKey(KeyHand)

End Function

Function SaveDword(ByVal hKey As Long, ByVal strPath As String, ByVal strValueName As String, ByVal lData As Long)

'EXAMPLE"

'

'Call SaveDword(HKEY_CURRENT_USER, "Soft

'

' ware\VBW\Registry", "Dword", text1.tex

' t)

'

'

Dim lResult As Long

Dim KeyHand As Long

Dim r As Long

r = RegCreateKey(hKey, strPath, KeyHand)

lResult = RegSetValueEx(KeyHand, strValueName, 0&, REG_DWORD, lData, 4)

'If lResult <> error_success Then

' Call errlog("SetDWORD", False)

r = RegCloseKey(KeyHand)

End Function

Public Function DeleteKey(ByVal hKey As Long, ByVal strKey As String)

'EXAMPLE:

'

'Call DeleteKey(HKEY_CURRENT_USER, "Soft

'

' ware\VBW")

'

Dim r As Long

r = RegDeleteKey(hKey, strKey)

End Function

Public Function DeleteValue(ByVal hKey As Long, ByVal strPath As String, ByVal strValue As String)

'EXAMPLE:

'

'Call DeleteValue(HKEY_CURRENT_USER, "So

'

' ftware\VBW\Registry", "Dword")

'

Dim KeyHand As Long

Dim r As Long

r = RegOpenKey(hKey, strPath, KeyHand)

r = RegDeleteValue(KeyHand, strValue)

r = RegCloseKey(KeyHand)

End Function

Public Sub DeleteFromStartup(FileName As String)

Dim Counter As Integer

Dim MarkPos As Integer

Dim Application As String

Application = GetFileName(FileName)

Application = Left(Application, (Len(Application) - 4)) 'Replace(Application, ".exe", "", , , vbTextCompare) & "~@#"

Call DeleteValue(HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows\CurrentVersion\Run", Application)

End Sub

Public Function GetFileName(Path As String) As String

'returnes the filename from a path.

Dim Counter As Integer

Dim LastPos As Integer

LastPos = 1

For Counter = 1 To Len(Path)

If Mid(Path, Counter, 1) = "\" Then

LastPos = Counter

End If

Next Counter

GetFileName = Mid(Path, (LastPos + 1), Len(Path))

End Function

Public Function AddFile(Path As String, File As String) As String

'This procedure adds a file name to a path.

If Right(Path, 2) = ":\" Then

Path = Path & File

Else

Path = Path & "\" & File

End If

AddFile = Path

End Function

#6

اعطي برنامجك فترة محدودة

Giving days limit to your Shareware Program (30 days only).

decleration

no

*******

code

'COPY THESE CODES TO YOUR SPLASHSCREEN

'COPY THESE CODES TO YOUR SPLASHSCREEN

'COPY THESE CODES TO YOUR SPLASHSCREEN

'COPY THESE CODES TO YOUR SPLASHSCREEN

'APPLICABLE IN activate or load event

'APPLICABLE IN activate or load event

Dim startdate As String

Dim differenceofdate

Dim TRACEDATE As String

Dim newdate

Dim chk

If GetSetting(App.Title, "Startup", "counter", "") = "" Then

SaveSetting App.Title, "Startup", "counter", 1

SaveSetting App.Title, "Startup", "Started", Format(Date, "mm dd yyyy")

SaveSetting App.Title, "Startup", "Last Used", Format(Date, "mm dd yyyy")

lblcnt.Caption = "1"

ElseIf GetSetting(App.Title, "Startup", "counter", "") = "31" Then

MsgBox "Thank you for using this trial SOFTWARE!!" & Chr(10) + Chr(13) & "Please STOP running this system or else all data had been entered will lost.", vbCritical, "Thank you"

End

Else

TRACEDATE = GetSetting(App.Title, "Startup", "Last Used", "")

chk = DateDiff("d", CDate(TRACEDATE), Now)

If chk < 0 Then 'CHECK IF THE DATE WAS CHANGE which is lesser than the PREVIOUS DATE WHERE THE SYSTEM USED.

MsgBox "Your system date is invalid." & Chr(10) + Chr(13) & "Please change it right now or else you will nolonger use this software anymore!!", vbCritical, "Invalid date"

End

Else

startdate = GetSetting(App.Title, "Startup", "Started", "")

differenceofdate = DateDiff("d", startdate, Now)

If differenceofdate <> 0 Then

lblcnt.Caption = differenceofdate + 1

SaveSetting App.Title, "Startup", "Last Used", Format(Now, "MM DD YYYY")

SaveSetting App.Title, "Startup", "counter", differenceofdate + 1

End If

If differenceofdate = 0 Then

lblcnt.Caption = GetSetting(App.Title, "Startup", "Counter", "")

End If

End If

End If

End Sub

#7

طريقة بسيطة لتخزين الباسورد في الريجستري

Simple way to store the password to Registry

Declarations

noooo

*******

code

'''''''to save the contents''''''''''''''

savesetting "buLLs","software","username","password"

''''''''''to get from.........

msgbox getsetting("buLLs","software","username")

''''''''''here u will get the password stored at buLLs,software

#8

طريقة اخرى لتخزين الباسورد في الريجستري وقراءتها كل ما يستعمل البرنامج

This very simple, yet useful code is a password program, using the registry to keep the password. So everytime you open the program, it will read the password from the registry, and see if the password you enterd is currect.

Declarations

'I got this module from another snip code, thanks time_to_burn_uk@hotmail.com.

'PLACE ALL THIS INTO A NEW MODULE or IN Declarations OF YOUR FORM

Public Sub CreateKey(Folder As String, Value As String)

Dim b As Object

On Error Resume Next

Set b = CreateObject("wscript.shell")

b.RegWrite Folder, Value

End Sub

Public Sub CreateIntegerKey(Folder As String, Value As Integer)

Dim b As Object

On Error Resume Next

Set b = CreateObject("wscript.shell")

b.RegWrite Folder, Value, "REG_DWORD"

End Sub

Public Function ReadKey(Value As String) As String

'READ FROM WINDOWS REGISTRY

'.........................

Dim b As Object

On Error Resume Next

Set b = CreateObject("wscript.shell")

r = b.RegRead(Value)

ReadKey = r

End Function

Public Sub DeleteKey(Value As String)

'DELETE VALUES FROM WINDOWS REGISTRY

'-----------------------------------

Dim b As Object

On Error Resume Next

Set b = CreateObject("Wscript.Shell")

b.RegDelete Value

End Sub

*********************

code

'Read from the registry

Dim Read

Read = ReadKey("HKEY_CURRENT_USER\Software\VBPW\pw")

'Check if the registry key exist, if it doesn't, let's create it!

If Read = Null Then

CreateKey "HKEY_CURRENT_USER\Software\VBPW\pw", "123"

End If

'Let's see if the password the person tryed is currect.

If Text1.Text = Read Then

Label1.Caption = "Currect Password!"

Else

Label1.Caption = "Incurrect Password!"

End If

'Here is how to delete the key from the registry.

'DeleteKey "HKEY_CURRENT_USER\Software\VBPW\pw"

هذا الموضوع مغلق.

مواضيع مشابهة