Link to home
Start Free TrialLog in
Avatar of hema3i
hema3i

asked on

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
Avatar of cambo1982
cambo1982

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());
}
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial