i have asdecr.dll file
and i have to call c++ 2010 dll made file in vb 6
tell me process in detail..
like after open vb 6 what should i have to do to open dll file...
step by step

Dani AI

Generated

Short primer: the VB6 "Add Reference" dialog accepts COM type libraries (TLB/registered COM DLLs) or ActiveX controls. The error saw ("can't add a reference to the specified file") normally means the DLL is a native Win32 or a non‑COM file, not something VB6 can reference. 's pointers to MSDN are useful, but a concise walkthrough below addresses the two common scenarios and the usual pitfalls.

Determine what the DLL is:

  • Native Win32 DLL (exports C functions): inspect the file with Dependency Walker (depends.exe) or run dumpbin /exports from Visual Studio tools to see exported names.
  • COM DLL / TypeLib: use OLE/COM Object Viewer or try regsvr32 to register; a successful regsvr32 indicates a COM in‑proc server.
  • .NET assembly: these need COM interop (regasm) or a native wrapper — they are not directly Add Referenceable by VB6.

Calling native exported functions from VB6 (recommended for simple APIs):

  • Export simple C-style functions from the VC++ project (avoid C++ class methods or STL types; use plain integers, doubles, buffers).
  • Use extern "C" to avoid name mangling and __stdcall to match VB6 calling convention.

Example C++ wrapper:

extern "C" __declspec(dllexport) long __stdcall AddNumbers(long a, long b)
{
    return a + b;
}

Example VB6 declaration:

Private Declare Function AddNumbers Lib "asdecr.dll" (ByVal a As Long, ByVal b As Long) As Long

Practical cautions and troubleshooting:

  • VB6 is 32‑bit — the DLL must be 32‑bit. A 64‑bit DLL will fail to load.
  • Visual C++ runtime dependencies (MSVCR100.dll for VC++ 2010) must be present; install the VC++ redistributable or statically link CRT.
  • Strings and complex types require careful marshaling; for simplicity use numeric types or caller‑allocated buffers.
  • If the DLL only exports mangled names, add extern "C" or use a .def file. If only a type library is needed, register the COM server with regsvr32.

Summary: if asdecr.dll is a native DLL, call its exported functions with Declare; if it’s COM/.NET, register and expose a type library or create a small native wrapper that exposes C-style stdcall functions for VB6 to call.

Recommended Answers

All 2 Replies

here's a link that discusses that.
here's another

i have to use this winmm.dll...

Private Declare Function timeGetTime Lib "winmm.dll" () As Long

is this delaration function correct??
and i have to add asdecr.dll files as referance...
getting this error:-can't add a reference to the specified file

help me.. for my project

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.