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 / C++ / MFC
  4. Remove LAN-Adapter

Remove LAN-Adapter

Scheduled Pinned Locked Moved C / C++ / MFC
question
5 Posts 2 Posters 1 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.
  • C Offline
    C Offline
    chrisigo
    wrote on last edited by
    #1

    Hello ! Can anyone tell me how my software can recognize that the LAN-Adapter has been removed from the computer ? Thank you, Chris

    M 1 Reply Last reply
    0
    • C chrisigo

      Hello ! Can anyone tell me how my software can recognize that the LAN-Adapter has been removed from the computer ? Thank you, Chris

      M Offline
      M Offline
      munawar1968
      wrote on last edited by
      #2

      See http://www.codeproject.com/internet/getmac.asp?df=100&forumid=2459&exp=0&select=47194#xx47194xx maybe it'll help.. Keep a list of mac addresses in memory and periodically check if the list is up to date

      C 1 Reply Last reply
      0
      • M munawar1968

        See http://www.codeproject.com/internet/getmac.asp?df=100&forumid=2459&exp=0&select=47194#xx47194xx maybe it'll help.. Keep a list of mac addresses in memory and periodically check if the list is up to date

        C Offline
        C Offline
        chrisigo
        wrote on last edited by
        #3

        I don' t know if the problem was clear. I don't want to remove the ethernet-card. I will remove the cable from the Adapter. In this case windows shows a tip text message in the right bottom corner. I thought that I can caught this windows message.

        M 1 Reply Last reply
        0
        • C chrisigo

          I don' t know if the problem was clear. I don't want to remove the ethernet-card. I will remove the cable from the Adapter. In this case windows shows a tip text message in the right bottom corner. I thought that I can caught this windows message.

          M Offline
          M Offline
          munawar1968
          wrote on last edited by
          #4

          Check this /* * ndis_events - test program for receiving NdisMIndicateStatus() * events * Copyright (c) 2004, Jouni Malinen * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * * Alternatively, this software may be distributed under the terms * of BSD license. * * See README and COPYING for more details. */ #define _WIN32_WINNT 0x0400 #include #include #include #include class CNdisSink; struct EVENT_HANDLER_MAP { const wchar_t* EventName; void (CNdisSink::*Handler)(IWbemClassObject *pObj); }; class CNdisSink : public IWbemObjectSink { public: CNdisSink(); ~CNdisSink(); // IUnknown members STDMETHOD(QueryInterface)(REFIID, LPVOID *); STDMETHOD_(ULONG, AddRef)(void); STDMETHOD_(ULONG, Release)(void); // IWbemObjectSink members STDMETHOD(Indicate)( long lObjectCount, IWbemClassObject **ppObjArray); STDMETHOD(SetStatus)( long lFlags, HRESULT hResult, BSTR strParam, IWbemClassObject *pObjParam); public: int RegisterAsyncNotification(IWbemServices *pSvc); private: void AdapterArrival(IWbemClassObject *pObj){} void AdapterRemoval(IWbemClassObject *pObj){} void ResetStart(IWbemClassObject *pObj){} void ResetEnd(IWbemClassObject *pObj){} void LinkSpeedChange(IWbemClassObject *pObj){} void MediaConnect(IWbemClassObject *pObj); void MediaDisconnect(IWbemClassObject *pObj); void MediaSpecific(IWbemClassObject *pObj); void ProtocolBind(IWbemClassObject *pObj){} void ProtocolUnbind(IWbemClassObject *pObj){} void DevicePowerOn(IWbemClassObject *pObj){} void DevicePowerOff(IWbemClassObject *pObj){} private: static EVENT_HANDLER_MAP s_EventHandlerMap[]; UINT m_cRef; }; EVENT_HANDLER_MAP CNdisSink::s_EventHandlerMap[] = { { L"MSNdis_NotifyAdapterArrival", &CNdisSink::AdapterArrival }, { L"MSNdis_NotifyAdapterRemoval", &CNdisSink::AdapterRemoval }, { L"MSNdis_StatusResetStart", &CNdisSink::ResetStart }, { L"MSNdis_StatusResetEnd", &CNdisSink::ResetEnd }, { L"MSNdis_StatusLinkSpeedChange", &CNdisSink::LinkSpeedChange }, { L"MSNdis_StatusMediaConnect", &CNdisSink::MediaConnect }, { L"MSNdis_StatusMediaDiscon

          C 1 Reply Last reply
          0
          • M munawar1968

            Check this /* * ndis_events - test program for receiving NdisMIndicateStatus() * events * Copyright (c) 2004, Jouni Malinen * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * * Alternatively, this software may be distributed under the terms * of BSD license. * * See README and COPYING for more details. */ #define _WIN32_WINNT 0x0400 #include #include #include #include class CNdisSink; struct EVENT_HANDLER_MAP { const wchar_t* EventName; void (CNdisSink::*Handler)(IWbemClassObject *pObj); }; class CNdisSink : public IWbemObjectSink { public: CNdisSink(); ~CNdisSink(); // IUnknown members STDMETHOD(QueryInterface)(REFIID, LPVOID *); STDMETHOD_(ULONG, AddRef)(void); STDMETHOD_(ULONG, Release)(void); // IWbemObjectSink members STDMETHOD(Indicate)( long lObjectCount, IWbemClassObject **ppObjArray); STDMETHOD(SetStatus)( long lFlags, HRESULT hResult, BSTR strParam, IWbemClassObject *pObjParam); public: int RegisterAsyncNotification(IWbemServices *pSvc); private: void AdapterArrival(IWbemClassObject *pObj){} void AdapterRemoval(IWbemClassObject *pObj){} void ResetStart(IWbemClassObject *pObj){} void ResetEnd(IWbemClassObject *pObj){} void LinkSpeedChange(IWbemClassObject *pObj){} void MediaConnect(IWbemClassObject *pObj); void MediaDisconnect(IWbemClassObject *pObj); void MediaSpecific(IWbemClassObject *pObj); void ProtocolBind(IWbemClassObject *pObj){} void ProtocolUnbind(IWbemClassObject *pObj){} void DevicePowerOn(IWbemClassObject *pObj){} void DevicePowerOff(IWbemClassObject *pObj){} private: static EVENT_HANDLER_MAP s_EventHandlerMap[]; UINT m_cRef; }; EVENT_HANDLER_MAP CNdisSink::s_EventHandlerMap[] = { { L"MSNdis_NotifyAdapterArrival", &CNdisSink::AdapterArrival }, { L"MSNdis_NotifyAdapterRemoval", &CNdisSink::AdapterRemoval }, { L"MSNdis_StatusResetStart", &CNdisSink::ResetStart }, { L"MSNdis_StatusResetEnd", &CNdisSink::ResetEnd }, { L"MSNdis_StatusLinkSpeedChange", &CNdisSink::LinkSpeedChange }, { L"MSNdis_StatusMediaConnect", &CNdisSink::MediaConnect }, { L"MSNdis_StatusMediaDiscon

            C Offline
            C Offline
            chrisigo
            wrote on last edited by
            #5

            Thank you, I will try it.

            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