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

تعلم كيفية صنع فايروس (1)

مغلق
بدأه زائر في 4 مارس 2001 · 4 رد · 2,593 مشاهدة · في لغة Ms Visual Basic 6 وما قبلها من إصدارات
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

Visual Basic does not intrinsically support automatically moving to the

first matching item as the user enters data. It is possible to add this

by using the SendMessage API call to search the list. The following code

shows a simple example of providing this functionality. To use, start a

new project, add a listbox and a combobox to the form and add this code:

Option Explicit

Private Const LB_FINDSTRING = &H18F

Private Const CB_FINDSTRING = &H14C

Private Const LB_FINDSTRINGEXACT = &H1A2

Private Const CB_FINDSTRINGEXACT = &H158

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _

(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _

lParam As Any) As Long

Private Sub PositionMe(KeyAscii As Integer)

Dim xCtl As Control

Dim strText As String

Dim lngIndex As Long

Dim lngCommand As Long

' find out what type of control we have

Set xCtl = Me.ActiveControl

If xCtl Is Nothing Then Exit Sub

If TypeOf xCtl Is ListBox Then

lngCommand = LB_FINDSTRING ' listbox!

ElseIf TypeOf xCtl Is ComboBox Then

lngCommand = CB_FINDSTRING ' combobox!

Else

Exit Sub

End If

strText = xCtl.Tag ' save search string in TAG

If KeyAscii = 8 Then

' the delete key was pressed so back off 1 character

If Len(strText) Then strText = Left$(strText, Len(strText) - 1)

ElseIf KeyAscii >= 32 And KeyAscii <= 127 Then

' some other key was pressed - add it to string

strText = strText & Chr$(KeyAscii)

End If

xCtl.Tag = strText ' save current search string

If Len(strText) < 1 Then

lngIndex = 0 ' no search necessary

Else

' find first match

lngIndex = SendMessage(xCtl.hwnd, lngCommand, 0, ByVal strText)

End If

If lngIndex < 0 Or lngIndex >= xCtl.ListCount Then

' item not found -- beep and reset search string

Beep

If Len(strText) > 0 Then

xCtl.Tag = Left$(strText, Len(strText) - 1)

End If

Exit Sub

End If

xCtl.ListIndex = lngIndex

End Sub

Private Sub Combo1_KeyPress(KeyAscii As Integer)

PositionMe KeyAscii

KeyAscii = 0

End Sub

Private Sub List1_KeyPress(KeyAscii As Integer)

PositionMe KeyAscii

KeyAscii = 0

End Sub

Private Sub Form_Load()

Dim x As Long

Dim y As Long

For x = 1 To 5

For y = 1 To 5

List1.AddItem Chr$(x + Asc("A")) & Chr$(y + Asc("A")) & "XYZ"

Combo1.AddItem Chr$(x + Asc("A")) & Chr$(y + Asc("A")) & "XYZ"

Next y

Next x

List1.ListIndex = 0

Combo1.ListIndex = 0

End Sub

Private Sub Form_Unload(Cancel As Integer)

Set Form1 = Nothing

End Sub

#2

الأخ العزيز

كل التحية والاحترام وكل عام وأنتم بخير

الرجاء التكرم بإضافة بعض الملاحظات لشرح عمل الكود لكي تكتمل الفائدة المرجوة

وشكراً لك

#3

على النعمة انا ما فهمت حاجة

اعمل حساب للعالم الحمير اللى زينا

#4

السلام عليكم ورحمة الله وبركاته

اولا اللي وضع هذا الكود لا يعرف شيئا عن البرمجة

هذا الكود وظيفته البحث في اذاة الـList Box و اداة Combo Box

وليس له اي علاقة بموضوع الفايروسات

واذا كنتم تريدون معرفة كيفية عمل برامج المراقبة الشبيهة بالفيروسات فأنا علي استعداد تام

تحياتي Dark Angle

#5

السلام عليكم ورحمة الله وبركاته

اخي اولا ماذا يعمل هذا الفيروس وما هي تأثيراته

ثانيا هناك فيروسات بأكواد ابسط بكثير وكودها لا يتجاوز الكام سطر وتأثيرها فعال ويختلف حسب طريقة صنع الفيروس

ثالثا الى الاخ dark حبذا لو فتحنا هذا الموضوع الذي تتكلم عنه وانا مستعد لتبادل الافكار حول هذه المواضيع ومنكم نستفيد

والسلام

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

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