مشاهدة النسخة كاملة : اي سؤال في برمجة ال Dll و ال Ocx ادخل و اسأل
savage
03-14-2006, 10:14 AM
اذا في عند مشكلة مع Dll
او Ocx
ولا يهمك من عيوني بحاول اساعدك و رحم الله امرأ عرف قدر نفسه
Gangsta
03-14-2006, 06:12 PM
شكرا لك على العرض والموضوع المفيد
AlOmmda
03-15-2006, 09:28 AM
شكراً أخى الكريم على عرضك.
قمت بعمل ملف dll و لكن هناك مشكله بالنسبه للـ Global variables؛ فى الصوره المرفقه كيف يمكن أن أجعل المتغيرات الـglobal تظهر تحت الـGlobal
IUnKnown
03-15-2006, 11:49 AM
شكراً أخى الكريم على عرضك.
قمت بعمل ملف dll و لكن هناك مشكله بالنسبه للـ Global variables؛ فى الصوره المرفقه كيف يمكن أن أجعل المتغيرات الـglobal تظهر تحت الـGlobal
actually you cannot make that directly in VB however you may create a class that will contain all your global variables and make the Instancing property of the class = 6 GlobalMultiUse. then all the public members of this class will be public in any application referencing the DLL containing this class
AlOmmda
03-15-2006, 01:26 PM
actually you cannot make that directly in VB however you may create a class that will contain all your global variables and make the Instancing property of the class = 6 GlobalMultiUse. then all the public members of this class will be public in any application referencing the DLL containing this class
Thank you for your answer, that was not too bad
It made all the functions global, but I want to make only some Variables global. How could that be achived?
Thanks again man
savage
03-15-2006, 02:59 PM
عزيزي فقط الدوال التي تريد اظهارها في ملفك لتكون global اضف قبلها Public والدوال التي لا تريد ان يتم اظهارها في برامج تستخدم ملف ال DLL يجب ان تكون private
اي
Public Function IstableExisit(var1 as type1, var2 as type2)as type3
هذه الدالة ستظهر في البرامج و يمكن استدعائها من اي برنامج
Private Function CheckIstableExisit(var1 as type1, var2 as type2)as type3
لن تظهر في اي برنامج و سيقتصر عملها داخل ملف ال DLL فقط
Global var1 as type1
يمكن استدعائه و التعامل معه
اما
dim var1 as type1
فلا يمكنك ذلك
اتمنى ان يكون هذا بمثابة رد وان اكون قد فهمت سؤالك
LaSer_26
03-15-2006, 09:12 PM
ياريت لو تحط شرح لل ocx و dll وأستخداماته ونماذج علشان نستفيد
AlOmmda
03-16-2006, 05:47 AM
ط
Global var1 as type1
يمكن استدعائه و التعامل معه
اما
dim var1 as type1
فلا يمكنك ذلك
اتمنى ان يكون هذا بمثابة رد وان اكون قد فهمت سؤالك
أخى العزيز savage أولا شكراً على الرد
أنا أعرف مسبقاً أن الدوال التى هى معرفه ب Public يمكن نداءها من خارج ملف الـ dll
و هذه الدوال يجب أن تكون فى Class Module و ليس فى Moduld عادى الذى يأخذ الامتداد .Bas , و لكن ما أسأل عنه هو بالنسبه لـGlobal Variabls فلا يمكنك تعريفها فى الـClass Module بل فى Module عادى و لذلك قمت بتعريف هذه المتغيرات فى Module .Bas فيتم التعرف عليها داخل الـClass و لكنها ليست معرفه خارج الـ dll
هل هناك كتاب يتكلم فى موضوع الـ Classes , إنشاءملفات dll و ocx يمكنك أن تنصح به ؟
و لسيادتكم وافر الشكر
IUnKnown
03-16-2006, 06:14 AM
Thank you for your answer, that was not too bad
It made all the functions global, but I want to make only some Variables global. How could that be achived?
Thanks again man
you can put as many classes as you want.
put all these public variables in one class and all other functions in another class
AlOmmda
03-16-2006, 06:35 AM
you can put as many classes as you want.
put all these public variables in one class and all other functions in another class
I tried to make what you said, but I think you are not allowed to enter Global i.e Public Variables in a Class Module
Can you send a small attachment in VB to see how can I do that.
By the way, do you know any book explaining doing Dlls or OCXs
Many Thanks
IUnKnown
03-16-2006, 07:28 AM
you will find a DLL and a client application as an example of Globalmultiuse class and another public class.
for COM refrences I think the MSDN is the one of the best places that you can find COM programming discussed in detail.
you search for the New Riders MCSD preparation guide . I Don't have a soft copy if it right now
savage
03-16-2006, 08:01 AM
اخي العزيز لتغير قيمة متغير نلجاء لكتابة دالتين
مثلا عرف متغير
Global var1 as string
و في ملف الClass
انشاء دالتين
Public Sub setvar1 (str as string)
var1=str
end sub
Public Function getVar1 (str as string) as string
getvar1=str
end function
هذا من اسهل الحلول لهذة المشكلة
AlOmmda
03-16-2006, 09:15 AM
Thank you all for your help
Nice to exchange knowlage..
Salam
savage
03-16-2006, 09:29 AM
اخي الكريم
عرف متغير Global
و انشاء دالتين للتعامل معه
كمثال
Global Var1 as string
عرف هذا المتغير في ال Module
Public Sub Setvar1(str as string)
var1=str
end sub
public function getVar1() as string
getvar1=var1
end function
الدالة الاخرى ستغير قيمة المتغير Var1
و الدالة الثانية
ستحمل قيمة المتغير
و يمكنك استخدام Property get
Property let
و على كلا انا عامل مثال على الDLL
للأخ laser_26
جمل من هنا (http://www.bramjnet.com/vb3/attachment.php?attachmentid=17664&stc=1&d=1142505219)