Home All Groups Group Topic Archive Search About
Author
28 May 2009 1:11 PM
Privado
Hi There,

I'm developing a small program in VB6 with a menu and several sub-menus.
Each option of the sub-menu calls a form with objects in it. I was planning
to move these forms into an external DLL in order to easyly update them in
the future.

Let me put this in another way.

- If I create a program and compile it in a single EXE, in the future, any
changes made to it I will have to compile it again in a EXE.

- If I create the same program and place the parts that are eligeble to be
change in the future in DLL, in future changes all I would have to do is to
compile the DLL that has been changed.

Can this be done in VB6? Considering that the parts in question have forms
and objects.

For example:

Program P.EXE:

In it, a menu with 3 sub menus (Option 1 that calls a FORM1, Option 2 that
calls FORM2 and Option 3 that calls FORM3)

If I place the FORM1 in a DLL project and compile it as FORM1.DLL (for
example) and the same for FORM2 and FORM3, will it work? If so how can I
call it from the P.EXE?

Thanks

Please post reply in this group.

NC

Author
28 May 2009 7:39 PM
MikeD
Show quote Hide quote
"Privado" <oceano.web***@netmadeira.com> wrote in message news:4a1e8d93$0$8460$a729d347@news.telepac.pt...
>
> Hi There,
>
> I'm developing a small program in VB6 with a menu and several sub-menus. Each option of the sub-menu calls a form with objects in
> it. I was planning to move these forms into an external DLL in order to easyly update them in the future.
>
> Let me put this in another way.
>
> - If I create a program and compile it in a single EXE, in the future, any changes made to it I will have to compile it again in a
> EXE.
>
> - If I create the same program and place the parts that are eligeble to be change in the future in DLL, in future changes all I
> would have to do is to compile the DLL that has been changed.
>
> Can this be done in VB6? Considering that the parts in question have forms and objects.
>

Yes, but I don't see the benefit.  Either way, you have to recompile and update a file on all systems on which your app is
installed.  So what if that file is an EXE or a DLL?

And you could run into major headaches with the DLL if you can't maintain binary compatibility.  If binary compatibility must be
broken, you'd then have to compile and update both the DLL *and* the EXE.

--
Mike
Author
28 May 2009 7:45 PM
Ralph
Show quote Hide quote
"Privado" <oceano.web***@netmadeira.com> wrote in message
news:4a1e8d93$0$8460$a729d347@news.telepac.pt...
>
> Hi There,
>
> I'm developing a small program in VB6 with a menu and several sub-menus.
> Each option of the sub-menu calls a form with objects in it. I was
planning
> to move these forms into an external DLL in order to easyly update them in
> the future.
>
> Let me put this in another way.
>
> - If I create a program and compile it in a single EXE, in the future, any
> changes made to it I will have to compile it again in a EXE.
>
> - If I create the same program and place the parts that are eligeble to be
> change in the future in DLL, in future changes all I would have to do is
to
> compile the DLL that has been changed.
>
> Can this be done in VB6? Considering that the parts in question have forms
> and objects.
>
> For example:
>
> Program P.EXE:
>
> In it, a menu with 3 sub menus (Option 1 that calls a FORM1, Option 2 that
> calls FORM2 and Option 3 that calls FORM3)
>
> If I place the FORM1 in a DLL project and compile it as FORM1.DLL (for
> example) and the same for FORM2 and FORM3, will it work? If so how can I
> call it from the P.EXE?
>

Yes, you can place Forms in an ActiveX DLL. But only modal - modeless forms
cannot be displayed from a Dll.

In the Dll create a method that instances and displays a form. Something
like ...
[Warning! Air Code!]
' ----- In someDLL
Private m_Frm1 As Form1
Public Sub DisplayForm()
      Set m_Frm1 = New Form1
       m_Frm1.Show
End Sub
' ---- In the client
Private Sub SomeFormButton_Click()
      Dim oDll As SomeDLL
      Set oDll = New SomeDLL
      oDll.DisplayForm
End Sub

I don't know squat about your problem domain, and having most of the forms
in separate Dlls and having them all modal may work out for you. But in
general I find that keeping the Forms in a 'main' client and distributing
the logic out to Dlls a better plan for breaking up an application. (Don't
forget you can also create a modal-view architecture where you have a Form
with its logic in an object 'behind'.)

