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. Convert vb code to c#

Convert vb code to c#

Scheduled Pinned Locked Moved C#
csharplinux
7 Posts 5 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.
  • T Offline
    T Offline
    tahir_makhdoom
    wrote on last edited by
    #1

    If Any one convert this vb code to c# i shall be thankfull to him. //code started from here option Explicit ' private Declare Function FindWindowEx Lib "user32" _ Alias "FindWindowExA" (byval hWnd1 as Long, byval hWnd2 as Long, _ byval lpsz1 as string, byval lpsz2 as string) as Long ' private Declare Function EnableWindow Lib "user32" (byval hwnd as Long, _ byval fEnable as Long) as Long public Sub EnableStartMenuButton(byval bEnable as Boolean) ' ' Don't forget to re-enable it ! ' Dim lHwnd as Long ' lHwnd = FindWindowEx(0&, 0&, "Shell_TrayWnd", vbNullString) lHwnd = FindWindowEx(lHwnd, 0&, "Button", vbNullString) Call EnableWindow(lHwnd, bEnable) ' End Sub //code ended

    tahir

    N P 2 Replies Last reply
    0
    • T tahir_makhdoom

      If Any one convert this vb code to c# i shall be thankfull to him. //code started from here option Explicit ' private Declare Function FindWindowEx Lib "user32" _ Alias "FindWindowExA" (byval hWnd1 as Long, byval hWnd2 as Long, _ byval lpsz1 as string, byval lpsz2 as string) as Long ' private Declare Function EnableWindow Lib "user32" (byval hwnd as Long, _ byval fEnable as Long) as Long public Sub EnableStartMenuButton(byval bEnable as Boolean) ' ' Don't forget to re-enable it ! ' Dim lHwnd as Long ' lHwnd = FindWindowEx(0&, 0&, "Shell_TrayWnd", vbNullString) lHwnd = FindWindowEx(lHwnd, 0&, "Button", vbNullString) Call EnableWindow(lHwnd, bEnable) ' End Sub //code ended

      tahir

      N Offline
      N Offline
      N a v a n e e t h
      wrote on last edited by
      #2

      tahir_makhdoom wrote:

      public Sub EnableStartMenuButton(byval bEnable as Boolean) ' ' Don't forget to re-enable it ! ' Dim lHwnd as Long ' lHwnd = FindWindowEx(0&, 0&, "Shell_TrayWnd", vbNullString) lHwnd = FindWindowEx(lHwnd, 0&, "Button", vbNullString) Call EnableWindow(lHwnd, bEnable) ' End Sub

      public void EnableStartMenuButton(bool bEnable)
      {
      //
      // Don't forget to re-enable it !
      //
      long lHwnd;
      //
      lHwnd = FindWindowEx(0l, 0l, "Shell_TrayWnd", Constants.vbNullString);
      lHwnd = FindWindowEx(lHwnd, 0l, "Button", Constants.vbNullString);
      EnableWindow(lHwnd, bEnable);
      //
      }

      Converted using http://labs.developerfusion.co.uk/convert/vb-to-csharp.aspx[^]


      My Website | Ask smart questions

      T 1 Reply Last reply
      0
      • N N a v a n e e t h

        tahir_makhdoom wrote:

        public Sub EnableStartMenuButton(byval bEnable as Boolean) ' ' Don't forget to re-enable it ! ' Dim lHwnd as Long ' lHwnd = FindWindowEx(0&, 0&, "Shell_TrayWnd", vbNullString) lHwnd = FindWindowEx(lHwnd, 0&, "Button", vbNullString) Call EnableWindow(lHwnd, bEnable) ' End Sub

        public void EnableStartMenuButton(bool bEnable)
        {
        //
        // Don't forget to re-enable it !
        //
        long lHwnd;
        //
        lHwnd = FindWindowEx(0l, 0l, "Shell_TrayWnd", Constants.vbNullString);
        lHwnd = FindWindowEx(lHwnd, 0l, "Button", Constants.vbNullString);
        EnableWindow(lHwnd, bEnable);
        //
        }

        Converted using http://labs.developerfusion.co.uk/convert/vb-to-csharp.aspx[^]


        My Website | Ask smart questions

        T Offline
        T Offline
        tahir_makhdoom
        wrote on last edited by
        #3

        Thanks i have a little problem in importing a dll public class() { [DllImport("WinLockDll.dll")] private static extern int StartButton_Show_Hide(bool bShowHide); } The error is below can you tell me what i should do Error 1 The type or namespace name 'DllImport' could not be found (are you missing a using directive or an assembly reference?) e:\NewRestrictionsc#\WindowsApplication1\WindowsApplication1\Form1.cs

        tahir

        M 1 Reply Last reply
        0
        • T tahir_makhdoom

          Thanks i have a little problem in importing a dll public class() { [DllImport("WinLockDll.dll")] private static extern int StartButton_Show_Hide(bool bShowHide); } The error is below can you tell me what i should do Error 1 The type or namespace name 'DllImport' could not be found (are you missing a using directive or an assembly reference?) e:\NewRestrictionsc#\WindowsApplication1\WindowsApplication1\Form1.cs

          tahir

          M Offline
          M Offline
          mav northwind
          wrote on last edited by
          #4

          Hi!

          tahir_makhdoom wrote:

          The error is below can you tell me what i should do

          You should read and try to understand the error message - it's all there already. You're using the DllImport attribute, but this attribute is not part of one of the namespaces you've said you'd be using, so the compiler doesn't know where DllImport comes from. You'll have to write the fully qualified class name System.Runtime.InteropServices.DllImport or insert a using System.Runtime.InteropServices; directive.

          Regards, mav -- Black holes are the places where God divided by 0...

          T 1 Reply Last reply
          0
          • M mav northwind

            Hi!

            tahir_makhdoom wrote:

            The error is below can you tell me what i should do

            You should read and try to understand the error message - it's all there already. You're using the DllImport attribute, but this attribute is not part of one of the namespaces you've said you'd be using, so the compiler doesn't know where DllImport comes from. You'll have to write the fully qualified class name System.Runtime.InteropServices.DllImport or insert a using System.Runtime.InteropServices; directive.

            Regards, mav -- Black holes are the places where God divided by 0...

            T Offline
            T Offline
            tahir_makhdoom
            wrote on last edited by
            #5

            Thankyou very much For sharing knowledge and giving good advices.May allah give you Success at every event in your life.

            tahir

            K 1 Reply Last reply
            0
            • T tahir_makhdoom

              Thankyou very much For sharing knowledge and giving good advices.May allah give you Success at every event in your life.

              tahir

              K Offline
              K Offline
              karthick n mca
              wrote on last edited by
              #6

              :->

              1 Reply Last reply
              0
              • T tahir_makhdoom

                If Any one convert this vb code to c# i shall be thankfull to him. //code started from here option Explicit ' private Declare Function FindWindowEx Lib "user32" _ Alias "FindWindowExA" (byval hWnd1 as Long, byval hWnd2 as Long, _ byval lpsz1 as string, byval lpsz2 as string) as Long ' private Declare Function EnableWindow Lib "user32" (byval hwnd as Long, _ byval fEnable as Long) as Long public Sub EnableStartMenuButton(byval bEnable as Boolean) ' ' Don't forget to re-enable it ! ' Dim lHwnd as Long ' lHwnd = FindWindowEx(0&, 0&, "Shell_TrayWnd", vbNullString) lHwnd = FindWindowEx(lHwnd, 0&, "Button", vbNullString) Call EnableWindow(lHwnd, bEnable) ' End Sub //code ended

                tahir

                P Offline
                P Offline
                Paul Conrad
                wrote on last edited by
                #7

                There are plenty of code converter tools out there. Some are good, and some are not.

                "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon

                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