Convert vb code to c#
-
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
-
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
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[^]
-
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[^]
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
-
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
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 nameSystem.Runtime.InteropServices.DllImport
or insert ausing System.Runtime.InteropServices;
directive.Regards, mav -- Black holes are the places where God divided by 0...
-
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 nameSystem.Runtime.InteropServices.DllImport
or insert ausing System.Runtime.InteropServices;
directive.Regards, mav -- Black holes are the places where God divided by 0...
Thankyou very much For sharing knowledge and giving good advices.May allah give you Success at every event in your life.
tahir
-
Thankyou very much For sharing knowledge and giving good advices.May allah give you Success at every event in your life.
tahir
:->
-
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
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