How To Pass a String Between Visual Basic and Your C DLL (187912)
The information in this article applies to:
- Microsoft Visual Basic Learning Edition for Windows 5.0
- Microsoft Visual Basic Learning Edition for Windows 6.0
- Microsoft Visual Basic Professional Edition for Windows 5.0
- Microsoft Visual Basic Professional Edition for Windows 6.0
- Microsoft Visual Basic Enterprise Edition for Windows 5.0
- Microsoft Visual Basic Enterprise Edition for Windows 6.0
- Microsoft Visual C++, 32-bit Enterprise Edition 5.0
- Microsoft Visual C++, 32-bit Professional Edition 5.0
This article was previously published under Q187912 SUMMARY
When creating a C dynamic-link library (DLL) for use with Visual Basic, it
is important to remember that C and Visual Basic treat strings differently.
You must take every precaution to ensure that all strings are passed
correctly; otherwise, a fatal error may occur. This article will show you
how to write a C DLL that takes a string as a parameter to a function, and
how to call the exported function from a Visual Basic application.
REFERENCES
For detailed information on how to create a C DLL and use it in Visual
Basic, please see the following article:
"DLLs for Beginners" in the Microsoft Developer Network (MSDN) Library
"VB5DLL.DOC" located on the Visual Basic 5.0 CD-ROM in the "Tools\Docs"
directory.
For additional information, please see the following article in the
Microsoft Knowledge Base:
142840
: Visual Basic Requirements for Exported DLL Functions
Modification Type: | Minor | Last Reviewed: | 3/3/2005 |
---|
Keywords: | kbAPI kbDLL kbhowto KB187912 |
---|
|