Home All Groups Group Topic Archive Search About
Author
18 Aug 2010 3:59 AM
Leo
I have a standard DLL whose subs take a while to complete. I was
thinking of somehow using a calback sub/function to allow the program
calling them to display progress. Is that possible in vb?

--
ClassicVB Users Regroup! comp.lang.basic.visual.misc
Free usenet access at http://www.eternal-september.org

Author
18 Aug 2010 4:25 AM
Jim Mack
Leo wrote:
> I have a standard DLL whose subs take a while to complete. I was
> thinking of somehow using a calback sub/function to allow the
> program calling them to display progress. Is that possible in vb?

It depends on the DLL. If it's written to call back to a __stdcall
function, and it's operating on the main thread, and it passes only
numerics (or understands BSTRs), then it should be no problem.

Devil's in the details, which we'd need to see to make a better guess.
(-:

--
   Jim Mack
   Twisted tees at http://www.cafepress.com/2050inc
   "We sew confusion"
Author
18 Aug 2010 4:35 AM
Leo
Jim Mack wrote :
> Leo wrote:
>> I have a standard DLL whose subs take a while to complete. I was
>> thinking of somehow using a calback sub/function to allow the
>> program calling them to display progress. Is that possible in vb?
>
> It depends on the DLL. If it's written to call back to a __stdcall
> function, and it's operating on the main thread, and it passes only
> numerics (or understands BSTRs), then it should be no problem.
>
> Devil's in the details, which we'd need to see to make a better guess.
> (-:

I should have made it more clear that the DLL is written in vb and I
havent written anything but the time consuming subs.

--
ClassicVB Users Regroup! comp.lang.basic.visual.misc
Free usenet access at http://www.eternal-september.org
Author
18 Aug 2010 7:59 AM
Dee Earley
On 18/08/2010 05:35, Leo wrote:
Show quoteHide quote
> Jim Mack wrote :
>> Leo wrote:
>>> I have a standard DLL whose subs take a while to complete. I was
>>> thinking of somehow using a calback sub/function to allow the
>>> program calling them to display progress. Is that possible in vb?
>>
>> It depends on the DLL. If it's written to call back to a __stdcall
>> function, and it's operating on the main thread, and it passes only
>> numerics (or understands BSTRs), then it should be no problem.
>>
>> Devil's in the details, which we'd need to see to make a better guess.
>> (-:
>
> I should have made it more clear that the DLL is written in vb and I
> havent written anything but the time consuming subs.

Then it's a COM DLL and you can use Events to return progress information.

Or move it to an ActiveX EXE and use multi threading:
http://hashvb.earlsoft.co.uk/Multithreading

--
Dee Earley (dee.ear***@icode.co.uk)
i-Catcher Development Team

iCode Systems

(Replies direct to my email address will be ignored.
Please reply to the group.)
Author
18 Aug 2010 3:42 PM
Leo
Dee Earley expressed precisely :
Show quoteHide quote
> On 18/08/2010 05:35, Leo wrote:
>> Jim Mack wrote :
>>> Leo wrote:
>>>> I have a standard DLL whose subs take a while to complete. I was
>>>> thinking of somehow using a calback sub/function to allow the
>>>> program calling them to display progress. Is that possible in vb?
>>>
>>> It depends on the DLL. If it's written to call back to a __stdcall
>>> function, and it's operating on the main thread, and it passes only
>>> numerics (or understands BSTRs), then it should be no problem.
>>>
>>> Devil's in the details, which we'd need to see to make a better guess.
>>> (-:
>>
>> I should have made it more clear that the DLL is written in vb and I
>> havent written anything but the time consuming subs.
>
> Then it's a COM DLL and you can use Events to return progress information.
>
> Or move it to an ActiveX EXE and use multi threading:
> http://hashvb.earlsoft.co.uk/Multithreading

But it is a standard DLL as I discussed in another thread earlierr. I
have read I can use function pointers in VB either using VFTables or
CallWindowProc. Which is better? I have gaps in the blocking subs that
I can add calls to code to call function pointers.

--
ClassicVB Users Regroup! comp.lang.basic.visual.misc
Free usenet access at http://www.eternal-september.org
Author
18 Aug 2010 5:52 PM
Jeff Johnson
"Leo" <ttdh***@gmail.com> wrote in message
news:i4gv0q$gm8$1@news.eternal-september.org...

> But it is a standard DLL as I discussed in another thread earlierr.

Without some third-party add-on VB CANNOT create standard DLLs.
Author
18 Aug 2010 7:05 PM
ralph
On Wed, 18 Aug 2010 13:52:14 -0400, "Jeff Johnson" <i.get@enough.spam>
wrote:

>"Leo" <ttdh***@gmail.com> wrote in message
>news:i4gv0q$gm8$1@news.eternal-september.org...
>
>> But it is a standard DLL as I discussed in another thread earlierr.
>
>Without some third-party add-on VB CANNOT create standard DLLs.
>

Define what you mean by a "third-party add-on".

http://www.vb-helper.com/howto_make_standard_dll.html

This looks pretty straight-forward to me.
(And better than how I used to tell people how to do it. <g>)

-ralph
Author
18 Aug 2010 7:17 PM
Tom Shelton
ralph formulated the question :
Show quoteHide quote
> On Wed, 18 Aug 2010 13:52:14 -0400, "Jeff Johnson" <i.get@enough.spam>
> wrote:
>
>> "Leo" <ttdh***@gmail.com> wrote in message
>> news:i4gv0q$gm8$1@news.eternal-september.org...
>>
>>> But it is a standard DLL as I discussed in another thread earlierr.
>>
>> Without some third-party add-on VB CANNOT create standard DLLs.
>>
>
> Define what you mean by a "third-party add-on".
>
> http://www.vb-helper.com/howto_make_standard_dll.html
>
> This looks pretty straight-forward to me.
> (And better than how I used to tell people how to do it. <g>)
>
> -ralph

That's rather clever.  I once created an add-on for vb5/6 that would
let me specifiy the command line arguments to c2.exe per module.  It
worked in a similar manner - I renamed c2.exe and replaced it with my
own c2.exe :)  Hmmm...  I wonder if I still have that around somewhere?
Someone might find a use for it...  It also let me play around with
other command line options as well, but I don't remember finding to
many being useful other then those used by VB :)  Been an awful long
time ago....

--
Tom Shelton
Author
18 Aug 2010 9:52 PM
ralph
On Wed, 18 Aug 2010 13:17:52 -0600, Tom Shelton
<tom_shelton@comcast.invalid> wrote:

Show quoteHide quote
>ralph formulated the question :
>> On Wed, 18 Aug 2010 13:52:14 -0400, "Jeff Johnson" <i.get@enough.spam>
>> wrote:
>>
>>> "Leo" <ttdh***@gmail.com> wrote in message
>>> news:i4gv0q$gm8$1@news.eternal-september.org...
>>>
>>>> But it is a standard DLL as I discussed in another thread earlierr.
>>>
>>> Without some third-party add-on VB CANNOT create standard DLLs.
>>>
>>
>> Define what you mean by a "third-party add-on".
>>
>> http://www.vb-helper.com/howto_make_standard_dll.html
>>
>> This looks pretty straight-forward to me.
>> (And better than how I used to tell people how to do it. <g>)
>>
>> -ralph
>
>That's rather clever.  I once created an add-on for vb5/6 that would
>let me specifiy the command line arguments to c2.exe per module.  It
>worked in a similar manner - I renamed c2.exe and replaced it with my
>own c2.exe :)  Hmmm...  I wonder if I still have that around somewhere?
> Someone might find a use for it...  It also let me play around with
>other command line options as well, but I don't remember finding to
>many being useful other then those used by VB :)  Been an awful long
>time ago....

