For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic > January 2006 > Interfacing question









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Interfacing question
warder

2006-01-25, 9:55 pm

Hi,

We have an old Visual Basic 6 application that we have that contains
some data of interest.

We also have a C++ application that requires access to that data.

In the .NET world we would probably provide a web service from the VB
app and request the data from the C++, but this is Visual Basic 6...

Out of lots of technologies, DDE, DCOM, windows sockets, etc, can any
VB expert offer any advise as to what would be best to use? We would
be doing perhaps 4 calls/s to request data which could effectively be a
function call.

Thanks!

rw.

DanS

2006-01-25, 9:55 pm

"warder" <realwarder@gmail.com> wrote in news:1138241877.359159.256130
@g14g2000cwa.googlegroups.com:

> Hi,
>
> We have an old Visual Basic 6 application that we have that contains
> some data of interest.



Forgive me but how does a program have data ? Typically 'data' is stored in
some type of data file, like image data, or a database, or a CAD drawing,
and the program would display the data in form, like a picture, or a
grid/form, or a 2D line drawing, respectively.


> We also have a C++ application that requires access to that data.
>
> In the .NET world we would probably provide a web service from the VB
> app and request the data from the C++, but this is Visual Basic 6...
>
> Out of lots of technologies, DDE, DCOM, windows sockets, etc, can any
> VB expert offer any advise as to what would be best to use? We would
> be doing perhaps 4 calls/s to request data which could effectively be a
> function call.
>
> Thanks!
>
> rw.
>
>


Randy Birch

2006-01-26, 3:55 am

I suspect he means code logic or strings, and no project files.

--

Randy Birch
MS MVP Visual Basic
http://vbnet.mvps.org/

Please reply to the newsgroups so all can participate.




"DanS" <t.h.i.s.n.t.h.a.t@a.d.e.l.p.h.i.a..n.e.t> wrote in message
news:Xns9756E106BA4AFidispcom@216.196.97.142...
: "warder" <realwarder@gmail.com> wrote in news:1138241877.359159.256130
: @g14g2000cwa.googlegroups.com:
:
: > Hi,
: >
: > We have an old Visual Basic 6 application that we have that contains
: > some data of interest.
:
:
: Forgive me but how does a program have data ? Typically 'data' is stored
in
: some type of data file, like image data, or a database, or a CAD drawing,
: and the program would display the data in form, like a picture, or a
: grid/form, or a 2D line drawing, respectively.
:
:
: > We also have a C++ application that requires access to that data.
: >
: > In the .NET world we would probably provide a web service from the VB
: > app and request the data from the C++, but this is Visual Basic 6...
: >
: > Out of lots of technologies, DDE, DCOM, windows sockets, etc, can any
: > VB expert offer any advise as to what would be best to use? We would
: > be doing perhaps 4 calls/s to request data which could effectively be a
: > function call.
: >
: > Thanks!
: >
: > rw.
: >
: >
:

Lance Wynn

2006-01-26, 3:55 am

Any of the methods you mention will work,
if the application is already an activex dll, you can access it's methods
from C++, if not, you can easily expose an activex interface to it to
accomplish the same thing (In most cases).

Also, if it's already listening to sockets, then you can connect to the
listener, and pass data to it using whatever protocol it likes.

DCOM is just an environment that you can use to expose objects across
process, and network boundaries. Again, if it's already an Activex DLL, or
an Activex EXE, you should be able to call it from C++ without too much
effort.

As for a Webservice, you can use (the now unsupported) MS Soap Toolkit to
export the appropriate WSDL file, and ASP, or ISAPI extension to expose the
public methods as a webservice.

I don't care for DDE too much as I have never really gotten it to work well
outside of an interactive user environment. But this may not be the
technologies fault, I just never spent much time on it.

HTH

Lance




"warder" <realwarder@gmail.com> wrote in message
news:1138241877.359159.256130@g14g2000cwa.googlegroups.com...
Hi,

We have an old Visual Basic 6 application that we have that contains
some data of interest.

We also have a C++ application that requires access to that data.

In the .NET world we would probably provide a web service from the VB
app and request the data from the C++, but this is Visual Basic 6...

