(nobody)
9/14/2011 5:13:00 PM
"Tony Toews" <ttoews@telusplanet.net> wrote in message
news:8760779gsjksn0ar4m6fu73eq2b6lffog3@4ax.com...
> So I'm thinking I'll leave the GUI in VB6, for now, and convert the
> code that does the work into C++ but in two stages.
What I recommend is isolate the GUI code from the non-GUI code. For example,
in a Click event, put the code into a subroutine and that subroutine should
not access any GUI elements directly. If it needs to check if a particular
CheckBox is enabled for example, then you should pass it to that subroutine
as a Boolean variable. That way the GUI code is much smaller and can be
discarded or replaced easily to work with another platform. If it helps, you
can add ui/UI before or after a routine name so you know it deals with
mostly GUI code. I have some routines like that, and they add list items or
sort a ListView, so there is mostly GUI code in them, so later I can discard
that routine without affecting other logic in the software.
> But I don't know if DLLs can have forms? Maybe not? Shows how
> little I know about VB6 DLLs.
>
> 1) convert all my VB6 modules so they work as VB6 DLLs and call it
> from VB6. This way I know I have the DLL stuff working smoothly. And
> maybe this is relatively easy to do. I don't know.
Yes, you can have forms in any ActiveX projects, but there is one getcha in
making DLL/OCX and try to talk to them from VBA(Not VB6). Office x64 can't
load 32-Bit DLL's because its own process is 64-Bit, but there is a
workaround for that, which involves either turning the project into ActiveX
EXE, so it runs on its own process(VBA in Office 32/64 can always talk to
ActiveX EXE's), or (more work) call the COM functions directly so the
ActiveX DLL is run out of process by using DLLHOST.EXE as a surrogate
process.