[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 356
  • Last Modified:

convert this vb code to c# code (win api)

hi i want to conver this code to c# code how this could be done


Private Declare Function InetIsOffline Lib "url.dll" (ByVal dwFlags As Long) As Long
Private Sub Form_Load()
    'KPD-Team 2001
    'URL: http://www.allapi.net/
    'E-Mail: KPDTeam@Allapi.net
    'InetIsOffline returns 0 if you're connected
    MsgBox "Are you connected to the internet? " + CStr(CBool(Not (InetIsOffline(0)))), vbInformation
End Sub
0
hema3i
Asked:
hema3i
1 Solution
 
cambo1982Commented:
This is untested so any problems you can give me a comment back and i'll see what i can do.
Regards
~EoinC

VB:
Private Declare Function InetIsOffline Lib "url.dll" (ByVal dwFlags As Long) As Long

C#:
using System.Runtime.interopservices;

[DllImport("url.dll")]
private static extern UInt32 InetIsOffline(UInt32 dwFlags);

-------------------------------------------------------------------------------

VB:
Private Sub Form_Load()
    'KPD-Team 2001
    'URL: http://www.allapi.net/
    'E-Mail: KPDTeam@Allapi.net
    'InetIsOffline returns 0 if you're connected
    MsgBox "Are you connected to the internet? " + CStr(CBool(Not (InetIsOffline(0)))), vbInformation
End Sub

C#
private void Form1_Load(object sender, System.EventArgs e)
{
     MessageBox.Show("Are You Connected to the internet?" + InetIsOffline(0).ToString());
}
0
 
Bob LearnedCommented:
Check Your Internet Connection With C#
http://www.csharphelp.com/archives3/archive499.html

Bob
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now