Article View: comp.os.ms-windows.programmer.controls
Article #10Re: VBX instances - HCTL values
From: steve bridges
Date: Wed, 10 Apr 1996 22:01
Date: Wed, 10 Apr 1996 22:01
82 lines
3557 bytes
3557 bytes
In Article<4jp844$8jn@news.its.com>, <mastbrook@duff.com> writes: > > 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". The problem here is that an HCTL is actually a far pointer. you should try : sprintf(Msg,"Hctl = %p", (long) hctl); and include stdio.h all you are currently display id the offset to the HCTL which will always be the same. I think your problem would be resolved by using the cbCtlExtra portion of the MODEL definition and the VBDerefControl API. > 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. This warning is just to tell you that certain segments of your code, The one containing the entry point for instance, are going to be loaded. > 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 > > >
Technical Details
Message-ID:
<NEWTNews.829173996.8168.sbridges@OASIS.GE.COM>Path:
arc1-ca.pugleaf.net!news.ge.com!newsReferences:
<4iv5pk$j2q@news.its.com> <4j5p85$qv9@zebedee.ingres.co.uk> <4jp844$8jn@news.its.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!news.ge.com!news From: steve bridges <sbridges@OASIS.GE.COM> Newsgroups: comp.os.ms-windows.programmer.controls,comp.lang.c,comp.lang.basic.visual.misc Subject: Re: VBX instances - HCTL values Date: Wed, 10 Apr 96 15:01:11 PDT Organization: General Electric Company Message-ID: <NEWTNews.829173996.8168.sbridges@OASIS.GE.COM> References: <4iv5pk$j2q@news.its.com> <4j5p85$qv9@zebedee.ingres.co.uk> <4jp844$8jn@news.its.com> NNTP-Posting-Host: 158.254.10.83 Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Newsreader: NEWTNews & Chameleon -- TCP/IP for MS Windows from NetManage