Creator Posted September 4, 2003 Posted September 4, 2003 *** Urgent ***** Hi all, I have lot of trouble trying to convert to .net...Below I have a declaration of an API, my problem is .net does not take the argument of ByRef lparam as Any this argument is a pointer to a structure...... Can someone help me out ........ ----------CODE---------------------- Private Declare Function SendMessageAsAny Lib "user32" Alias "SendMessageA" _ (ByVal hWnd As Long, _ ByVal wMsg As Long, _ ByVal wParam As Long, _ ByRef lParam As Any) As Long Function capGetVideoFormat(ByVal hCapWnd As Long, ByRef BmpFormat As BITMAPINFO, ByVal CapFormatSize As Long) As Long capGetVideoFormat = SendMessageAsAny(hCapWnd, WM_CAP_GET_VIDEOFORMAT, CapFormatSize, BmpFormat) End Function Quote
*Experts* Volte Posted September 4, 2003 *Experts* Posted September 4, 2003 Since you can have overloads in .NET, it's best to have multiple overloads. For example, declare the API multiple times, using different types for the last parameter. Quote
Creator Posted September 4, 2003 Author Posted September 4, 2003 Not quite sure what u meant.........I still learning vb Quote
Creator Posted September 4, 2003 Author Posted September 4, 2003 I sort of understand what it meant now....well that what I have been doing....declare it as different type but my problem is that in vb6 I need to transfer this declaration of type ANY (ie Myfunction(byref Var as any)), which not does work in vb .net..... Is there any way to convert it in .net. pls someone help Quote
*Gurus* divil Posted September 4, 2003 *Gurus* Posted September 4, 2003 Assuming the parameter is going to be a structure, you can just declare it as the structure, the framework will take care of the marshalling for you. You'll need to change the Longs to Integers or IntPtrs too. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Recommended Posts