Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. need to convert some VB variable into C#

need to convert some VB variable into C#

Scheduled Pinned Locked Moved C#
csharpcomhelp
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    M Riaz Bashir
    wrote on last edited by
    #1

    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

    N 1 Reply Last reply
    0
    • M M Riaz Bashir

      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

      N Offline
      N Offline
      Nidhi s
      wrote on last edited by
      #2

      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();

      M D 2 Replies Last reply
      0
      • N Nidhi s

        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();

        M Offline
        M Offline
        M Riaz Bashir
        wrote on last edited by
        #3

        Thank you sir,

        1 Reply Last reply
        0
        • N Nidhi s

          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();

          D Offline
          D Offline
          Dave Doknjas
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups