Thread View: comp.lang.basic.visual.misc
3 messages
3 total messages
Started by Bill Mastbrook
Fri, 22 Mar 1996 21:16
VBX instances - HCTL values
Author: Bill Mastbrook
Date: Fri, 22 Mar 1996 21:16
Date: Fri, 22 Mar 1996 21:16
17 lines
1102 bytes
1102 bytes
Does anyone know how the HCTL values passed to the main control procedure of a VBX are generated? Each instance of a VBX that I've created seems to be generating the same value for HCTL. This is causing major problems because any events fired within the VBX are always fired in the instance of the VBX most recently created (i.e. the second of two VB applications started using the VBX). I'm sure that I'm missing something very basic, but there doesn't seem to be any documentation on this. Everything I've seen says that these HCTL values are unique. Period. And that's all it says. ANY ideas of what I might be doing wrong would be greatly appreciated. Thanks, Bill
Re: VBX instances - HCTL values
Author: Jon Machtynger
Date: Mon, 25 Mar 1996 09:30
Date: Mon, 25 Mar 1996 09:30
43 lines
2097 bytes
2097 bytes
Bill, Sorry I could not reply to your email before. I've had email-out problems but can use Free-Agent to post. In any case, I still can't see how you're getting your problem. To convince you that it should all work. Take a look at the circ2 or circ3 examples that come with VB3.0 Proffessional edition. In the FireClickIn reoutine, add the following code. char Msg[100]; wsprintf(Msg, "HTCL = %d", hctl); MessageBox(NULL, Msg, NULL, MB_OK); Now creae two circ2 controls. When you click on each one, it should show a different value. I can only assume that you've made a user error. Don't forget that the VBX is a DLL and therefore shared by *all* controls using it. So, your global variables are literally that. If any instance needs to reference info, make sure you set up an array and search based on its hctl/hwnd. Hope this helps. Jon ---------------------------- mastbrook@duff.com (Bill Mastbrook) wrote: >Does anyone know how the HCTL values passed to the main control >procedure of a VBX are generated? >Each instance of a VBX that I've created seems to be generating the >same value for HCTL. This is causing major problems because any >events fired within the VBX are always fired in the instance of the >VBX most recently created (i.e. the second of two VB applications >started using the VBX). I'm sure that I'm missing something very >basic, but there doesn't seem to be any documentation on this. >Everything I've seen says that these HCTL values are unique. Period. >And that's all it says. ANY ideas of what I might be doing wrong >would be greatly appreciated. >Bill
Re: VBX instances - HCTL values
Author: Bill Mastbrook
Date: Mon, 01 Apr 1996 18:34
Date: Mon, 01 Apr 1996 18:34
61 lines
2717 bytes
2717 bytes
> mastbrook@duff.com (Bill Mastbrook) wrote:
>>Each instance of a VBX that I've created seems to be generating the
>>same value for HCTL.
jonm@ingres.com (Jon Machtynger) wrote:
>To convince you that it should all work. Take a look at the circ2
>or circ3 examples that come with VB3.0 Proffessional edition.
>In the FireClickIn reoutine, add the following code.
>char Msg[100];
>wsprintf(Msg, "HTCL = %d", hctl);
>MessageBox(NULL, Msg, NULL, MB_OK);
>Now creae two circ2 controls. When you click on each one, it
>should show a different value.
I did exactly this and the same problem still exists: The HCTL value
returned from clicking in any instance of the circ2.vbx is 242. This
is exactly the same value for hctl that I always see from any VBX
(242).
Here's exactly what I did ...
Added the above code to the beginning of FireClickIn in circ2.c.
Made a new VBX project using VC++ 1.52.
Added files circ2.c, circ2.def, circ2.rc to the project.
Added vbapi to the list of linked libraries.
Built the VBX.
Created a new VB 3.0 exe containing one form with the circ2.vbx on it.
(No code, whatsoever).
Copied the VBX to my system directory.
Ran multiple instances of this exe.
All clicks generated "HCTL = 242".
I did receive the following warnings when buildiing the VBX:
Binding resources...
RC: warning RW4002: Non-discardable segment 1 set to PRELOAD
RC: warning RW4002: Non-discardable segment 2 set to PRELOAD
I ignored them.
Any ideas? Could this possibly be a problem with my machine, my
compiler, my compile setttings, or something similar, because from
this test using circ2.vbx I would tend to think that there isn't
anything wrong with my code.
I just realized that when you said, "Now creae two circ2 controls",
that you may have meant to create two different .vbx files using the
same code. Is this correct? If so, does this mean that any instance
of a particular VBX (i.e. .vbx file included in a VB project and the
vbx control placed on a form) passes the same HCTL value to the main
procedure of the VBX. If this is true, then I'm back to my original
question, "How do you fire events in the correct one?".
Thanks,
Bill
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads