Click here to Skip to main content
15,891,621 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am migrating a VB6 app to a C# app and need to call this dll with different parameters. It is used similarly to WinScard.dll.

This is the declaration I am using:
[DllImport("MCSCM.dll")]
static extern int MCardInitialize(
IntPtr hScardContext,
string cReaderName,
ref long phMCardContext,
ref long pdwDLLVersion
);

This line returns an internal error value instead of 0 for success:
lReturn = Convert.ToInt64(MCardInitialize(mhSCardCtx, sReaderName, ref hMCardCtx, ref dwDLLVersion));

The MCSCM.dll file is in the C:\Windows32 and C:\SYSWow64 folders.

Thank you for any help.

What I have tried:

I have looked it up on Google. It said to register it running a registry command to be used as a reference. A co-worker found an answer here for the WinScard.dll and hoped to find a simil ar answer for MCSCM.dll.
Posted
Updated 2-Dec-19 5:00am
v2

1 solution

You only have to register dlls that expose COM components. If the dll isn't a COM dll then you just call it directly. Google how to call a dll from c# and you'll find lots of samples.
 
Share this answer
 
Comments
Kraig Kuusinen 25-Oct-19 12:35pm    
I am trying to find out how to use DLLImport for the MCSCM.dll for the following:
MCardInitialize, MCardConnect, MCardReadMemory, MCardConnect and MCardShutdown. Thank you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900