السلام عليكم
هذه فكرة حلوة اردت انا اقولها لك
وهي غلق برنامجك بعد 30 يوم من استعماله
والفكرة دي حلوة في ايه ؟؟
بعد 30 يوم سوف يغلق البرنامج حتى لو المستخدم رجع التاريخ الى الخلف
يعني لو عمل ايه مش هاينفع يرجع البرنامج يشتغل تاني
الا في حالة واحدة بس
لو عرف اسماء ال13 ملف اللي احنا هانعملهم
وطبعا انت ممكن تزود هذه الملفات بدل من 13 ممكن تخليهم 50 وانت وراحتك
ممكن تعمل 20 في system32
و 20 في system
علشان العملية تبقى مضونة شوية يعني
وطبعا استحالة المستخدم يعرف هذه الملفات اللي بين الوفات الملفات الخاصة بالنظام نفسه ( الويندوز )
المهم دعونا اقول لكم الفكرة
عند تحميل اول فورمة للمبرنامج
سوف يتم انشاء 6 ملفات للفحص فقط وملف واحد سوف يتم كتابة التاريخ به
و 6 ملفات للغلق ( اي لغلق البرنامج بعد انتهاء المدة )
كلهم في system32
++++++++++++++++++++++++++++++++++++++++
اولا سوف احكي لكم الموضوع بالبرمجة البلدي
----------------------------
لو ملفات الغلق موجودة كلها
طلع رسالة
مدة البرنامج التجريبية انتهت قم بشراء النسخة الأصلية
انهاء البرنامج
لو احد هذه الملفات ناقصة
طلع رسالة
تم التلاعب بملفات نظام البرنامج وسوف يتم انهاء البرنامج في الحال
انهاء البرنامج
انشاء ملفات الغلق من جديد
لو مش موجدين كلهم ( يبقى البرنامج معداش ال 30 يوم علشان المستخدم استحالة يجد ال6 ملفات )
كمل عادي
************************************************
لو السبع ملفات الأولى ( اللي هم ستة للفحص وواحد للتاريخ ) مش موجدين كلهم اعمل...
انشاء هذه الملفات مع كتابة في اخر ملف التاريخ بتاع النهاردة
ولو لقاهم بالفعل
شوف هل احد هذه الملفات مفقود ولا لأ ( حذف بواسطة المستخدم )
لو يوجد بالفعل احد هذه الملفات مفقود
طلع رسالة
تم التلاعب بملفات نظام البرنامج ولا يمكن فتح البرنامج نهائيا
انهاء البرنامج
اذا كانو موجدين كلهم والحمد لله
اقراء الملف الأخير اللي هو بتاع التاريخ وشوف هل التاريخ بتاع النهاردة اصغر منه ولا لأ
لو اصغر
طلع رسالة بتقول
تم التلاعب بتاريخ الجهاز كمحاولا لتشغيل البرنامج بعد غلقه
انهاء البرنامج
اما اذا لم يكن اصغر منه
زود على التاريخ اللي في الملف الأخير شهر واحد وبعدين
هل تاريخ النهاردة اكبر منه
لو اكبر
طلع رسالة بتقول
انتهت المدة التجريبية الخاصة بالبرنامج
انشاء الملفات الستة الأخرى الخاصة بالغلق
انهاء البرنامج
لو مش اكبر كمل عادي
++++++++++++++++++++++++++++++++++++++++++++++++++
حد فهم حاجة ؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟
هذه الأكواد المستخدمة
----------------
ضع فوق خالص في الجينرال يعني هذا الكود
Public winPath As String
وهو خاص بمعرفة مسار الويندوز علشان هاننسخ الملفات فيه
تعالى عن حدث التحميل للفورمة واكتب الكود ده
winPath = Environ$("windir")
winPath = winPath & "\System32"
ده علشان نغير قيمة المتغير بدل من مسار الويندوز الى مسار النظام
ثم
If Dir$(winPath & "\blockfile1.dll") = "" And _ Dir$(winPath & "\blockfile2.dll") = "" And _ Dir$(winPath & "\blockfile3.dll") = "" And _ Dir$(winPath & "\blockfile4.dll") = "" And _ Dir$(winPath & "\blockfile5.dll") = "" And _ Dir$(winPath & "\blockfile6.dll") = "" Then Else If Dir$(winPath & "\blockfile1.dll") = "" Or _ Dir$(winPath & "\blockfile2.dll") = "" Or _ Dir$(winPath & "\blockfile3.dll") = "" Or _ Dir$(winPath & "\blockfile4.dll") = "" Or _ Dir$(winPath & "\blockfile5.dll") = "" Or _ Dir$(winPath & "\blockfile6.dll") = "" Then MsgBox "تم التلاعب بملفات النظام الخاصة بالبرنامج سوف ينتهي البرنامج الأن ولا يمكن فتحة مرة اخرى", vbCritical, "ملفات النظام" creatblockfile End Else MsgBox "شكرا لإختيارك برنامجنا .. المدة التجريبية الخاصة بالبرنامج أنتهت , قم بشراء النسخة الأصلية", vbInformation, "" End End If End If
ده علشان نشوف هل ملفات الغلق موجودة ولا لأ ونشوف حد فيهم ناقص و لا لأ
وكلمة creatblockfile
ده Function الخاص بإنشاء ملفات الغلق
اللي هايبقى مكتوب فيه
Public Function creatblockfile()
winPath = Environ$("windir")
winPath = winPath & "\System32"
Dim savedFile As New FileSystemObject
Dim savedFilePath As String
savedFilePath = (winPath & "\blockfile1.dll")
Set Stream = savedFile.CreateTextFile(savedFilePath, True, False)
savedFilePath = (winPath & "\blockfile2.dll")
Set Stream = savedFile.CreateTextFile(savedFilePath, True, False)
savedFilePath = (winPath & "\blockfile3.dll")
Set Stream = savedFile.CreateTextFile(savedFilePath, True, False)
savedFilePath = (winPath & "\blockfile4.dll")
Set Stream = savedFile.CreateTextFile(savedFilePath, True, False)
savedFilePath = (winPath & "\blockfile5.dll")
Set Stream = savedFile.CreateTextFile(savedFilePath, True, False)
savedFilePath = (winPath & "\blockfile6.dll")
Set Stream = savedFile.CreateTextFile(savedFilePath, True, False)
End Functionوبعدين تكتب
If Dir$(winPath & "\chekfile1.dll") = "" And _ Dir$(winPath & "\chekfile2.dll") = "" And _ Dir$(winPath & "\chekfile3.dll") = "" And _ Dir$(winPath & "\chekfile4.dll") = "" And _ Dir$(winPath & "\chekfile5.dll") = "" And _ Dir$(winPath & "\chekfile6.dll") = "" And _ Dir$(winPath & "\datefile.dll") = "" Then creatfilestocheck Else If Dir$(winPath & "\chekfile1.dll") = "" Or _ Dir$(winPath & "\chekfile2.dll") = "" Or _ Dir$(winPath & "\chekfile3.dll") = "" Or _ Dir$(winPath & "\chekfile4.dll") = "" Or _ Dir$(winPath & "\chekfile5.dll") = "" Or _ Dir$(winPath & "\chekfile6.dll") = "" Or _ Dir$(winPath & "\datefile.dll") = "" Then MsgBox "تم التلاعب بملفات النظام الخاصة بالبرنامج سوف ينتهي البرنامج الأن ولا يمكن فتحة مرة اخرى", vbCritical, "ملفات النظام" creatblockfile End Else checkerfordate End If End If
وده لو ملفات الفحص والملف الخاص بالتاريخ مش موجدين كلهم انشئهم
وكلمة creatfilestocheck
دي Function الخاصة بإنشاء الست ملفات الفاحصة مع انشاء الملف الخاص بالتاريخ وكتابة التاريخ جواه
وهذا هو كود ال Function
Public Function creatfilestocheck()
winPath = Environ$("windir")
winPath = winPath & "\System32"
Dim savedFile As New FileSystemObject
Dim savedFilePath As String
savedFilePath = (winPath & "\chekfile1.dll")
Set Stream = savedFile.CreateTextFile(savedFilePath, True, False)
savedFilePath = (winPath & "\chekfile2.dll")
Set Stream = savedFile.CreateTextFile(savedFilePath, True, False)
savedFilePath = (winPath & "\chekfile3.dll")
Set Stream = savedFile.CreateTextFile(savedFilePath, True, False)
savedFilePath = (winPath & "\chekfile4.dll")
Set Stream = savedFile.CreateTextFile(savedFilePath, True, False)
savedFilePath = (winPath & "\chekfile5.dll")
Set Stream = savedFile.CreateTextFile(savedFilePath, True, False)
savedFilePath = (winPath & "\chekfile6.dll")
Set Stream = savedFile.CreateTextFile(savedFilePath, True, False)
savedFilePath = (winPath & "\datefile.dll")
Set Stream = savedFile.CreateTextFile(savedFilePath, True, False)
Stream.Write (Date & vbCrLf)
End Functionولو في احد هذه الملفات ناقص
طلع رسالة ( الموجودة في الكود ) وانشئ ملفات الغلق
وكلمة creatblockfile دي Function زي ما قلنا من قبل
ولو كلهم موجدين ومفيش اي ملفات ناقصة والحمد لله
checkerfordate
افحص التاريخ
والكلمة السابقة checkerfordate دي ال Function الخاصة بذلك
اللي مكتوب فيها
Public Function checkerfordate()
winPath = Environ$("windir")
winPath = winPath & "\System32"
Dim loadedFile As New FileSystemObject
Dim rdlin As Date
Set Stream = loadedFile.OpenTextFile((winPath & "\datefile.dll"), ForReading, False, TristateFalse)
rdlin = (Stream.ReadLine())
If Date < rdlin Then
MsgBox "تم التلاعب بتاريخ الجهاز كمحاولة لتشغيل البرنامج بعد إنتهاء المدة التجريبة , سوف يتم غلق البرنامج نهائياً", vbCritical, ""
creatblockfile
End
End If
T = DateAdd("m", 1, rdlin)
Dim chdate As Date
chdate = T
If Date > chdate Then
MsgBox "انتهت المدة التجريبية للبرنامج , قم بشراء النسخة الأصلية", vbCritical, ""
creatblockfile
End
End If
End Functionبس كدة
طبعا انت مش هاتخلي اسماء الملفات كدة
غيرهم بأسماء مختلفة علشان المستخدم ما يعرفهمش
حد فهم حاجة ؟؟؟ حد فهمني ؟؟
يبقى الكود كامل هايبقى كدة
Public winPath As String
Private Sub Form_Load()
winPath = Environ$("windir")
winPath = winPath & "\System32"
If App.PrevInstance = True Then
MsgBox "لا يمكن تشغيل أكثر من نسخة من البرنامج"
Unload Me
Exit Sub
End If
If Dir$(winPath & "\blockfile1.dll") = "" And _
Dir$(winPath & "\blockfile2.dll") = "" And _
Dir$(winPath & "\blockfile3.dll") = "" And _
Dir$(winPath & "\blockfile4.dll") = "" And _
Dir$(winPath & "\blockfile5.dll") = "" And _
Dir$(winPath & "\blockfile6.dll") = "" Then
Else
If Dir$(winPath & "\blockfile1.dll") = "" Or _
Dir$(winPath & "\blockfile2.dll") = "" Or _
Dir$(winPath & "\blockfile3.dll") = "" Or _
Dir$(winPath & "\blockfile4.dll") = "" Or _
Dir$(winPath & "\blockfile5.dll") = "" Or _
Dir$(winPath & "\blockfile6.dll") = "" Then
MsgBox "تم التلاعب بملفات النظام الخاصة بالبرنامج سوف ينتهي البرنامج الأن ولا يمكن فتحة مرة اخرى", vbCritical, "ملفات النظام"
creatblockfile
End
Else
MsgBox "شكرا لإختيارك برنامجنا .. المدة التجريبية الخاصة بالبرنامج أنتهت , قم بشراء النسخة الأصلية", vbInformation, ""
End
End If
End If
If Dir$(winPath & "\chekfile1.dll") = "" And _
Dir$(winPath & "\chekfile2.dll") = "" And _
Dir$(winPath & "\chekfile3.dll") = "" And _
Dir$(winPath & "\chekfile4.dll") = "" And _
Dir$(winPath & "\chekfile5.dll") = "" And _
Dir$(winPath & "\chekfile6.dll") = "" And _
Dir$(winPath & "\datefile.dll") = "" Then
creatfilestocheck
Else
If Dir$(winPath & "\chekfile1.dll") = "" Or _
Dir$(winPath & "\chekfile2.dll") = "" Or _
Dir$(winPath & "\chekfile3.dll") = "" Or _
Dir$(winPath & "\chekfile4.dll") = "" Or _
Dir$(winPath & "\chekfile5.dll") = "" Or _
Dir$(winPath & "\chekfile6.dll") = "" Or _
Dir$(winPath & "\datefile.dll") = "" Then
MsgBox "تم التلاعب بملفات النظام الخاصة بالبرنامج سوف ينتهي البرنامج الأن ولا يمكن فتحة مرة اخرى", vbCritical, "ملفات النظام"
creatblockfile
End
Else
checkerfordate
End If
End If
end sub
Public Function creatfilestocheck()
winPath = Environ$("windir")
winPath = winPath & "\System32"
Dim savedFile As New FileSystemObject
Dim savedFilePath As String
savedFilePath = (winPath & "\chekfile1.dll")
Set Stream = savedFile.CreateTextFile(savedFilePath, True, False)
savedFilePath = (winPath & "\chekfile2.dll")
Set Stream = savedFile.CreateTextFile(savedFilePath, True, False)
savedFilePath = (winPath & "\chekfile3.dll")
Set Stream = savedFile.CreateTextFile(savedFilePath, True, False)
savedFilePath = (winPath & "\chekfile4.dll")
Set Stream = savedFile.CreateTextFile(savedFilePath, True, False)
savedFilePath = (winPath & "\chekfile5.dll")
Set Stream = savedFile.CreateTextFile(savedFilePath, True, False)
savedFilePath = (winPath & "\chekfile6.dll")
Set Stream = savedFile.CreateTextFile(savedFilePath, True, False)
savedFilePath = (winPath & "\datefile.dll")
Set Stream = savedFile.CreateTextFile(savedFilePath, True, False)
Stream.Write (Date & vbCrLf)
End Function
Public Function checkerfordate()
winPath = Environ$("windir")
winPath = winPath & "\System32"
Dim loadedFile As New FileSystemObject
Dim rdlin As Date
Set Stream = loadedFile.OpenTextFile((winPath & "\datefile.dll"), ForReading, False, TristateFalse)
rdlin = (Stream.ReadLine())
If Date < rdlin Then
MsgBox "تم التلاعب بتاريخ الجهاز كمحاولة لتشغيل البرنامج بعد إنتهاء المدة التجريبة , سوف يتم غلق البرنامج نهائياً", vbCritical, ""
creatblockfile
End
End If
T = DateAdd("m", 1, rdlin)
Dim chdate As Date
chdate = T
If Date > chdate Then
MsgBox "انتهت المدة التجريبية للبرنامج , قم بشراء النسخة الأصلية", vbCritical, ""
creatblockfile
End
End If
End Function
Public Function creatblockfile()
winPath = Environ$("windir")
winPath = winPath & "\System32"
Dim savedFile As New FileSystemObject
Dim savedFilePath As String
savedFilePath = (winPath & "\blockfile1.dll")
Set Stream = savedFile.CreateTextFile(savedFilePath, True, False)
savedFilePath = (winPath & "\blockfile2.dll")
Set Stream = savedFile.CreateTextFile(savedFilePath, True, False)
savedFilePath = (winPath & "\blockfile3.dll")
Set Stream = savedFile.CreateTextFile(savedFilePath, True, False)
savedFilePath = (winPath & "\blockfile4.dll")
Set Stream = savedFile.CreateTextFile(savedFilePath, True, False)
savedFilePath = (winPath & "\blockfile5.dll")
Set Stream = savedFile.CreateTextFile(savedFilePath, True, False)
savedFilePath = (winPath & "\blockfile6.dll")
Set Stream = savedFile.CreateTextFile(savedFilePath, True, False)
End Functionبس كدة
لو حد عاوز يستفسر عن شئ يقولي
سلامي لكم جميعا

