Click here to Skip to main content
15,885,767 members
Please Sign up or sign in to vote.
1.40/5 (2 votes)
See more:
Hello,

I want to create a DLL file which will contain some business logic for our software.
But what i want is that other people should not be able to use that DLL. ie, other people should not be able to either reference the DLL in their application OR should not be able to view the functions present in the DLL.

I have also created a DLL for Testing this. Below is the code :
VB
Public Class ABC
  Private Function ShowMessage(ByVal Str as String) as String
     Msgbox(Str)
  End Function
End Class

I compiled the code and created the DLL File. Then I Created a Windows Application With a Form.
Form Code :
VB
Public Class Form1
   Declare Function ShowMessage Lib <dllname> Alias "ShowMessage" (ByVal Str as String) as String

   Private Sub Button1_Click()
      ShowMessage("Testing DLL")
   End Sub
End Class</dllname>

When I execute the above code, it shows an error on button Click.
"Entrypoint for ShowMessage Not found in DLL"

Can anyone please help me in this.
Any help would be greatly appreciated.

Thanks in advance. Awaiting a reply soon.
Posted
Updated 28-Mar-17 21:06pm
v2
Comments
Sandeep Mewara 16-Jul-10 13:20pm    
Use PRE tags to format your code part. It makes the question readable.

There are 2 basic methods to achieve this;

1) Friend Assemblies;
http://msdn.microsoft.com/en-us/library/0tke9fxk.aspx[^]

2) on top of this, you can then use obfuscation to deter the casual code thief

other than this, i don't know!
 
Share this answer
 
Comments
Nish Nishant 18-Jul-10 8:49am    
Reason for my vote of 5
Good answer. Worth 5.

Eddy's answer below is misleading though, and does not answer the OP's question correctly.
Pawan RLD 4-Feb-14 2:47am    
how to open a new form using dll?plz help me as soon as possible..........
DaveAuld 4-Feb-14 2:49am    
Reference the DLL in the normal way, then call a method in the DLL that has all the dealing to do with the form.
Add a reference to System.Windows.Forms, it contains the MessageBox method that you're calling. It can't call it if it's not referenced.
 
Share this answer
 
Comments
Israr Zaib 14-Mar-13 1:36am    
hi lots of thanks
Pawan RLD 4-Feb-14 2:49am    
how to open a new windows form using class library? plz help me .........
Public Class Form1
dim showmsg as abc.abc

Private Sub Button1_Click()
showmsg.ShowMessage("Testing DLL")
End Sub
end class


add reference your DLL, that you created bedfore, and try above code in your form.
 
Share this answer
 
Comments
[no name] 4-Jul-13 9:19am    
Do you really think that after 3 years, he has not been able to figure it out? Especially when he is clearly not interested in an 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