Connecting Tech Pros Worldwide Forums | Help | Site Map

Creating an object visible to Visual Basic

rgb
Guest
 
Posts: n/a
#1: Nov 14 '05
I've got Visual Studio 6.0 and I'm working on a Visual Basic applicaiton.
There a couple parts that really require C.
I've done C programming on a mainframe but nothing on a PC.
So I'm trying to find an example of how to write a function that
has object visibility in VB.

The functionality I want to implement is quite straightforward.
VB will pass me 2 huge byte arrays and about 10 numerical values
that 'tell me how to proceed'. I'll then make substantial changes
to the the arrays and return. Only the array contents need change
not the size.

It would be nice if I could write the C stuff such that VB could do
dim foo as new foo_obj
foo.valA = bla
foo.valN = Xbla
foo.process(array1,array2)
And I could provided a function that VB could call to update a progress bar.
But I'll settle for much less than all that.

Anyone know where an explaination/example can be found?
I've done a little C++ too so if it's easier in C++ no problem.

Malcolm
Guest
 
Posts: n/a
#2: Nov 14 '05

re: Creating an object visible to Visual Basic



"rgb" <rbielaws@i1.net> wrote[color=blue]
> I've got Visual Studio 6.0 and I'm working on a Visual Basic
> applicaiton.
> There a couple parts that really require C.
> I've done C programming on a mainframe but nothing on a PC.
> So I'm trying to find an example of how to write a function that
> has object visibility in VB.
>
> The functionality I want to implement is quite straightforward.
> VB will pass me 2 huge byte arrays and about 10 numerical values
> that 'tell me how to proceed'. I'll then make substantial changes
> to the the arrays and return. Only the array contents need change
> not the size.
>[/color]
It is better to ask these sorts of questions in the caller's rather than the
callee's language.

A C function will compile to an object or library file that contains the C
name of the function, or "label" as its entry point. Parameters are set up
in a standard way.

If VB allows you to call assembler functions, the procedure for calling C
functions is likely to be extremely similar.


s.subbarayan
Guest
 
Posts: n/a
#3: Nov 14 '05

re: Creating an object visible to Visual Basic


Hi,
I have done this type of programming before.There are two
approaches:Make a component mainly an ATL COM type of component which
will remove ur language dependency or create a DLL in C and VB allows
u to add dlls in ur code and create objects out of it and u can access
all the dlls functionalities via the created object.Hope this helps.
Regards,
s.subbarayan



rbielaws@i1.net (rgb) wrote in message news:<3d3b2cda.0405211522.12f2d9fb@posting.google. com>...[color=blue]
> I've got Visual Studio 6.0 and I'm working on a Visual Basic applicaiton.
> There a couple parts that really require C.
> I've done C programming on a mainframe but nothing on a PC.
> So I'm trying to find an example of how to write a function that
> has object visibility in VB.
>
> The functionality I want to implement is quite straightforward.
> VB will pass me 2 huge byte arrays and about 10 numerical values
> that 'tell me how to proceed'. I'll then make substantial changes
> to the the arrays and return. Only the array contents need change
> not the size.
>
> It would be nice if I could write the C stuff such that VB could do
> dim foo as new foo_obj
> foo.valA = bla
> foo.valN = Xbla
> foo.process(array1,array2)
> And I could provided a function that VB could call to update a progress bar.
> But I'll settle for much less than all that.
>
> Anyone know where an explaination/example can be found?
> I've done a little C++ too so if it's easier in C++ no problem.[/color]
Neil Kurzman
Guest
 
Posts: n/a
#4: Nov 14 '05

re: Creating an object visible to Visual Basic




rgb wrote:
[color=blue]
> I've got Visual Studio 6.0 and I'm working on a Visual Basic applicaiton.
> There a couple parts that really require C.
> I've done C programming on a mainframe but nothing on a PC.
> So I'm trying to find an example of how to write a function that
> has object visibility in VB.
>
> The functionality I want to implement is quite straightforward.
> VB will pass me 2 huge byte arrays and about 10 numerical values
> that 'tell me how to proceed'. I'll then make substantial changes
> to the the arrays and return. Only the array contents need change
> not the size.
>
> It would be nice if I could write the C stuff such that VB could do
> dim foo as new foo_obj
> foo.valA = bla
> foo.valN = Xbla
> foo.process(array1,array2)
> And I could provided a function that VB could call to update a progress bar.
> But I'll settle for much less than all that.
>
> Anyone know where an explaination/example can be found?
> I've done a little C++ too so if it's easier in C++ no problem.[/color]

You will either need to make a DLL or an activeX control.


Closed Thread