Visual C++ DLL in Visual Basic 
Author Message
 Visual C++ DLL in Visual Basic

Do you have source for this library?

Let us see the function declaration and what you want to change
it to do, and I suspect any number of people could answer your
question...  Just need more detail, generally...



Quote:
> We are having trouble creating a DLL in Visual C++
> that can be used in Visual Basic.  What we are trying
> to do is modify the UNIX RFC DES Password
> Encryption routines for our own internal use.  We've
> found a library on the internet already that works, but
> the function it came with only accepts one paramater,
> we need to pass two, and for the life of me I can't figure
> out what I'm doing wrong, and why I can only pass
> one parameter.

> I've searched Microsoft and MSDN up and down.  Could
> someone point me to some information regarding creating
> DLL's for VB in C++?

> Thanks!
> Bryan Murphy

> ps. Please reply via e-mail if you can!



Sat, 05 Feb 2000 03:00:00 GMT  
 Visual C++ DLL in Visual Basic

We are having trouble creating a DLL in Visual C++
that can be used in Visual Basic.  What we are trying
to do is modify the UNIX RFC DES Password
Encryption routines for our own internal use.  We've
found a library on the internet already that works, but
the function it came with only accepts one paramater,
we need to pass two, and for the life of me I can't figure
out what I'm doing wrong, and why I can only pass
one parameter.

I've searched Microsoft and MSDN up and down.  Could
someone point me to some information regarding creating
DLL's for VB in C++?

Thanks!
Bryan Murphy

ps. Please reply via e-mail if you can!



Sat, 05 Feb 2000 03:00:00 GMT  
 Visual C++ DLL in Visual Basic

How To Write a C++ DLL for Visual Basic
by Mike McKee

You can pull this off easily in 13 steps:

        Assume you have VB 4/32 and VC++ 4.0.
        Assume you can write an ANSI C function, bare minimum.

Launch VC++ Developer Studio.
Choose File, New... and choose Project Workspace.
Choose DLL option and type in the name of your DLL under 8 chars, as in
"netfs."  Assume here for the rest of these instructions that x is your
project name.
Choose Insert Files into Project, Source Files type.  Type a name like
x.cpp
Save the file before you start typing text into it.
Type into x.cpp your C functions with no regard to whether this is a DLL or
not.
Do not type in a Main, DllMain, or any other "main" type function--a DLL
should just contain functions.
Now for the fun stuff.  Preface your C code at the top with:

#define CCONV __stdcall /* NOTE: __stdcall is two underscores, not one
underscore!!! */
#define NOMANGLE

And do the following conversion on each function:

Before
LONG GrantDir (LPSTR lpszDomain, LPSTR lpszAccount, LPSTR lpszDir) {

After
NOMANGLE LONG CCONV GrantDir (LPSTR lpszDomain, LPSTR lpszAccount, LPSTR
lpszDir) {

Choose Insert Files into Project, Definition Files type.  Type a name like
x.def.
Save the file before you start typing text into it.
In x.def file, you must assign a definition for your project.  You might
have to change some things, but generally it should look like:

LIBRARY x
DESCRIPTION 'x can be called from Visual Basic'

CODE PRELOAD MOVEABLE DISCARDABLE
DATA PRELOAD MOVEABLE

EXPORTS

Note that the library name should be the same name as we've been using for
x all along here.  Also note that the EXPORTS command requires a listing of
functions you had in your x.cpp file.  Each function should be suffixed

From the Build menu, choose Build menuitem to create x.dll.  It's that
easy.

Now an explanation of the trick that made this all easy.  Normally, making
DLLs is a very hard process, involving a DllMain, and some other odd calls,
but when you chose New, Project Workspace, DLL, a header file is attached
to your project that does all the magic to make this a DLL.



Mon, 07 Feb 2000 03:00:00 GMT  
 Visual C++ DLL in Visual Basic

Why not try using the Windows cryptography functions, I followed some
example code, and created a .DLL to implement RC4 encryption and
decryption.  This is easily callable by VB programs.  Look on Microsoft
site for reference to wincrypt.h, CryptEncrypt, CryptDecrypt, etc.  The
sample I used was an NT console app with EncryptFile and DecryptFile
functions.

Jim Frisby



Quote:
> We are having trouble creating a DLL in Visual C++
> that can be used in Visual Basic.  What we are trying



Mon, 07 Feb 2000 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. adapting Visual C++ dll for Visual Basic

2. Visual C++ DLL in Visual Basic

3. Visual C++ DLL in Visual Basic

4. How do you call a Visual C++ (DLL) function from Visual Basic

5. Calling Visual C++ 5.0 DLL Functions From Visual Basic 5.0

6. Visual Basic and Visual C++ DLL with array of structures

7. Help with Visual Basic ActiveX DLL showing form within Visual C++ app

8. Help with Visual Basic ActiveX DLL showing form within Visual C++ ATL app

9. Visual Basic 4.0 usage of DLLs written in Visual C++ 4.0

10. How to write Visual C++ DLL's and call them from Visual Basic

11. Visual Basic 4.0 usage of DLLs written in Visual C++ 4.0

12. Visual C++ and Visual Basic and Visual J++

 

 
Powered by phpBB® Forum Software