Out of lots of technologies, DDE, DCOM, windows sockets, etc, can any
VB expert offer any advise as to what would be best to use? We would
be doing perhaps 4 calls/s to request data which could effectively be a
function call.

Thanks!

rw.


Paul Clement

2006-01-26, 6:55 pm

On 25 Jan 2006 18:17:57 -0800, "warder" <realwarder@gmail.com> wrote:

¤ Hi,
¤
¤ We have an old Visual Basic 6 application that we have that contains
¤ some data of interest.
¤
¤ We also have a C++ application that requires access to that data.
¤
¤ In the .NET world we would probably provide a web service from the VB
¤ app and request the data from the C++, but this is Visual Basic 6...
¤
¤ Out of lots of technologies, DDE, DCOM, windows sockets, etc, can any
¤ VB expert offer any advise as to what would be best to use? We would
¤ be doing perhaps 4 calls/s to request data which could effectively be a
¤ function call.

I'm not exactly sure what your data store is. Could you identify?


Paul
~~~~
Microsoft MVP (Visual Basic)
Dave

2006-01-26, 6:56 pm

He could mean data in a resource file that has been compiled into the
executable. I think there are utilites that will get that stuff, but somehow
I think that is probably not what is meant here.

Dave O.


"Randy Birch" <rgb_removethis@mvps.org> wrote in message
news:e35qX2iIGHA.604@TK2MSFTNGP14.phx.gbl...
>I suspect he means code logic or strings, and no project files.
>
> --
>
> Randy Birch
> MS MVP Visual Basic
> http://vbnet.mvps.org/
>
> Please reply to the newsgroups so all can participate.
>
>
>
>
> "DanS" <t.h.i.s.n.t.h.a.t@a.d.e.l.p.h.i.a..n.e.t> wrote in message
> news:Xns9756E106BA4AFidispcom@216.196.97.142...
> : "warder" <realwarder@gmail.com> wrote in news:1138241877.359159.256130
> : @g14g2000cwa.googlegroups.com:
> :
> : > Hi,
> : >
> : > We have an old Visual Basic 6 application that we have that contains
> : > some data of interest.
> :
> :
> : Forgive me but how does a program have data ? Typically 'data' is stored
> in
> : some type of data file, like image data, or a database, or a CAD
> drawing,
> : and the program would display the data in form, like a picture, or a
> : grid/form, or a 2D line drawing, respectively.
> :
> :
> : > We also have a C++ application that requires access to that data.
> : >
> : > In the .NET world we would probably provide a web service from the VB
> : > app and request the data from the C++, but this is Visual Basic 6...
> : >
> : > Out of lots of technologies, DDE, DCOM, windows sockets, etc, can any
> : > VB expert offer any advise as to what would be best to use? We would
> : > be doing perhaps 4 calls/s to request data which could effectively be
> a
> : > function call.
> : >
> : > Thanks!
> : >
> : > rw.
> : >
> : >
> :
>



David J Mark

2006-01-26, 6:56 pm


"warder" <realwarder@gmail.com> wrote in message
news:1138241877.359159.256130@g14g2000cwa.googlegroups.com...
> Hi,
>
> We have an old Visual Basic 6 application that we have that contains
> some data of interest.


That is strange. The app contains the data or maintains it?

>
> We also have a C++ application that requires access to that data.
>
> In the .NET world we would probably provide a web service from the VB
> app and request the data from the C++, but this is Visual Basic 6...


Probably not. Unless the data is actually IN the application.

>
> Out of lots of technologies, DDE, DCOM, windows sockets, etc, can any
> VB expert offer any advise as to what would be best to use? We would
> be doing perhaps 4 calls/s to request data which could effectively be a
> function call.


Not without some more information about this mysterious data. If it is in a
database after all, then VB doesn't enter into it.

>
> Thanks!
>
> rw.
>



David J Mark

2006-01-26, 6:56 pm

They may mean an object (code + data.)

