نمایش نتایج 1 تا 11 از 11

نام تاپیک: شرط گزاری مربوط به اینترنت

  1. #1
    منتظر تایید آدرس ایمیل
    تاریخ عضویت
    مهر 1387
    پست
    59

    شرط گزاری مربوط به اینترنت

    سلام
    شرطی میخوام که:
    اگر سیستم به اینترنت وصل بود . یک دکمه فعال بشه.(enable=true(
    اینو واسه قسمتی از برنامم که برای ارسال نظره لازم دارم

  2. #2

    نقل قول: شرط گزاری مربوط به اینترنت

    سلام دوست عزیز
    قبل از هر چیز باید بدونید درست مطرح کردن سوال به پیدا کردن جواب کمک می کنه.
    دوم اینکه جستجو کنید
    مثلا اگه تو همین سایت عبارت اتصال به اینترنت رو جستجو می کردید به جواب می رسیدید.
    به هرحال یک کم خودتون هم زحمت بکشید
    اینم کد مورد نظر

    Const NETWORK_ALIVE_AOL = &H4
    Const NETWORK_ALIVE_LAN = &H1
    Const NETWORK_ALIVE_WAN = &H2
    Private Declare Function IsNetworkAlive Lib "SENSAPI.DLL" (ByRef lpdwFlags As Long) As Long

    Private Sub Form_Load()
    Dim CRes As Long
    If IsNetworkAlive(CResult) = 0 Then
    MsgBox " Not Connected to a Network!"
    Else
    MsgBox "Connected to a" & IIf(CRes = NETWORK_ALIVE_AOL, "AOL", IIf(CRes = NETWORK_ALIVE_LAN, "LAN", "WAN")) & "Network"
    End If
    End Sub


  3. #3
    منتظر تایید آدرس ایمیل
    تاریخ عضویت
    مهر 1387
    پست
    59

    نقل قول: شرط گزاری مربوط به اینترنت

    این کد شامل همه نوع اینترنت میشه؟ اگه برنامه تو محیطی که شبکه هست(ولی اینترنت نیست) باشه چطور؟

  4. #4
    کاربر دائمی آواتار crazyfull
    تاریخ عضویت
    بهمن 1385
    محل زندگی
    127.0.0.1
    پست
    104

    نقل قول: شرط گزاری مربوط به اینترنت

    Option Explicit
    Public Declare Function InternetGetConnectedState Lib "wininet.dll" (ByRef lpdwFlags As Long, ByVal dwReserved As Long) As Long
    'Internet connection VIA Proxy server.
    Public Const ProxyConnection As Long = &H4
    'Modem is busy.
    Public Const ModemConnectionIsBusy As Long = &H8
    'Internet connection is currently Offline
    Public Const InternetIsOffline As Long = &H20
    'Internet connection is currently configured
    Public Const InternetConnectionIsConfigured As Long = &H40
    'Internet connection VIA Modem.
    Public Const ModemConnection As Long = &H1
    'Remote Access Server is installed.
    Public Const RasInstalled As Long = &H10
    'Internet connection VIA LAN.
    Public Const LanConnection As Long = &H2

    Public Function IsLanConnection() As Boolean
    Dim dwflags As Long
    'return True if LAN connection
    Call InternetGetConnectedState(dwflags, 0&)
    IsLanConnection = dwflags And LanConnection
    End Function


    Public Function IsModemConnection() As Boolean
    Dim dwflags As Long
    'return True if modem connection.
    Call InternetGetConnectedState(dwflags, 0&)
    IsModemConnection = dwflags And ModemConnection
    End Function


    Public Function IsProxyConnection() As Boolean
    Dim dwflags As Long
    'return True if connected through a proxy.
    Call InternetGetConnectedState(dwflags, 0&)
    IsProxyConnection = dwflags And ProxyConnection
    End Function

    Public Function IsConnected() As Boolean
    'Returns true if there is any internet connection.
    IsConnected = InternetGetConnectedState(0&, 0&)

    End Function

    Public Function IsRasInstalled() As Boolean
    Dim dwflags As Long
    'return True if RAS installed.
    Call InternetGetConnectedState(dwflags, 0&)
    IsRasInstalled = dwflags And RasInstalled
    End Function


    Public Function ConnectionTypeMsg() As String
    Dim dwflags As Long
    Dim msg As String
    'Return Internet connection msg.

    If InternetGetConnectedState(dwflags, 0&) Then

    If dwflags And InternetConnectionIsConfigured Then
    msg = msg & "Internet connection is configured." & vbCrLf
    End If

    If dwflags And LanConnection Then
    msg = msg & "Internet connection via a LAN"
    End If

    If dwflags And ProxyConnection Then
    msg = msg & ", and connection is through a proxy server."
    Else
    msg = msg & "."
    End If

    If dwflags And ModemConnection Then
    msg = msg & "Internet connection via a Modem"
    End If

    If dwflags And InternetIsOffline Then
    msg = msg & "Internet connection is currently offline."
    End If

    If dwflags And ModemConnectionIsBusy Then
    msg = msg & "Modem is busy with a non-Internet connection."
    End If

    If dwflags And RasInstalled Then
    msg = msg & "Remote Access Services are installed on local system."
    End If

    Else
    msg = "You are currently not connected to the internet."

    End If

    ConnectionTypeMsg = msg

    End Function


  5. #5
    منتظر تایید آدرس ایمیل
    تاریخ عضویت
    مهر 1387
    پست
    59

    نقل قول: شرط گزاری مربوط به اینترنت

    نقل قول نوشته شده توسط crazyfull مشاهده تاپیک
    Option Explicit
    Public Declare Function InternetGetConnectedState Lib "wininet.dll" (ByRef lpdwFlags As Long, ByVal dwReserved As Long) As Long
    'Internet connection VIA Proxy server.
    Public Const ProxyConnection As Long = &H4
    'Modem is busy.
    Public Const ModemConnectionIsBusy As Long = &H8
    'Internet connection is currently Offline
    Public Const InternetIsOffline As Long = &H20
    'Internet connection is currently configured
    Public Const InternetConnectionIsConfigured As Long = &H40
    'Internet connection VIA Modem.
    Public Const ModemConnection As Long = &H1
    'Remote Access Server is installed.
    Public Const RasInstalled As Long = &H10
    'Internet connection VIA LAN.
    Public Const LanConnection As Long = &H2

    Public Function IsLanConnection() As Boolean
    Dim dwflags As Long
    'return True if LAN connection
    Call InternetGetConnectedState(dwflags, 0&)
    IsLanConnection = dwflags And LanConnection
    End Function


    Public Function IsModemConnection() As Boolean
    Dim dwflags As Long
    'return True if modem connection.
    Call InternetGetConnectedState(dwflags, 0&)
    IsModemConnection = dwflags And ModemConnection
    End Function


    Public Function IsProxyConnection() As Boolean
    Dim dwflags As Long
    'return True if connected through a proxy.
    Call InternetGetConnectedState(dwflags, 0&)
    IsProxyConnection = dwflags And ProxyConnection
    End Function

    Public Function IsConnected() As Boolean
    'Returns true if there is any internet connection.
    IsConnected = InternetGetConnectedState(0&, 0&)

    End Function

    Public Function IsRasInstalled() As Boolean
    Dim dwflags As Long
    'return True if RAS installed.
    Call InternetGetConnectedState(dwflags, 0&)
    IsRasInstalled = dwflags And RasInstalled
    End Function


    Public Function ConnectionTypeMsg() As String
    Dim dwflags As Long
    Dim msg As String
    'Return Internet connection msg.

    If InternetGetConnectedState(dwflags, 0&) Then

    If dwflags And InternetConnectionIsConfigured Then
    msg = msg & "Internet connection is configured." & vbCrLf
    End If

    If dwflags And LanConnection Then
    msg = msg & "Internet connection via a LAN"
    End If

    If dwflags And ProxyConnection Then
    msg = msg & ", and connection is through a proxy server."
    Else
    msg = msg & "."
    End If

    If dwflags And ModemConnection Then
    msg = msg & "Internet connection via a Modem"
    End If

    If dwflags And InternetIsOffline Then
    msg = msg & "Internet connection is currently offline."
    End If

    If dwflags And ModemConnectionIsBusy Then
    msg = msg & "Modem is busy with a non-Internet connection."
    End If

    If dwflags And RasInstalled Then
    msg = msg & "Remote Access Services are installed on local system."
    End If

    Else
    msg = "You are currently not connected to the internet."

    End If

    ConnectionTypeMsg = msg

    End Function



    لطفا بگید کدم کد برای کجاست

  6. #6

    نقل قول: شرط گزاری مربوط به اینترنت

    فکر نمی کنم چیز مبهمی باشه مگر اینکه زبان انگلیسیتون خوب نباشه آخه تقریبا همش اصطلاحات رایج کامپیوتره.به هر حال یه توضیح مختصر میدم
     

    "Internet connection is configured."
    شما رو از پیکر بندی شدن اتصال اینترنت مطلع میکنه
    "Internet connection via a LAN"
    میگه شما از طریق کارت شبکه وصلی
    connection is through a proxy server
    میگه شما پشت یه پروکسی ( معمولا سرور شبکه لن) مخفی هستی
    Internet connection via a Modem
    از مودم دیال آپ استفاده می کنی
    "Internet connection is currently offline."
    تو شبکه هستی ولی اتصال اینترنتی نداری
    "Modem is busy with a non-Internet connection."
    میگه مودم با یه اتصال غیر اینترنتی درگیره
    "Remote Access Services are installed on local system."
    سرویس دسترسی راه دور نصبه
    "You are currently not connected to the internet."
    شما آفلاینی

  7. #7

    نقل قول: شرط گزاری مربوط به اینترنت

    نقل قول نوشته شده توسط albalooband مشاهده تاپیک
    این کد شامل همه نوع اینترنت میشه؟ اگه برنامه تو محیطی که شبکه هست(ولی اینترنت نیست) باشه چطور؟
    ممکنه بعضی کد ها تو بعضی توپولوژی های شبکه کارکرد صحیحی نداشته باشه.این جور وقتا میشه از روش های دیگه واسه صحت اتصال اینترنتی استفاده کرد.مثلا پینگ کردن یه سایت که معمولا آپ تایم بالا و سرعت پاسخ سریعی داشته باشه مثل GOOGLE
    به این میگن کلک رشتی .خودمونیم ها رشتی بودنم یه جاهایی بدرد میخوره
    فایل های ضمیمه فایل های ضمیمه

  8. #8
    منتظر تایید آدرس ایمیل
    تاریخ عضویت
    مهر 1387
    پست
    59

    نقل قول: شرط گزاری مربوط به اینترنت

    نقل قول نوشته شده توسط babak125 مشاهده تاپیک
    ممکنه بعضی کد ها تو بعضی توپولوژی های شبکه کارکرد صحیحی نداشته باشه.این جور وقتا میشه از روش های دیگه واسه صحت اتصال اینترنتی استفاده کرد.مثلا پینگ کردن یه سایت که معمولا آپ تایم بالا و سرعت پاسخ سریعی داشته باشه مثل GOOGLE
    به این میگن کلک رشتی .خودمونیم ها رشتی بودنم یه جاهایی بدرد میخوره
    ممنون از کدتون. منم یه چیزی تو همین مایه ها میخوام
    ولی ساده تر(تا بنونم درکش کنم)
    مثلا یک سایتی رو چکی چیزی کنه.اگه جواب + بود اجازه دسترسی به بعضی قسمت های برنامه رو بده.
    راستی کد بالا هم ارور داد.

    منم بچه گیلانم

  9. #9

    نقل قول: شرط گزاری مربوط به اینترنت

    نقل قول نوشته شده توسط albalooband مشاهده تاپیک
    راستی کد بالا هم ارور داد.
    میشه بگید ارورش چی بود؟چون قبل از آپلود تست کردم مشکلی نداشت



    نقل قول نوشته شده توسط albalooband مشاهده تاپیک
    منم بچه گیلانم
    تی جانه ره بیمیرم ، خوشحاله بوستم
    عکس های ضمیمه عکس های ضمیمه
    آخرین ویرایش به وسیله Babak.Hassanpour : پنج شنبه 20 فروردین 1388 در 10:51 صبح

  10. #10
    منتظر تایید آدرس ایمیل
    تاریخ عضویت
    مهر 1387
    پست
    59

    نقل قول: شرط گزاری مربوط به اینترنت

    الان من از این چطور تو برنامم استفاهده کنم؟
    میخوام اگه اینترنت وصل باشه 2 تا دکمه enable=true بشه
    کدو کد رو کجا باید بزارم

  11. #11

    نقل قول: شرط گزاری مربوط به اینترنت

    نقل قول نوشته شده توسط albalooband مشاهده تاپیک
    الان من از این چطور تو برنامم استفاهده کنم؟
    میخوام اگه اینترنت وصل باشه 2 تا دکمه enable=true بشه
    کدو کد رو کجا باید بزارم
    اینجا ها


    "Internet connection via a LAN"
    میگه شما از طریق کارت شبکه وصلی
    connection is through a proxy server
    میگه شما پشت یه پروکسی ( معمولا سرور شبکه لن) مخفی هستی
    Internet connection via a Modem
    از مودم دیال آپ استفاده می کنی


قوانین ایجاد تاپیک در تالار

  • شما نمی توانید تاپیک جدید ایجاد کنید
  • شما نمی توانید به تاپیک ها پاسخ دهید
  • شما نمی توانید ضمیمه ارسال کنید
  • شما نمی توانید پاسخ هایتان را ویرایش کنید
  •