Placing a Form in a Dll usually only works out for cases where the enclosed
form is needed to perform a unique tasks. - common examples, would be the
File or Print Dialogs.

-ralph
Author
28 May 2009 8:01 PM
Ralph
"Ralph" <nt_consultin***@yahoo.com> wrote in message
news:OyiuM083JHA.1712@TK2MSFTNGP03.phx.gbl...
>
> Yes, you can place Forms in an ActiveX DLL. But only modal - modeless
forms
> cannot be displayed from a Dll.
>

There is another Gotcha when including a Form in a Dll. You have to be
careful about controlling their lifetimes and make sure they are throughly
extinguished when no longer needed.. An "open" form in a Dll will prevent
that Dll from being unloaded whether it is visible or not.

Not that that isn't true of any application but it seems to 'bite' more
often with ActiveX Forms. :-)

-ralph
Author
31 May 2009 5:57 AM
RB Smissaert
> Yes, you can place Forms in an ActiveX DLL. But only modal - modeless
> forms
> cannot be displayed from a Dll

Without going into any particulars of this thread, I have no trouble showing
a modeless form
from an ActiveX dll. This dll is run from VBA, but not sure that makes a
difference.

RBS


Show quoteHide quote
"Ralph" <nt_consultin***@yahoo.com> wrote in message
news:OyiuM083JHA.1712@TK2MSFTNGP03.phx.gbl...
>
> "Privado" <oceano.web***@netmadeira.com> wrote in message
> news:4a1e8d93$0$8460$a729d347@news.telepac.pt...
>>
>> Hi There,
>>
>> I'm developing a small program in VB6 with a menu and several sub-menus.
>> Each option of the sub-menu calls a form with objects in it. I was
> planning
>> to move these forms into an external DLL in order to easyly update them
>> in
>> the future.
>>
>> Let me put this in another way.
>>
>> - If I create a program and compile it in a single EXE, in the future,
>> any
>> changes made to it I will have to compile it again in a EXE.
>>
>> - If I create the same program and place the parts that are eligeble to
>> be
>> change in the future in DLL, in future changes all I would have to do is
> to
>> compile the DLL that has been changed.
>>
>> Can this be done in VB6? Considering that the parts in question have
>> forms
>> and objects.
>>
>> For example:
>>
>> Program P.EXE:
>>
>> In it, a menu with 3 sub menus (Option 1 that calls a FORM1, Option 2
>> that
>> calls FORM2 and Option 3 that calls FORM3)
>>
>> If I place the FORM1 in a DLL project and compile it as FORM1.DLL (for
>> example) and the same for FORM2 and FORM3, will it work? If so how can I
>> call it from the P.EXE?
>>
>
> Yes, you can place Forms in an ActiveX DLL. But only modal - modeless
> forms
> cannot be displayed from a Dll.
>
> In the Dll create a method that instances and displays a form. Something
> like ...
> [Warning! Air Code!]
> ' ----- In someDLL
> Private m_Frm1 As Form1
> Public Sub DisplayForm()
>      Set m_Frm1 = New Form1
>       m_Frm1.Show
> End Sub
> ' ---- In the client
> Private Sub SomeFormButton_Click()
>      Dim oDll As SomeDLL
>      Set oDll = New SomeDLL
>      oDll.DisplayForm
> End Sub
>
> I don't know squat about your problem domain, and having most of the forms
> in separate Dlls and having them all modal may work out for you. But in
> general I find that keeping the Forms in a 'main' client and distributing
> the logic out to Dlls a better plan for breaking up an application. (Don't
> forget you can also create a modal-view architecture where you have a Form
> with its logic in an object 'behind'.)
>
> Placing a Form in a Dll usually only works out for cases where the
> enclosed
> form is needed to perform a unique tasks. - common examples, would be the
> File or Print Dialogs.
>
> -ralph
>
>
Author
31 May 2009 6:37 AM
Ralph
"RB Smissaert" <bartsmissa***@blueyonder.co.uk> wrote in message
news:u3dO6Sb4JHA.3860@TK2MSFTNGP05.phx.gbl...
> > Yes, you can place Forms in an ActiveX DLL. But only modal - modeless
> > forms
> > cannot be displayed from a Dll
>
> Without going into any particulars of this thread, I have no trouble
showing
> a modeless form
> from an ActiveX dll. This dll is run from VBA, but not sure that makes a
> difference.
>

