469,579 Members | 1,157 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,579 developers. It's quick & easy.

DLLs

Is there any way I can prevent people using my DLLs in their programs? I
mean, I'm new to making DLLs and I'm guessing that if I can reference my
DLLs in my projects then there is nothing stopping anyone else from
referencing my DLLs in their projects.

Also, Just wondering whether there is a type of *thing* which is like a DLL
but includes a form as well. I want to include modules in my app, so say
for example purposes my app contains a main form and a calculator module.
The main form is the exe and the calculator gets called from a separate file
when needed? Any ideas?

Thanks for the help.
Jul 17 '05 #1
12 2980
On Fri, 28 May 2004 08:35:01 GMT, Visual Boodu .NET wrote:
Is there any way I can prevent people using my DLLs in their programs? I
mean, I'm new to making DLLs and I'm guessing that if I can reference my
DLLs in my projects then there is nothing stopping anyone else from
referencing my DLLs in their projects.
Nothing that can't be bypassed by a determined cracker. You could have
your DLL look in the registry for something, look for another
preexisting file, require a password (either fixed or determined by
something within the user's system), etc. - basically, do the same
things that commercial programs do - but again, crackers bypass this on
a daily basis. (Although they usually crack apps to use the app, not
just one specific file.)
Also, Just wondering whether there is a type of *thing* which is like a DLL
but includes a form as well. I want to include modules in my app, so say
for example purposes my app contains a main form and a calculator module.
The main form is the exe and the calculator gets called from a separate file
when needed? Any ideas?


I don't usually store forms in DLLs but I would assume that it can be
easily done; others here will have that answer.
--
auric underscore underscore at hotmail dot com
*****
Obviously our captor underestimated the wrath of a man and his hamster.
Jul 17 '05 #2
You can put forms in a DLL and call them. There's no
limitation.
For restriction: Somewhere on MSDN there's a page
about how to make a control licensed, the same way
that VB controls are licensed and can't be run otherwise.
I don't have a link to it, though. Another option might be
something like a dummy parameter. Your DLL parameters
can be seen in an object browser but that doesn't explain
them. So besides the natural difficulty in figuring out how
to call a function given object browser info., you could also
make it more confusing by adding a dummy parameter,
naming the parameters in a vague way, etc.

--
--
Visual Boodu .NET <sn@il.mail> wrote in message
news:VQ****************@news-server.bigpond.net.au...
Is there any way I can prevent people using my DLLs in their programs? I
mean, I'm new to making DLLs and I'm guessing that if I can reference my
DLLs in my projects then there is nothing stopping anyone else from
referencing my DLLs in their projects.

Also, Just wondering whether there is a type of *thing* which is like a DLL but includes a form as well. I want to include modules in my app, so say
for example purposes my app contains a main form and a calculator module.
The main form is the exe and the calculator gets called from a separate file when needed? Any ideas?

Thanks for the help.

Jul 17 '05 #3
Auric__ wrote:
On Fri, 28 May 2004 08:35:01 GMT, Visual Boodu .NET wrote:
Is there any way I can prevent people using my DLLs in their
programs? I mean, I'm new to making DLLs and I'm guessing that if I
can reference my DLLs in my projects then there is nothing stopping
anyone else from referencing my DLLs in their projects.
Nothing that can't be bypassed by a determined cracker. You could have
your DLL look in the registry for something, look for another
preexisting file, require a password (either fixed or determined by
something within the user's system), etc. - basically, do the same
things that commercial programs do - but again, crackers bypass this
on a daily basis. (Although they usually crack apps to use the app,
not just one specific file.)


Thanks, yea I didn't think of that. Might be a good idea me thinks!
Also, Just wondering whether there is a type of *thing* which is
like a DLL but includes a form as well. I want to include modules
in my app, so say for example purposes my app contains a main form
and a calculator module. The main form is the exe and the calculator
gets called from a separate file when needed? Any ideas?


I don't usually store forms in DLLs but I would assume that it can be
easily done; others here will have that answer.

Jul 17 '05 #4
mayayana wrote:
You can put forms in a DLL and call them. There's no
limitation.
For restriction: Somewhere on MSDN there's a page
about how to make a control licensed, the same way
that VB controls are licensed and can't be run otherwise.
I don't have a link to it, though. Another option might be
something like a dummy parameter. Your DLL parameters
can be seen in an object browser but that doesn't explain
them. So besides the natural difficulty in figuring out how
to call a function given object browser info., you could also
make it more confusing by adding a dummy parameter,
naming the parameters in a vague way, etc.
How do I put a form in a DLL? Probably if I make vague functions & that
then I'll probably get confused! I'll check out MSDN for that licencing
thing. Thanks for your help.
--
Is there any way I can prevent people using my DLLs in their
programs? I mean, I'm new to making DLLs and I'm guessing that if I
can reference my DLLs in my projects then there is nothing stopping
anyone else from referencing my DLLs in their projects.

Also, Just wondering whether there is a type of *thing* which is
like a DLL but includes a form as well. I want to include modules
in my app, so say for example purposes my app contains a main form
and a calculator module. The main form is the exe and the calculator
gets called from a separate file when needed? Any ideas?

Thanks for the help.

Jul 17 '05 #5
On Fri, 28 May 2004 20:50:07 GMT, Visual Boodu .NET wrote:
Auric__ wrote:
On Fri, 28 May 2004 08:35:01 GMT, Visual Boodu .NET wrote:
Is there any way I can prevent people using my DLLs in their
programs? I mean, I'm new to making DLLs and I'm guessing that if I
can reference my DLLs in my projects then there is nothing stopping
anyone else from referencing my DLLs in their projects.


Nothing that can't be bypassed by a determined cracker. You could have
your DLL look in the registry for something, look for another
preexisting file, require a password (either fixed or determined by
something within the user's system), etc. - basically, do the same
things that commercial programs do - but again, crackers bypass this
on a daily basis. (Although they usually crack apps to use the app,
not just one specific file.)


Thanks, yea I didn't think of that. Might be a good idea me thinks!


Yes, well, just remember that crackers can bypass *any* protection
scheme if they have reason to.
--
auric underscore underscore at hotmail dot com
*****
Jennifer Lopez wears enough diamonds to blind a city block.
Jul 17 '05 #6
Yea, thats fine, I think I would feel honoured if I saw my app on some
cracker page :)

Auric__ wrote:
On Fri, 28 May 2004 20:50:07 GMT, Visual Boodu .NET wrote:
Auric__ wrote:
On Fri, 28 May 2004 08:35:01 GMT, Visual Boodu .NET wrote:

Is there any way I can prevent people using my DLLs in their
programs? I mean, I'm new to making DLLs and I'm guessing that if
I can reference my DLLs in my projects then there is nothing
stopping anyone else from referencing my DLLs in their projects.

Nothing that can't be bypassed by a determined cracker. You could
have your DLL look in the registry for something, look for another
preexisting file, require a password (either fixed or determined by
something within the user's system), etc. - basically, do the same
things that commercial programs do - but again, crackers bypass this
on a daily basis. (Although they usually crack apps to use the app,
not just one specific file.)


Thanks, yea I didn't think of that. Might be a good idea me thinks!


Yes, well, just remember that crackers can bypass *any* protection
scheme if they have reason to.

Jul 17 '05 #7

How do I put a form in a DLL?


A DLL is like an EXE with a COM interface. You can do
anything you want to. Just add the form to the project and
control it through your exposed class(es).
You can also pass the events through if you need to.
In the exposed class, assuming you have a Form1, use:
Private WithEvents Frm as Form1
You can then write subs in your class for the form events, like:
Private Sub Frm_Clicked()
Msgbox "Form was clicked."
end sub
Jul 17 '05 #8
Excellent advice, thanks. I made a DLL with a form which had a button and
'referenced' the DLL in my project (project - references) then added this
code:

Dim frm As Projectdll.Class1

Set frm = New Projectdll.Class1

Call frm.LdForm

Is that the right way to work with DLLs? What does 'Private WithEvents Frm
as Form1' do? What is a COM interface?

Thanks!

mayayana wrote:
How do I put a form in a DLL?


A DLL is like an EXE with a COM interface. You can do
anything you want to. Just add the form to the project and
control it through your exposed class(es).
You can also pass the events through if you need to.
In the exposed class, assuming you have a Form1, use:
Private WithEvents Frm as Form1
You can then write subs in your class for the form events, like:
Private Sub Frm_Clicked()
Msgbox "Form was clicked."
end sub

Jul 17 '05 #9
OK I figured out I can just do:

Dim frm As New Projectdll.Class1

And that works OK. Now I would like the DLL to be a MDI child form to be
called into my (obviously) MDI parent. When I try to do this it craps
itself (it can't find a MDI parent form). Is there any way around this?

Visual Boodu .NET wrote:
Excellent advice, thanks. I made a DLL with a form which had a
button and 'referenced' the DLL in my project (project - references)
then added this code:

Dim frm As Projectdll.Class1

Set frm = New Projectdll.Class1

Call frm.LdForm

Is that the right way to work with DLLs? What does 'Private
WithEvents Frm as Form1' do? What is a COM interface?

Thanks!

mayayana wrote:
How do I put a form in a DLL?


A DLL is like an EXE with a COM interface. You can do
anything you want to. Just add the form to the project and
control it through your exposed class(es).
You can also pass the events through if you need to.
In the exposed class, assuming you have a Form1, use:
Private WithEvents Frm as Form1
You can then write subs in your class for the form events, like:
Private Sub Frm_Clicked()
Msgbox "Form was clicked."
end sub

Jul 17 '05 #10
What does 'Private WithEvents Frm
as Form1' do?
That's to use in the class of your DLL if you want to trap
form events. The "Frm" variable was meant to be a variable
in your DLL class, not the variable for your object within
the main project.
What is a COM interface?
Component Object Model. A COM object is registered
in HKCR, along with its type library. A COM object also has a
specific structure, such that the type library can be accessed and
functions in the COM object can be discovered based on what's
in that type library. A VB DLL is an ActiveX DLL, which is
a COM DLL.

COM is basically ActiveX, though the definitions are murky
because they're as much marketing as they are technical terms.
A fun quote from "The Essence of COM", a book by a notably
cranky author by the name of David S. Platt:

" The term ActiveX is another winner....the term "ActiveX" has no
technical meaning whatsoever, although it did have several
different meanings at various times. It is today a branding prefix, the
same as the letters "Mc" in front of all the food at the restaurant
with the golden arches."

The Object Browser is actually a COM object browser. It reads
COM object type libraries and displays what it finds. That's as
opposed to non-COM DLLs like shell32.dll or kernel32.dll, for
which there's no "self-documenting" functionality. With those you
just have to know the function that you want. That's why there's
"intellisense" for components added to your project but not for
kernel32.dll, even though you may have declared a kernel32.dll
function. You can get the function parameters popup for that
because VB knows it from your declare, but you can't get an
intellisense listbox menu because kernel32.dll doesn't "expose"
a COM interface to know it's functions.
And that works OK. Now I would like the DLL to be a MDI child form to be
called into my (obviously) MDI parent. When I try to do this it craps
itself (it can't find a MDI parent form). Is there any way around this?


Why would you put a form inside a DLL if you want it to be
an MDI child? I don't understand what you're trying to achieve.
The point of the DLL is that you can package functionality and
make it easily accessible with a COM interface. The form inside
your DLL is only accessible to the extent that you've provided public
methods in the DLL class(es) that can act on it in some way.
That form has no relation to an MDI form in your project.

In case it's any help, I've got sample DLL code with a form
in it:
http://www.jsware.net/jsware/zips/dllsamp.zip
Jul 17 '05 #11
With the MDI form I figured that if you can create a form in a DLL then you
could create a MDI form to be called into my MDI parent. It doesn't really
matter too much. Basically the reason I'm looking into DLLs is that my
application will need constant updating so it would be easier and a lot less
Kbs when downloading the updates... Update only the modules which need
updating rather than the whole exe every time. For my application think of
it like Outlook Express, the main screen is my exe, when you click on say
the accounts section, that will be called from a DLL.

As for your project, at this line:

Set SampOb = New SampleObject

And this line:

Set Ob = CreateObject("SampleDLL.SampleObject")

I get Run-time error '429': ActiveX component can't create object

mayayana wrote:
What does 'Private WithEvents Frm
as Form1' do?


That's to use in the class of your DLL if you want to trap
form events. The "Frm" variable was meant to be a variable
in your DLL class, not the variable for your object within
the main project.
What is a COM interface?


Component Object Model. A COM object is registered
in HKCR, along with its type library. A COM object also has a
specific structure, such that the type library can be accessed and
functions in the COM object can be discovered based on what's
in that type library. A VB DLL is an ActiveX DLL, which is
a COM DLL.

COM is basically ActiveX, though the definitions are murky
because they're as much marketing as they are technical terms.
A fun quote from "The Essence of COM", a book by a notably
cranky author by the name of David S. Platt:

" The term ActiveX is another winner....the term "ActiveX" has no
technical meaning whatsoever, although it did have several
different meanings at various times. It is today a branding prefix,
the same as the letters "Mc" in front of all the food at the
restaurant with the golden arches."

The Object Browser is actually a COM object browser. It reads
COM object type libraries and displays what it finds. That's as
opposed to non-COM DLLs like shell32.dll or kernel32.dll, for
which there's no "self-documenting" functionality. With those you
just have to know the function that you want. That's why there's
"intellisense" for components added to your project but not for
kernel32.dll, even though you may have declared a kernel32.dll
function. You can get the function parameters popup for that
because VB knows it from your declare, but you can't get an
intellisense listbox menu because kernel32.dll doesn't "expose"
a COM interface to know it's functions.
And that works OK. Now I would like the DLL to be a MDI child form
to be called into my (obviously) MDI parent. When I try to do this
it craps itself (it can't find a MDI parent form). Is there any way
around this?


Why would you put a form inside a DLL if you want it to be
an MDI child? I don't understand what you're trying to achieve.
The point of the DLL is that you can package functionality and
make it easily accessible with a COM interface. The form inside
your DLL is only accessible to the extent that you've provided public
methods in the DLL class(es) that can act on it in some way.
That form has no relation to an MDI form in your project.

In case it's any help, I've got sample DLL code with a form
in it:
http://www.jsware.net/jsware/zips/dllsamp.zip

Jul 17 '05 #12
> I get Run-time error '429': ActiveX component can't create object

You need to load the DLL and test projects as a group.
Then reference SampleDLL from the test project. (And
set the test project to start: Right-click ProjectTester; click
Set as Startup

With the MDI form I figured that if you can create a form in a DLL then you could create a MDI form to be called into my MDI parent. It doesn't really matter too much. Basically the reason I'm looking into DLLs is that my
application will need constant updating so it would be easier and a lot less Kbs when downloading the updates... Update only the modules which need
updating rather than the whole exe every time. For my application think of it like Outlook Express, the main screen is my exe, when you click on say
the accounts section, that will be called from a DLL.


The DLL is not part of your project, though. It's like
another program. You can use a DLL to do workhorse
functions but you can't call your DLL form to load inside
the MDI parent any more than you could if it were in
another EXE that you made.
I see what you mean about the Outlook Express example. OE
does seem to work that way, with a very small program EXE.
Maybe what you want is an OCX that you can put on a main form
in the EXE. You could then update your OCX.
Jul 17 '05 #13

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Shiraz | last post: by
11 posts views Thread by Devender Khari | last post: by
6 posts views Thread by Brian Bischof | last post: by
reply views Thread by Dave | last post: by
7 posts views Thread by Jeff Lynn | last post: by
10 posts views Thread by =?Utf-8?B?UmljaGFyZA==?= | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.