need to convert some VB variable into C#
-
Hi, Kindly help me to convert following lines into c#: Private Declare Function GetPixel Lib "GDI32" (ByVal hDC As Long, ByVal XCord As Long, ByVal YCord As Long) As OLE_COLOR Private Declare Function GetWindowDC Lib "USER32" (ByVal hwnd As Long) As Long Private Declare Function ReleaseDC Lib "USER32" (ByVal hwnd As Long, ByVal hDC As Long) As Long Private Declare Function GetDesktopWindow Lib "USER32" () As Long Thank you
-
Hi, Kindly help me to convert following lines into c#: Private Declare Function GetPixel Lib "GDI32" (ByVal hDC As Long, ByVal XCord As Long, ByVal YCord As Long) As OLE_COLOR Private Declare Function GetWindowDC Lib "USER32" (ByVal hwnd As Long) As Long Private Declare Function ReleaseDC Lib "USER32" (ByVal hwnd As Long, ByVal hDC As Long) As Long Private Declare Function GetDesktopWindow Lib "USER32" () As Long Thank you
Hi, To convert any VB code to c# this link is very usefull: //www.developerfusion.co.uk/utilities/convertvbtocsharp.aspx well C#conversion of your VB code will be following: [System.Runtime.InteropServices.DllImport("GDI32")] private static extern OLE_COLOR GetPixel(long hDC, long XCord, long YCord); [System.Runtime.InteropServices.DllImport("USER32")] private static extern long GetWindowDC(long hwnd); [System.Runtime.InteropServices.DllImport("USER32")] private static extern long ReleaseDC(long hwnd, long hDC); [System.Runtime.InteropServices.DllImport("USER32")] private static extern long GetDesktopWindow();
-
Hi, To convert any VB code to c# this link is very usefull: //www.developerfusion.co.uk/utilities/convertvbtocsharp.aspx well C#conversion of your VB code will be following: [System.Runtime.InteropServices.DllImport("GDI32")] private static extern OLE_COLOR GetPixel(long hDC, long XCord, long YCord); [System.Runtime.InteropServices.DllImport("USER32")] private static extern long GetWindowDC(long hwnd); [System.Runtime.InteropServices.DllImport("USER32")] private static extern long ReleaseDC(long hwnd, long hDC); [System.Runtime.InteropServices.DllImport("USER32")] private static extern long GetDesktopWindow();
Thank you sir,
-
Hi, To convert any VB code to c# this link is very usefull: //www.developerfusion.co.uk/utilities/convertvbtocsharp.aspx well C#conversion of your VB code will be following: [System.Runtime.InteropServices.DllImport("GDI32")] private static extern OLE_COLOR GetPixel(long hDC, long XCord, long YCord); [System.Runtime.InteropServices.DllImport("USER32")] private static extern long GetWindowDC(long hwnd); [System.Runtime.InteropServices.DllImport("USER32")] private static extern long ReleaseDC(long hwnd, long hDC); [System.Runtime.InteropServices.DllImport("USER32")] private static extern long GetDesktopWindow();
Is the original code VB6 or VB.NET? If it's VB6, then the equivalent C# code will need the long's changed to int's since VB6 Long is the same size as C# int (or VB.NET Integer).
David Anton www.tangiblesoftwaresolutions.com Instant C#: VB to C# converter Instant VB: C# to VB converter Instant C++: C# to C++ converter, VB to C++ converter Instant Python: C# to Python converter, VB to Python converter