Sharing and protecting .bas files was always a problem in a
multi-developer environment because of VB's inherent nature not to
share. So, combined with a typelibrary, the technique provides for
what MS left out of VB, and that is 'function libraries'.

I became quite enamored with them at one time thus, of course, abused
the H out of them. Later on sanity finally struck and I worked out a
more healthy balance between modules and libraries. <g>

However, they did come in particularly handy in one mixed VC/VB shop.
We needed to 'standardize' and share the business rules - And it would
be useful to have the same code running in Excel, Access, etc, as we
had in our business programs.

The VCers, for the usual reasons (some blind, some with merit), hated
to use VB ActiveX components and wanted to do it all in VC.
Unfortunately, while the VC crowd were good coders they were few in
number, and the VBers tended to be the subject matter experts and I
had a lot more of them than VCers. The problem was solved when I
discovered that if handed a standard dll - they imported with little
squawk. <bg>

-ralph
Author
18 Aug 2010 8:21 PM
Jeff Johnson
Show quote Hide quote
"ralph" <nt_consultin***@yahoo.net> wrote in message
news:jlbo669p828sb81rcvmf3o6uga0ni0om7s@4ax.com...

>>> But it is a standard DLL as I discussed in another thread earlierr.
>>
>>Without some third-party add-on VB CANNOT create standard DLLs.
>>
>
> Define what you mean by a "third-party add-on".
>
> http://www.vb-helper.com/howto_make_standard_dll.html
>
> This looks pretty straight-forward to me.
> (And better than how I used to tell people how to do it. <g>)

