The Net Age

Wednesday, December 29, 2004

Accessing a DLL with VB dot NET

Start off here[1]

Getting Functions from DLLs[2] found at[F1](corrected) (use Visual Studios Command Prompt found in tools folder or the files can be found in the VC7/bin folder):
dumpbin /exports user32.dll or link /dump /exports user32.dll


Inherits System.Windows.Forms.Form 'Add to start
Win32.MessageBox(0, "Hello World", "Platform Invoke Sample", 0) 'Add in between button code

'Add at the end under the "End Class"
Public Class Win32
Declare Auto Function MessageBox Lib "user32.dll" _
(ByVal hWnd As Integer, ByVal txt As String, _
ByVal caption As String, ByVal Typ As Integer) As Integer
End Class
___________________________________
Links:

[1] - http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconconsumingunmanageddllfunctions.asp
[2] - http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconidentifyingfunctionsindlls.asp

[F1] - C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin

Thursday, December 02, 2004

More on WMI

WBEMTEST.exe (try start -> run)

connect to root\cimv2
enum classes
CIM_Setting
Derived
Win32_PageFileSetting
Instances

____________
Disclaimer: Try out on own risk!