|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
DLL in Visual BASIC 6I'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
Show quote
Hide quote
"Privado" <oceano.web***@netmadeira.com> wrote in message news:4a1e8d93$0$8460$a729d347@news.telepac.pt... 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 > > 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. > 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
Show quote
Hide quote
"Privado" <oceano.web***@netmadeira.com> wrote in message Yes, you can place Forms in an ActiveX DLL. But only modal - modeless formsnews: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? > 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 "Ralph" <nt_consultin***@yahoo.com> wrote in message There is another Gotcha when including a Form in a Dll. You have to benews: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. > 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 > Yes, you can place Forms in an ActiveX DLL. But only modal - modeless Without going into any particulars of this thread, I have no trouble showing > forms > cannot be displayed from a Dll 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 > > "RB Smissaert" <bartsmissa***@blueyonder.co.uk> wrote in message Really? Hanews: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. > 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 > 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 > > "RB Smissaert" <bartsmissa***@blueyonder.co.uk> wrote in message If I did, whatever it was is gone from my memory. I'm been holding on tonews:%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? > that cherished belief since VB5 and likely before. -ralph > > > Yes, you can place Forms in an ActiveX DLL. But only modal - modeless I thought you were right and went looking. I've> > > forms > > > cannot be displayed from a Dll > > 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
Show quote
Hide quote
"mayayana" <mayaXXy***@rcXXn.com> wrote in message
http://visualbasic-programming.blogspot.com/2007/11/creating-activex-dll-ser
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!) > > > 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 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 > > > > 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 > "Privado" <oceano.web***@netmadeira.com> wrote in message There is a problem here if you are trying to do automatic updates. The 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. 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. "Nobody" <nob***@nobody.com> wrote in message MS released version 4.5, and made it possible to install it on XP+SP2 and news:%23RCnYug4JHA.1372@TK2MSFTNGP05.phx.gbl... > Windows Installer 4.0 or above, and you can't install it on OS prior to > Vista. 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 |
|||||||||||||||||||||||