Okay, let's put it this way: There is no setting within the VB IDE to make
the IDE create a standard DLL. You must use other tools to achieve this.
(Cool process, by the way.)
Author
18 Aug 2010 8:52 PM
MikeD
"Jeff Johnson" <i.get@enough.spam> wrote in message
news:i4hfbv$bmh$1@news.eternal-september.org...
> (Cool process, by the way.)


Except that it uses the FSO.  <g>

--
Mike
Author
19 Aug 2010 3:17 AM
Leo
It happens that Jeff Johnson formulated :
> "Leo" <ttdh***@gmail.com> wrote in message
> news:i4gv0q$gm8$1@news.eternal-september.org...
>
>> But it is a standard DLL as I discussed in another thread earlierr.
>
> Without some third-party add-on VB CANNOT create standard DLLs.

I have vbAdvance installed.

--
ClassicVB Users Regroup! comp.lang.basic.visual.misc
Free usenet access at http://www.eternal-september.org
Author
19 Aug 2010 10:16 AM
Jim Mack
Leo wrote:
> Jeff Johnson formulated :
>>
>> Without some third-party add-on VB CANNOT create standard DLLs.
>
> I have vbAdvance installed.


Is there a reason why you need this to be a standard DLL?

In any case, doesn't vbAdvance leave any COM interface intact while
adding standard exports? If so, there's nothing stopping you from
using events to communicate back to the main program.

--
   Jim Mack
   Twisted tees at http://www.cafepress.com/2050inc
   "We sew confusion"
Author
18 Aug 2010 11:43 AM
Jim Mack
Leo wrote:
Show quoteHide quote
> Jim Mack wrote :
>> Leo wrote:
>>> I have a standard DLL whose subs take a while to complete. I was
>>> thinking of somehow using a calback sub/function to allow the
>>> program calling them to display progress. Is that possible in vb?
>>
>> It depends on the DLL. If it's written to call back to a __stdcall
>> function, and it's operating on the main thread, and it passes only
>> numerics (or understands BSTRs), then it should be no problem.
>>
>> Devil's in the details, which we'd need to see to make a better
>> guess. (-:
>
> I should have made it more clear that the DLL is written in vb and I
> havent written anything but the time consuming subs.

Then it isn't a 'standard' DLL, it's a COM DLL. It can yield, and
generate events that your app can sink -- instantiate it 'WithEvents'
in the app.

--
   Jim Mack
   Twisted tees at http://www.cafepress.com/2050inc
   "We sew confusion"
Author
18 Aug 2010 1:30 PM
Nobody
"Leo" <ttdh***@gmail.com> wrote in message
news:i4fnsh$pvh$1@news.eternal-september.org...
> I should have made it more clear that the DLL is written in vb and I
> havent written anything but the time consuming subs.

Then add it as a reference, then use a line like this in Form1 to use it:

Private WithEvents oClass As DLLReferenceName.ClassName

"DLLReferenceName" and "ClassName" should be what you see in Object
Browser(F2) for the DLL.

Then in Form_Load:

Set oClass = New DLLReferenceName.ClassName

And in Form_Unload:

Set oClass = Nothing

After that, on the left dropdown box, where the controls on the form are
listed, select "oClass". If you don't see "oClass", then it doesn't generate
events, and you have to do something else to get it to work.
Author
18 Aug 2010 1:40 PM
Jeff Johnson
"Leo" <ttdh***@gmail.com> wrote in message
news:i4flpu$68q$1@news.eternal-september.org...

>I have a standard DLL whose subs take a while to complete. I was thinking
>of somehow using a calback sub/function to allow the program calling them
>to display progress. Is that possible in vb?

Does this DLL already have the capability to call a callback function while
processing? If not, no amount of programming on the VB6 is going to make a
bit of difference.
Author
18 Aug 2010 1:41 PM
Jeff Johnson
"Jeff Johnson" <i.get@enough.spam> wrote in message
news:i4gnt7$6sg$1@news.eternal-september.org...

>>I have a standard DLL whose subs take a while to complete. I was thinking
>>of somehow using a calback sub/function to allow the program calling them
>>to display progress. Is that possible in vb?
>
> Does this DLL already have the capability to call a callback function
> while processing? If not, no amount of programming on the VB6 is going to
> make a bit of difference.

....and I should have read all the replies before making mine.