Предмет:
Тип роботи:
Курсова робота
К-сть сторінок:
44
Мова:
Українська
(NMHDR*)lParam, &tvItem);
if (tvItem.pszText)
{
char szData[LINE_LEN] = {0};
memcpy(szData, tvItem.pszText, strlen(tvItem.pszText));
ListViewRemoveAllItems(GetDlgItem(_hDlg, IDC_LIST1));
ListViewRemoveAllItems(GetDlgItem(_hDlg, IDC_LIST2));
SetCharSet(IDC_LIST1, IDC_LIST2);
FindDeviceName(szData, IDC_LIST1, IDC_LIST2);
};
};
};
break;
};
};
break;
};
return 0;
};
int APIENTRY WinMain(HINSTANCE hInst, HINSTANCE hPrevInst,
LPSTR lpCmdLine, int nShowCmd)
{
InitCommonControls();
_hInst = hInst;
if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_DIALOG1),
0L, MainDialog, 0L) == -1)
ShowErrorMsg(0L, GetLastError(), "DialogBoxParam");
ExitProcess(0);
return 0;
};
ДОДАТОК Б
ЛІСТИНГ ПРОГРАМИ GetTypeInfo.cpp
#include "gettypeinfo.h"
extern HWND _hDlg;
void ShowDevPropertyInfo(HWND hListView, char *szItemName,
char *szValue)
{
short wCount = ListViewGetItemCount(hListView);
char szTmp[64] = {0};
LVITEM lvItem = {0};
lvItem.iSubItem = 1;
lvItem.pszText = szTmp;
lvItem.cchTextMax = 63;
SendMessage(hListView, LVM_GETITEMTEXT, wCount-1, (LPARAM)&lvItem);
if (!*szTmp)
{
if (szItemName && szValue)
{
ListViewInsertItemText(hListView, wCount, 0, szItemName);
ListViewInsertItemText(hListView, wCount, 1, szValue);
}
else if (szItemName && !szValue)
ListViewInsertItemText(hListView, wCount, 0, szItemName);
else if (!szItemName && szValue)
ListViewInsertItemText(hListView, wCount-1, 1, szValue);
}
else
{
if (szItemName)
ListViewInsertItemText(hListView, wCount, 0, szItemName);
else
ListViewInsertItemText(hListView, wCount, 0, "");
if (szValue)
ListViewInsertItemText(hListView, wCount, 1, szValue);
};
};
void GetMoreInformation(HDEVINFO hDevInfo, SP_DEVINFO_DATA spDevInfoData,
const UINT nIDList1)
{
HWND hListView = GetDlgItem(_hDlg, nIDList1);
GUID guid = {0};
short wCount = ListViewGetItemCount(hListView);
char bIsBIG5 = (GetACP() == 950) ? 1 : 0;
char szName[64] = {0};
DWORD dwAddr;
if (SetupDiGetDeviceRegistryProperty(hDevInfo,&spDevInfoData,SPDRP_BUSNUMBER,0L,
(PBYTE)&dwAddr, //szName,63,0))
{
sprintf(szName, "%X", dwAddr);
wCount = ListViewGetItemCount(hListView);
ListViewInsertItemText(hListView, wCount, 0, "BUS номер");
ListViewInsertItemText(hListView, wCount, 1, szName);
};
if (SetupDiGetDeviceRegistryProperty(hDevInfo,
&spDevInfoData,
SPDRP_CAPABILITIES,
0L,(PBYTE)&dwAddr,63,0))
{
if (dwAddr)
{
ShowDevPropertyInfo(hListView, "Можливості",