Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Help using ActiveX Controls

0 views
Skip to first unread message

Michael Lenoir

unread,
Jun 14, 2000, 3:00:00 AM6/14/00
to
Greetings, everyone.

Question:
What do I have to do to be able to use ActiveX controls in my VFP app???
I've tried 5 ActiveX Winsock controls and can't get any of them to work.


Situation:

I need an ActiveX/COM control to allow my VFP app to read data from a TCP/IP
port.

Demos have been downloaded from Dolphin, Dart, Catalyst, Mabry and PowerTCP.
All have sample VB projects that I can compile and run just fine in VB.

I have taken the pertinent code out of the VB forms and placed in a VFP
form. Yes I have registered the controls and yes I have made the language
adjustments. The forms compile and run without error. However, none of the
controls work.

The controls are very simple to set up. To listen on a port, the commands
are similar to:
thisform.oc1.localport = 2000 * listen on
port 2000
thisform.oc1.listen()

Any activity on the specified port should fire the method
thisform.oc1.accept(), but this method never fires. I can also go to dos and
issue the netstat command to verify that the port is not being activated.

I did find reference to an application object property (_vfp.autoyield.) I
have set it to .t. to allow the ActiveX events to fire whenever they occur.

Any suggestions will be appreciated. Thanks.

--
Michael Lenoir
Matrix Solutions, Inc.
mi...@matrixsolutions.com


David Griebel

unread,
Jun 14, 2000, 3:00:00 AM6/14/00
to
Try Microsoft's Internet Transfer Control. I'm not sure if it can
listen on a port, but it's worth a try.

MAppell917

unread,
Jun 15, 2000, 3:00:00 AM6/15/00
to
Couple of things,

first, you say you went to DOS and verfied the port is not being activated.
Does this mean there is no activity on the port? If so, that's why the event
is not firing. Why is there no activity on the port?

What I would do if I were you, is test some of the other methods and see if any
of them are working.

Another point to consider. I'm currently working with an ActiveX control
myself right now. Do you have a help file or reference manual you can consult
or better yet technical support for the control (Yea I know, everyone uses VB
these days - when will they learn?). Anyways, in my ActiveX control there's a
RegisterEvents method and you have to register the events you want to fire (in
the activeX registerevents method) otherwise none will fire. Maybe you have
something like that too.

But, that brings me to yet another point/question (which I'm hoping you may
know the answer to). My activeX control (and probably yours and a lot of other
ones too) have integers that are global (well, at least I think they are
supposed to be global). The idea being that you can use these constants in the
form. The problem is that I don't know how VFP knows about them. It's a lot
better to issue a RegisterEvents(oc1Listen) rather than go to the object
browser and find the constant and say RegisterEvents(-23148334). But, how
would you tell VFP that oc1Listen is an integer and should be set to -23148334
or whatever the ActiveX control says it should be set to?

(P.S. - if I'm breaking protocol by asking a different active X question
without a separate post please let me know although the subject would be the
same)

Thanks.

>Any activity on the specified port should fire the method
>thisform.oc1.accept(), but this method never fires. I can also go to dos and
>issue the netstat command to verify that the port is not being activated.
>
>I did find reference to an application object property (_vfp.autoyield.) I
>have set it to .t. to allow the ActiveX events to fire whenever they occur.
>
>Any suggestions will be appreciated. Thanks.
>


Mike

AME

unread,
Jun 15, 2000, 3:00:00 AM6/15/00
to
Have you considered an INCLUDE Header file, FOXPRO.H for instance, to make the
"definitions" available.

Michael Lenoir

unread,
Jun 15, 2000, 3:00:00 AM6/15/00
to
M, Thanks for your response.

> first, you say you went to DOS and verfied the port is not being
activated.
> Does this mean there is no activity on the port? If so, that's why the
event
> is not firing. Why is there no activity on the port?

When a program successfully grabs a TCP/IP port, the port is 'in-use.'
Running the dos command "netstat -a -n" will show you all TCP/IP ports that
are currently "in-use" by a program. The selected port shows up as 'in-use'
when the VB app runs, but does not show up as 'in-use' when the FoxPro app
runs. The app is not grabbing the port, so activity on the port is not
triggering events.

> What I would do if I were you, is test some of the other methods and see
if any
> of them are working.

Good Idea.

>
> Another point to consider. I'm currently working with an ActiveX control
> myself right now. Do you have a help file or reference manual you can
consult
> or better yet technical support for the control (Yea I know, everyone uses
VB
> these days - when will they learn?). Anyways, in my ActiveX control
there's a
> RegisterEvents method and you have to register the events you want to fire
(in
> the activeX registerevents method) otherwise none will fire. Maybe you
have
> something like that too.

I'll check. But...the same 2 or 3 activex commands were sufficient in a test
VB form. Shouldn't the ActiveX control require the same setup/use
regardless of the development environment? Yes, the surrounding code may be
dependent, but setting a property and issuing a method should garner the
same response from the ActiveX component REGARDLESS of the language you are
using.?.

M, did you have to change the autoyield property to get your events to
fire???


> But, that brings me to yet another point/question (which I'm hoping you
may
> know the answer to). My activeX control (and probably yours and a lot of
other
> ones too) have integers that are global (well, at least I think they are
> supposed to be global). The idea being that you can use these constants
in the
> form. The problem is that I don't know how VFP knows about them. It's a
lot
> better to issue a RegisterEvents(oc1Listen) rather than go to the object
> browser and find the constant and say RegisterEvents(-23148334). But, how
> would you tell VFP that oc1Listen is an integer and should be set
to -23148334
> or whatever the ActiveX control says it should be set to?