"Randy Birch" <rgb_removethis@mvps.org> wrote in message
news:e35qX2iIGHA.604@TK2MSFTNGP14.phx.gbl...
>I suspect he means code logic or strings, and no project files.
>
> --
>
> Randy Birch
> MS MVP Visual Basic
> http://vbnet.mvps.org/
>
> Please reply to the newsgroups so all can participate.
>
>
>
>
> "DanS" <t.h.i.s.n.t.h.a.t@a.d.e.l.p.h.i.a..n.e.t> wrote in message
> news:Xns9756E106BA4AFidispcom@216.196.97.142...
> : "warder" <realwarder@gmail.com> wrote in news:1138241877.359159.256130
> : @g14g2000cwa.googlegroups.com:
> :
> : > Hi,
> : >
> : > We have an old Visual Basic 6 application that we have that contains
> : > some data of interest.
> :
> :
> : Forgive me but how does a program have data ? Typically 'data' is stored
> in
> : some type of data file, like image data, or a database, or a CAD
> drawing,
> : and the program would display the data in form, like a picture, or a
> : grid/form, or a 2D line drawing, respectively.
> :
> :
> : > We also have a C++ application that requires access to that data.
> : >
> : > In the .NET world we would probably provide a web service from the VB
> : > app and request the data from the C++, but this is Visual Basic 6...
> : >
> : > Out of lots of technologies, DDE, DCOM, windows sockets, etc, can any
> : > VB expert offer any advise as to what would be best to use? We would
> : > be doing perhaps 4 calls/s to request data which could effectively be
> a
> : > function call.
> : >
> : > Thanks!
> : >
> : > rw.
> : >
> : >
> :
>



warder

2006-01-26, 6:56 pm

Interesting that you ask the question "How does a program have data".
Not something I had considered someone would ask, since all programs
include data in a gazillions forms, but fundamentally that are all bits
and bytes.

So to answer your question, I have some data... a few strings, integers
etc. that could easily be returned using a function call as var types
of parameters.

warder

2006-01-26, 6:56 pm

Lance,

Thanks for your reply.. I had considered the SOAP toolkit, but then
you're just creating a plug-in for IIS or the likes, whereas I need
something integrated, standard, but quick and simple if that makes
sense.

I have:

VB1.exe - contains say an integer i'm interested in

CPP1.exe - needs quick access to the integer

What technologies does VB inherently support in an easy to use fashion
that will enable CPP1.exe to get the number?

Thanks.

rw.

YYZ

2006-01-26, 6:56 pm

> So to answer your question, I have some data... a few strings, integers
> etc. that could easily be returned using a function call as var types
> of parameters.


You didn't say, but I'm assuming that the VB exe isn't on the same
machine as the cpp exe...right?

Well, can you use Winsock? I've used winsock to communicate from 1 app
to another on different machines using Winsock. It really doesn't take
too long, and if you are just passing simple types back and forth,
that's very easy to do.

Matt

YYZ

2006-01-26, 6:56 pm

Oh, and if you want the cheesy yet WAY simple way, just write that data
to a file somewhere where all exes can get at it -- the VB exe would
need to be able to write, but the cpp would only need to be able to
read it. Network drive, webserver, ftp server, etc. would all suffice,
and be VERY easy to implement.

However, it is hard to give you advice on the "best" method, if one
exists, without more information.

Karl E. Peterson

2006-01-26, 6:56 pm

warder wrote:
> We have an old Visual Basic 6 application that we have that contains
> some data of interest.
>
> We also have a C++ application that requires access to that data.


If it's an ActiveX EXE, the easiest method would be straight-up COM, I would
think. You could also consider converting it to ActiveX, if you're amenable
to COM on the C++ side.

> Out of lots of technologies, DDE, DCOM, windows sockets, etc, can any
> VB expert offer any advise as to what would be best to use? We would
> be doing perhaps 4 calls/s to request data which could effectively be
> a function call.


If COM isn't desirable, I'd probably turn to either WM_COPYDATA or DDE, in
that order, myself.
--
Working without a .NET?
http://classicvb.org/


Lance Wynn

2006-01-26, 6:56 pm

If you have access to the VB Project, and can make modifications to it, I
would say change it to an Activex EXE, and expose the property (or
properties) that you wish to retrieve. This will make it a bit easier in
the long run to manage, and you can easily use it from many different
languages, (Not just C++).

If not, Karl Peterson suggested WM_CopyData, or DDE, which probably would
not require any changes to the VB code.

Lance


"warder" <realwarder@gmail.com> wrote in message
news:1138241877.359159.256130@g14g2000cwa.googlegroups.com...
Hi,