Really? Ha

It wouldn't surprise me to find out I'm wrong.

I've always kept forms in the "Main" program - the exec provides
Presentation and Interaction - and only used modal forms from Dlls. Perhaps
it is more habit that requirement. lol

-ralph
Author
31 May 2009 9:25 AM
RB Smissaert
> Perhaps it is more habit that requirement

Probably yes.
Was there any particular problem you had noticed with modeless forms in a
dll?

RBS


Show quoteHide quote
"Ralph" <nt_consultin***@yahoo.com> wrote in message
news:ONjwAqb4JHA.5616@TK2MSFTNGP04.phx.gbl...
>
> "RB Smissaert" <bartsmissa***@blueyonder.co.uk> wrote in message
> news:u3dO6Sb4JHA.3860@TK2MSFTNGP05.phx.gbl...
>> > Yes, you can place Forms in an ActiveX DLL. But only modal - modeless
>> > forms
>> > cannot be displayed from a Dll
>>
>> Without going into any particulars of this thread, I have no trouble
> showing
>> a modeless form
>> from an ActiveX dll. This dll is run from VBA, but not sure that makes a
>> difference.
>>
>
> Really? Ha
>
> It wouldn't surprise me to find out I'm wrong.
>
> I've always kept forms in the "Main" program - the exec provides
> Presentation and Interaction - and only used modal forms from Dlls.
> Perhaps
> it is more habit that requirement. lol
>
> -ralph
>
>
Author
31 May 2009 2:34 PM
Ralph
"RB Smissaert" <bartsmissa***@blueyonder.co.uk> wrote in message
news:%2326n$Gd4JHA.1372@TK2MSFTNGP05.phx.gbl...
> > Perhaps it is more habit that requirement
>
> Probably yes.
> Was there any particular problem you had noticed with modeless forms in a
> dll?
>

If I did, whatever it was is gone from my memory. I'm been holding on to
that cherished belief since VB5 and likely before.

-ralph
Author
31 May 2009 2:41 PM
mayayana
> > > Yes, you can place Forms in an ActiveX DLL. But only modal - modeless
> > > forms
> > > cannot be displayed from a Dll
> >

  I thought you were right and went looking. I've
always used only modal forms in DLLs myself. But
it appears to be a Win9x thing:

http://support.microsoft.com/kb/184200

  And there even seems to be a way to test it
with App.NonModalAllowed (I never noticed
that property before!)

http://visualbasic-programming.blogspot.com/2007/11/creating-activex-dll-ser
ver.html
Author
31 May 2009 3:00 PM
Ralph
Show quote Hide quote
"mayayana" <mayaXXy***@rcXXn.com> wrote in message
news:uojNy4f4JHA.1528@TK2MSFTNGP05.phx.gbl...
> > > > Yes, you can place Forms in an ActiveX DLL. But only modal -
modeless
> > > > forms
> > > > cannot be displayed from a Dll
> > >
>
>   I thought you were right and went looking. I've
> always used only modal forms in DLLs myself. But
> it appears to be a Win9x thing:
>
> http://support.microsoft.com/kb/184200
>
>   And there even seems to be a way to test it
> with App.NonModalAllowed (I never noticed
> that property before!)
>
>
http://visualbasic-programming.blogspot.com/2007/11/creating-activex-dll-ser
> ver.html
>

That explains where it came from.

I appreciate the link, but it unfortunately destroys another cherished
belief - I thought I knew everything. lol

-ralph
Author
31 May 2009 3:08 PM
RB Smissaert
Thanks for the links and clearing that up.

RBS