I always have one .h file with all that stuff in it and put that file in the
'include file' of every form. The ActiveX may give you an include file,
which you can include in your .h file, or you may just want to type in their
defines into your .h file.

MAppell917

unread,
Jun 15, 2000, 3:00:00 AM6/15/00
to
Absolutely I have considered a .H file and only if I must. It's not the RIGHT
way to do it. The correct way is where the ActiveX object tells VFP what the
constants are via a reference. What if they come out with an update version of
the ActiveX control? Now I have to go back into the object browser again six
months or a year later every time there's an update if the constants have
changed and look for all the constants all over again. Just another
maintenance headache. I know there's a way that the ActiveX object can tell
VFP what these constants are.


>
>Have you considered an INCLUDE Header file, FOXPRO.H for instance, to make
>the
>"definitions" available.
>
>


Mike

MAppell917

unread,
Jun 15, 2000, 3:00:00 AM6/15/00
to
>Shouldn't the ActiveX control require the same setup/use
>regardless of the development environment? Yes, the surrounding code may be
>dependent, but setting a property and issuing a method should garner the
>same response from the ActiveX component REGARDLESS of the language you are
>using.?.

One would think the ActiveX control would require the same setup regardless of
the environment. But I'll tell you this. In the documentation of the activeX
control that I'm using there's a method that I have to use called
RegisterEvents() Now, it says the second parameter is optional. However, I
kept getting errors (yes, I was pulling my hair out). Then accidentally I did
something at around 3 in the morning and it worked. I forgot what I did. The
next day I played around and it worked again and I didn't forget. The SECOND
parameter was NOT quite optional like the documentation said. I had to give it
a null character string. For example

thisform.MyActiveXControl.RegisterEvents(-28344544)

constantly gave me an error (oh my frustration level....need I tell you more?).
But,

thisform.MyActiveXControl.RegisterEvents(-28344544, "")

worked beautifully. However, according to the documentation (in VB of course)
the second parameter is optional. Such was not the case in VFP. I played
around and got lucky. Now I'm trying to find a way to access those constants
rather than use an object browser to find out what they are and setup a header
file. I may not have a choice for now but you know what they say..... there's
usually a right way and a wrong way to do things......


>
>M, did you have to change the autoyield property to get your events to
>fire???
>

I don't know anything about an autoyield property. I have a completely
different ActiveX control than what you have and mine does something totally
different than what you are doing. I have to access the RegisterEvents method
to get my events to fire. But, what I'm suggesting is that there might be some
other method(s) and/or property(s) that control how your events behave and
whether they fire.

>I always have one .h file with all that stuff in it and put that file in the
>'include file' of every form. The ActiveX may give you an include file,
>which you can include in your .h file, or you may just want to type in their
>defines into your .h file.

BINGO ! Now why didn't I think of that? Here I am about to go into the object
browser and look for all the constants and it's right there in the .H file they
provide me. Thanks and I hope I've given you some ideas. Again, look at all
the properties and methods in your ActiveX documentation. Mine came with both
a .chm help file and a pdf acrobat file. Now, why they are different I don't
know.

Mike

MAppell917

unread,
Jun 15, 2000, 3:00:00 AM6/15/00
to
As a follow up I'd like to say that I found out (with the help under the
ActiveX subject) there is already a .H file included with the ActiveX
component. In fact, my understanding now is that usually there is a .H file
included with an ActiveX component (well at least a third party ActiveX
component). Hopefully that might keep someone else from pulling their hair
out....

Thanks again.

>Subject: Re: Help using ActiveX Controls
>From: mappe...@aol.com (MAppell917)
>Date: 6/15/00 10:21 AM Pacific Daylight Time
>Message-id: <20000615132107...@ng-md1.aol.com>


Mike

Fred Taylor

unread,
Jun 15, 2000, 3:00:00 AM6/15/00
to
Sounds like you're missing the point of what an include file does.

If they change the VALUES of the CONSTANTS, all you'd need to do is
recompile with the new values. They shouldn't be changing the NAMES of the
CONSTANTS.

Fred

"MAppell917" <mappe...@aol.com> wrote in message
news:20000615132107...@ng-md1.aol.com...

MAppell917

unread,
Jun 15, 2000, 3:00:00 AM6/15/00
to
Fred,

thank you for your reply. No, actually I know what an include file does. Also,
I've got it now for the ActiveX control. The problem was I was thinking, why
should I have to confirm that the constants have not changed with each
revision. That's what I would have to do if I create an include file. And the
fact is, I don't since they provide a header file. I don't need to worry about
it. I figure if constants change for any reason in a future update it doesn't
matter because they are responsible for maintaining the header file.

Thanks again.

>Subject: Re: Help using ActiveX Controls

>From: "Fred Taylor" fta...@uswest.net
>Date: 6/15/00 2:28 PM Pacific Daylight Time
>Message-id: <6Ub25.111$lY4....@news.uswest.net>


>
>Sounds like you're missing the point of what an include file does.
>
>If they change the VALUES of the CONSTANTS, all you'd need to do is
>recompile with the new values. They shouldn't be changing the NAMES of the
>CONSTANTS.
>
>Fred
>


Mike

CharlieGC

unread,
Jun 16, 2000, 3:00:00 AM6/16/00
to
We've had much better success with IP*Works by DevSoft.

Mabry and others gave us problems. But the IP*Works does great. Plus you get a
lot of other stuff. Much, much better than anything included with MS. Downside,
IP*Works costs money.

Their website is: www.dev-soft.com

>Question:
>What do I have to do to be able to use ActiveX controls in my VFP app???
>I've tried 5 ActiveX Winsock controls and can't get any of them to work.

[snip]

char...@aol.com

0 new messages