We have an old Visual Basic 6 application that we have that contains
some data of interest.

We also have a C++ application that requires access to that data.

In the .NET world we would probably provide a web service from the VB
app and request the data from the C++, but this is Visual Basic 6...

Out of lots of technologies, DDE, DCOM, windows sockets, etc, can any
VB expert offer any advise as to what would be best to use? We would
be doing perhaps 4 calls/s to request data which could effectively be a
function call.

Thanks!

rw.


Karl E. Peterson

2006-01-26, 6:56 pm

Lance Wynn wrote:
> If not, Karl Peterson suggested WM_CopyData, or DDE, which probably
> would not require any changes to the VB code.


No, I think mods would be required, no matter what. Unless the original
programmer anticipated, and provided for, such needs.
--
Working without a .NET?
http://classicvb.org/


Bob O`Bob

2006-01-26, 6:56 pm

Karl E. Peterson wrote:
> Lance Wynn wrote:
>
>
>
> No, I think mods would be required, no matter what. Unless the original
> programmer anticipated, and provided for, such needs.



Even in that unusual case, documentation would NEED to have been supplied
by the creators of the intended interface, or else it would end up being
an even bigger challenge to dig in and discern what was intended
than it would be to go in and insert a whole new interface.


</voice of experience>



Bob
--
Lance Wynn

2006-01-26, 9:55 pm

I recall doing this at one point during a VB Class I took years ago (I never
had much use for it since) But I thought there was a way you could inspect
a running EXE to find the DC of any of the components within it, you can't
do this from VB, but there are some "SPY" programs out there that I believe
can do this. And then you could use some API calls to find the values of
those components at runtime.

I thought that's what the WM_COPYDATA did, but I guess I was mistaken.

Perhaps someone here knows what I'm talking about and can give you more
details, or maybe you can look around for samples.


"Bob O`Bob" <filterbob@yahoogroups.com> wrote in message
news:%23Bd5RCtIGHA.1132@TK2MSFTNGP10.phx.gbl...
Karl E. Peterson wrote:
> Lance Wynn wrote:
>
>
>
> No, I think mods would be required, no matter what. Unless the original
> programmer anticipated, and provided for, such needs.



Even in that unusual case, documentation would NEED to have been supplied
by the creators of the intended interface, or else it would end up being
an even bigger challenge to dig in and discern what was intended
than it would be to go in and insert a whole new interface.


</voice of experience>



Bob
--


Randy Birch

2006-01-26, 9:55 pm

If you know the hwnd of any window, you can get its DC using GetDc() or
GetDCEx().

--

Randy Birch
MS MVP Visual Basic
http://vbnet.mvps.org/

Please reply to the newsgroups so all can participate.




"Lance Wynn" <LanceWynn@community.nospam> wrote in message
news:%2356T8vuIGHA.3752@TK2MSFTNGP11.phx.gbl...
:I recall doing this at one point during a VB Class I took years ago (I
never
: had much use for it since) But I thought there was a way you could
inspect
: a running EXE to find the DC of any of the components within it, you can't
: do this from VB, but there are some "SPY" programs out there that I
believe
: can do this. And then you could use some API calls to find the values of
: those components at runtime.
:
: I thought that's what the WM_COPYDATA did, but I guess I was mistaken.
:
: Perhaps someone here knows what I'm talking about and can give you more
: details, or maybe you can look around for samples.
:
:
: "Bob O`Bob" <filterbob@yahoogroups.com> wrote in message
: news:%23Bd5RCtIGHA.1132@TK2MSFTNGP10.phx.gbl...
: Karl E. Peterson wrote:
: > Lance Wynn wrote:
: >
: >>If not, Karl Peterson suggested WM_CopyData, or DDE, which probably
: >>would not require any changes to the VB code.
: >
: >
: > No, I think mods would be required, no matter what. Unless the original
: > programmer anticipated, and provided for, such needs.
:
:
: Even in that unusual case, documentation would NEED to have been supplied
: by the creators of the intended interface, or else it would end up being
: an even bigger challenge to dig in and discern what was intended
: than it would be to go in and insert a whole new interface.
:
:
: </voice of experience>
:
:
:
: Bob
: --
:
:

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com