Show quoteHide quote
"mayayana" <mayaXXy***@rcXXn.com> wrote in message
news:uojNy4f4JHA.1528@TK2MSFTNGP05.phx.gbl...
>> > > Yes, you can place Forms in an ActiveX DLL. But only modal - modeless
>> > > forms
>> > > cannot be displayed from a Dll
>> >
>
>  I thought you were right and went looking. I've
> always used only modal forms in DLLs myself. But
> it appears to be a Win9x thing:
>
> http://support.microsoft.com/kb/184200
>
>  And there even seems to be a way to test it
> with App.NonModalAllowed (I never noticed
> that property before!)
>
> http://visualbasic-programming.blogspot.com/2007/11/creating-activex-dll-ser
> ver.html
>
>
>
>
Author
31 May 2009 1:47 PM
Privado
Ok, to be more specific,

The program has a menu divided like this:

Files
    Costumers            (Inside FORM1)

Management
    Transactions        (Inside FORM2)

Search
    Costumers            (Inside FORM3)
    Transactions        (Inside FORM4)

Utils
    Config                (Inside FORM5)
    Update                (Inside FORM6)
    About                (Inside FORM7)

If I decid to make changes only in the Costumers FORM1, if I have it in a
DLL, I would only need to change it and compile it, instead of compiling the
entire program, distributing only the DLL in a means of a patch, a process
which I could implement in the option Update from Utils menu, and the user
would update the program DLL without exiting the program.

NC

Show quoteHide quote
"Privado" <oceano.web***@netmadeira.com> wrote in message
news:4a1e8d93$0$8460$a729d347@news.telepac.pt...
>
> Hi There,
>
> I'm developing a small program in VB6 with a menu and several sub-menus.
> Each option of the sub-menu calls a form with objects in it. I was
> planning to move these forms into an external DLL in order to easyly
> update them in the future.
>
> Let me put this in another way.
>
> - If I create a program and compile it in a single EXE, in the future, any
> changes made to it I will have to compile it again in a EXE.
>
> - If I create the same program and place the parts that are eligeble to be
> change in the future in DLL, in future changes all I would have to do is
> to compile the DLL that has been changed.
>
> Can this be done in VB6? Considering that the parts in question have forms
> and objects.
>
> For example:
>
> Program P.EXE:
>
> In it, a menu with 3 sub menus (Option 1 that calls a FORM1, Option 2 that
> calls FORM2 and Option 3 that calls FORM3)
>
> If I place the FORM1 in a DLL project and compile it as FORM1.DLL (for
> example) and the same for FORM2 and FORM3, will it work? If so how can I
> call it from the P.EXE?
>
> Thanks
>
> Please post reply in this group.
>
> NC
>
Author
31 May 2009 4:19 PM
Nobody
"Privado" <oceano.web***@netmadeira.com> wrote in message
news:4a1e8d93$0$8460$a729d347@news.telepac.pt...
> to move these forms into an external DLL in order to easyly update them in
> the future.

There is a problem here if you are trying to do automatic updates. The
regular "Users" group doesn't have write access to "Program Files", the
"Windows" folder and its subfolders, and HKLM in the registry. Registering
ActiveX requires writing to HKLM. So this has to be done in the installer,
or use a service running under the SYSTEM account. There are no free
automatic update services that I know of except Windows Installer 4.0 or
above, and you can't install it on OS prior to Vista. In Windows Installer
4.0, patches can be done under limited users, but the patch must be
digitally signed.

Here is one automatic update service(not free):

http://www.autoupdateplus.com/

Part of the reason why you won't find free auto update services is because
they can be exploited by malware, and administrators would stop or uninstall
such a service, so there is no point in using one if you find a free one.

Another alternative is to make an ActiveX EXE to do the update. You can
configure it with DCOMCNFG and set it to start as Administrator when your
app create an object of it, so it can do updates with the proper
permissions. I haven't tried this, so I am not sure if it works. Search MSKB
for DCOMCNFG.
Author
31 May 2009 4:28 PM
Nobody
"Nobody" <nob***@nobody.com> wrote in message
news:%23RCnYug4JHA.1372@TK2MSFTNGP05.phx.gbl...
> Windows Installer 4.0 or above, and you can't install it on OS prior to
> Vista.

MS released version 4.5, and made it possible to install it on XP+SP2 and
after:

http://support.microsoft.com/kb/942288

See "Run-Time Requirements" below for other versions:

Windows Installer:
http://msdn.microsoft.com/en-us/library/aa372866.aspx