利用GetIfTable ,GetIfEntry 实时判断网线插拔状态

  • Post author:
  • Post category:其他


// testlinkDlg.h : header file

//

#if !defined(AFX_TESTLINKDLG_H__C0EDCF96_BB21_4A9D_B508_23DD96954F30__INCLUDED_)

#define AFX_TESTLINKDLG_H__C0EDCF96_BB21_4A9D_B508_23DD96954F30__INCLUDED_

#if _MSC_VER > 1000

#pragma once

#endif // _MSC_VER > 1000

/

// CTestlinkDlg dialog

#include “Iphlpapi.h”

#pragma comment(lib,”Iphlpapi”)

class CTestlinkDlg : public CDialog

{


// Construction

public:

CTestlinkDlg(CWnd* pParent = NULL); // standard constructor

// Dialog Data

//{

{AFX_DATA(CTestlinkDlg)

enum { IDD = IDD_TESTLINK_DIALOG };

CListBox m_List;

//}}AFX_DATA

// ClassWizard generated virtual function overrides

//{

{AFX_VIRTUAL(CTestlinkDlg)

protected:

virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support

//}}AFX_VIRTUAL

// Implementation

protected:

HICON m_hIcon;

// Generated message map functions

//{

{AFX_MSG(CTestlinkDlg)

virtual BOOL OnInitDialog();

afx_msg void OnSysCommand(UINT nID, LPARAM lParam);

afx_msg void OnPaint();

afx_msg HCURSOR OnQueryDragIcon();

virtual void OnOK();

afx_msg void OnTimer(UINT nIDEvent);

afx_msg void OnButton1();

afx_msg void OnBtnStop();

//}}AFX_MSG

DECLARE_MESSAGE_MAP()

public:

void UpdateUI();

PMIB_IFROW m_pIfRow;

PMIB_IFTABLE m_pIfTable;

BOOL GetIfData();

void tt();

int m_nNetCnt;

CString strNetWorkName;

DWORD m_dwIndex;

};

//{

{AFX_INSERT_LOCATION}}

// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_TESTLINKDLG_H__C0EDCF96_BB21_4A9D_B508_23DD96954F30__INCLUDED_)

// testlinkDlg.cpp : implementation file

//

#include “stdafx.h”

#include “testlink.h”

#include “testlinkDlg.h”

#ifdef _DEBUG

#define new DEBUG_NEW

#undef THIS_FILE

static char THIS_FILE[] = __FILE__;

#endif

#define ALLOCATE_FROM_PROCESS_HEAP( bytes )  ::HeapAlloc( ::GetProcessHeap(), HEAP_ZERO_MEMORY, bytes )

#define DEALLOCATE_FROM_PROCESS_HEAP( ptr )  if( ptr ) ::HeapFree( ::GetProcessHeap(), 0, ptr )

#define REALLOC_FROM_PROCESS_HEAP( ptr, bytes ) ::HeapReAlloc( ::GetProcessHeap(), HEAP_ZERO_MEMORY, ptr, bytes )


/

// CAboutDlg dialog used for App About

#define MALLOC(x) HeapAlloc(GetProcessHeap(), 0, (x))

#define FREE(x) HeapFree(GetProcessHeap(), 0, (x))

class CAboutDlg : public CDialog

{


public:

CAboutDlg();

// Dialog Data

//{

{AFX_DATA(CAboutDlg)

e



版权声明:本文为guoquan2003原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。