Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 5th, 2012  |  syntax: None  |  size: 1.03 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Embedding Third-Party .DLL's As Resources: (for example X360.dll)
  2.  
  3. 1. Add a reference for X360.dll as you normally would.
  4. 2. Finish developing of your application.
  5. 3. Set the reference's value of "Copy to Local" to "False".
  6. 4. Go to the "Resources" page of "My Project" and select "Files", then "Add Existing File" and add X360.dll.
  7. 5. On the bottom right property box, set the name to X360.
  8. 6. Have your application's startup form load event look like this:
  9.  
  10.     Private Sub MainFormLoad() Handles Me.Load
  11.         AddHandler AppDomain.CurrentDomain.AssemblyResolve, AddressOf AssemblyResolveFunction
  12.     End Sub
  13.  
  14. 5. Make an AssemblyResolveFunction function similar to this:
  15.  
  16.     Private Shared Function AssemblyResolveFunction(ByVal sender As Object, ByVal args As ResolveEventArgs) As Assembly
  17.         Dim AssemblyName As String() = args.Name.Split(",")
  18.         If AssemblyName(0) = "X360" Then
  19.             AssemblyName = Nothing
  20.             Return Assembly.Load(X360)
  21.         End If
  22.     End Function
  23.  
  24. 6. Compile and Enjoy! :)