Click here to Skip to main content
15,909,324 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,
I am working with smart card technology and In C/C++ we have winscard.h for smart card. In vc++ console application i have used it but now i want to make a window application.
For security i want to keep my all code in library and call it on button click when require.
for window application , In VC++ we have , WIn 32 app, window form application and MFC application,here which option would be easy to me. also which option i should use for making library.

when i choose win 32 console application , next he has some checkbox asking for static or dll library, here i can choose anyone here for making my library? or i need to use other project type to make my library.

also in vc++ we have a project type - Class Library , if i will choose it, i can use it in windows form application? I already used static , dynamic concept { Implicit/explicit linking} in console but when i am trying to use that library in window form application, here it is showing problem, some people are telling me to use c++/cli or some are saying problem is because of managed and unmanaged code. I am really confused now, please tell me what project type i should use for application and library Your any word means a lot for me.
Posted
Comments
Vardhraz 9-Oct-12 0:54am    
In vc++ windows form creation is little difficult one..better you can create DLL in Vc++ using COM ATL/MFC..then you can create windows form easily using c# and by link your DLL ,you can call the function dynamically...try to do this way to makes it easy...

The first thing you should do is decide which framework you want to use for your application: Win32, MFC or C++/CLI. Once you have made that decision then you can do all your development using that technology. There is no reason to create a DLL or static library unless it will be shared with other applications. Moving code into a library does not improve the security of the application; it is quite possible it will make it less secure.
 
Share this answer
 
Comments
amit _pathak_aadi 10-Oct-12 0:46am    
Here in smart card, we have different security command like - 00 a4 00 00 02 3f 00 and we can not share this with the developer who made front end application. Dll is only option left for hiding the secure code!!!!
Richard MacCutchan 10-Oct-12 3:59am    
Creating and Using a Dynamic Link Library (C++) will help you create your library, and Platform Invoke Tutorial will show you how to access it from C#.
amit _pathak_aadi 10-Oct-12 8:07am    
the link u pasted here, for making dll, I already used it, here it produce .lib, .dll. To use the dll we have 2 technique 1-Implicti Linking 2 Explicit linking. if dll have class/object structure , we are bound to use Implicit linking (here we require both .lib or .dll file ) and when dll have ordinary c methods we can use it with explicit linking. So i am just asking you if i will make dll which have class and methods can be call easily with Platform Invoke method or it will only work when dll have normal c functions.
Richard MacCutchan 10-Oct-12 8:34am    
I'm not an expert in P/Invoke, but I think the DLL must use plain C-style functions only. This article has some further information.
In vc++ windows form creation is little difficult one..better you can create DLL in Vc++ using COM ATL/MFC..then you can create windows form easily using c# and by link your DLL ,you can call the function dynamically...try to do this way to makes it easy...
 
Share this answer
 
Comments
amit _pathak_aadi 10-Oct-12 0:55am    
As i know ,c# .net is managed and vc++ some time create managed and some time create unmanaged code. could you tell me what project type i should choose from vc++ template, for making dll that will easily call by C#?
also could you tell me some link to get some reference?
<pre lang="css">Making Dll is very easier one..
create like this:
step 1: vc++ project ---&gt;ATL ptoject
step 2: application setting will be appear in that select server type as Dynamic

linking libraray(DLL) .then click finish button ...dont select attributed option if you

have in that.
step 3:In class view --&gt;right click --&gt;add class .
step 4:Iin add class choose ATL simple object and double click that
ATL simple object wizard will appear .In that type any name as your wishes
and in options select connection points.then click finish button

step5:In class view click to expand it ..Now can see an interface icon will be like

small circle and some extention.In that right click --&gt;add method

step6:add method--&gt; select parameter,type parameter name
and you can type your code inside that method.and bulid it now you can add DLL .The dll name will be create in the same name as vc++ projcet name given by youself..

For more details:visit
http://msdn.microsoft.com/en-us/library/jj154138.aspx

i hope it very useful for you..</pre>
<b><pre lang="text"></pre></b>
 
Share this answer
 

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