本文整理汇总了C++中ListView_InsertColumn函数的典型用法代码示例。如果您正苦于以下问题:C++ ListView_InsertColumn函数的具体用法?C++ ListView_InsertColumn怎么用?C++ ListView_InsertColumn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ListView_InsertColumn函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DlgProcMirOTROptsContacts
static INT_PTR CALLBACK DlgProcMirOTROptsContacts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
HWND lv = GetDlgItem(hwndDlg, IDC_LV_CONT_CONTACTS);
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
{
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) new ContactPolicyMap());
HWND cmb = GetDlgItem(hwndDlg, IDC_CMB_CONT_POLICY);
SendMessage(cmb, CB_ADDSTRING, 0, (WPARAM)TranslateT(LANG_POLICY_DEFAULT));
SendMessage(cmb, CB_ADDSTRING, 0, (WPARAM)TranslateT(LANG_POLICY_ALWAYS));
SendMessage(cmb, CB_ADDSTRING, 0, (WPARAM)TranslateT(LANG_POLICY_OPP));
SendMessage(cmb, CB_ADDSTRING, 0, (WPARAM)TranslateT(LANG_POLICY_MANUAL));
SendMessage(cmb, CB_ADDSTRING, 0, (WPARAM)TranslateT(LANG_POLICY_NEVER));
EnableWindow(GetDlgItem(hwndDlg, IDC_CMB_CONT_POLICY), FALSE);
SendDlgItemMessage(hwndDlg, IDC_LV_CONT_CONTACTS, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT);// | LVS_EX_CHECKBOXES);
// add list columns
LVCOLUMN lvc;
// Initialize the LVCOLUMN structure.
// The mask specifies that the format, width, text, and
// subitem members of the structure are valid.
lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
lvc.fmt = LVCFMT_LEFT;
lvc.iSubItem = 0;
lvc.pszText = TranslateT(LANG_CONTACT);
lvc.cx = 150; // width of column in pixels
ListView_InsertColumn(lv, 0, &lvc);
lvc.iSubItem = 1;
lvc.pszText = TranslateT(LANG_PROTO);
lvc.cx = 100; // width of column in pixels
ListView_InsertColumn(lv, 1, &lvc);
lvc.iSubItem = 2;
lvc.pszText = TranslateT(LANG_POLICY);
lvc.cx = 90; // width of column in pixels
ListView_InsertColumn(lv, 2, &lvc);
lvc.iSubItem = 3;
lvc.pszText = TranslateT(LANG_HTMLCONV);
lvc.cx = 80; // width of column in pixels
ListView_InsertColumn(lv, 3, &lvc);
}
SendMessage(hwndDlg, WMU_REFRESHLIST, 0, 0);
return TRUE;
case WMU_REFRESHLIST:
ListView_DeleteAllItems(lv);
{
LVITEM lvI = { 0 };
// Some code to create the list-view control.
// Initialize LVITEM members that are common to all
// items.
lvI.mask = LVIF_TEXT | LVIF_PARAM;// | LVIF_NORECOMPUTE;// | LVIF_IMAGE;
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
const char *proto = GetContactProto(hContact);
if (proto && db_get_b(hContact, proto, "ChatRoom", 0) == 0 && Proto_IsProtoOnContact(hContact, MODULENAME) // ignore chatrooms
&& mir_strcmp(proto, META_PROTO) != 0) // and MetaContacts
{
lvI.iItem = 0;
lvI.iSubItem = 0;
lvI.lParam = hContact;
lvI.pszText = (TCHAR*)contact_get_nameT(hContact);
lvI.iItem = ListView_InsertItem(lv, &lvI);
PROTOACCOUNT *pa = Proto_GetAccount(proto);
ListView_SetItemText(lv, lvI.iItem, 1, pa->tszAccountName);
ListView_SetItemText(lv, lvI.iItem, 2, (TCHAR*)policy_to_string((OtrlPolicy)db_get_dw(hContact, MODULENAME, "Policy", CONTACT_DEFAULT_POLICY)));
ListView_SetItemText(lv, lvI.iItem, 3, (db_get_b(hContact, MODULENAME, "HTMLConv", 0)) ? TranslateT(LANG_YES) : TranslateT(LANG_NO));
}
}
}
return TRUE;
case WM_COMMAND:
switch (HIWORD(wParam)) {
case CBN_SELCHANGE:
switch (LOWORD(wParam)) {
case IDC_CMB_CONT_POLICY:
MCONTACT hContact = 0;
int iUser = ListView_GetSelectionMark(GetDlgItem(hwndDlg, IDC_LV_CONT_CONTACTS));
if (iUser == -1) break;
int sel = SendDlgItemMessage(hwndDlg, IDC_CMB_CONT_POLICY, CB_GETCURSEL, 0, 0);
if (sel == CB_ERR) break;
int len = SendDlgItemMessage(hwndDlg, IDC_CMB_CONT_POLICY, CB_GETLBTEXTLEN, sel, 0);
if (len < 0) break;
TCHAR *text = new TCHAR[len + 1];
SendDlgItemMessage(hwndDlg, IDC_CMB_CONT_POLICY, CB_GETLBTEXT, sel, (LPARAM)text);
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_LV_CONT_CONTACTS), iUser, 2, text);
OtrlPolicy policy = policy_from_string(text);
delete[] text;
//.........这里部分代码省略.........
示例2: CpuFuncOnInitDialog
LRESULT
CpuFuncOnInitDialog(
__in HWND hWnd,
__in UINT uMsg,
__in WPARAM wp,
__in LPARAM lp
)
{
PDIALOG_OBJECT Object;
PCPU_FORM_CONTEXT Context;
HWND hWndCtrl;
LVCOLUMN lvc = {0};
LVITEM lvi = {0};
ULONG i;
PLISTVIEW_OBJECT ListView;
RECT Rect;
Object = (PDIALOG_OBJECT)SdkGetObject(hWnd);
Context = SdkGetContext(Object, CPU_FORM_CONTEXT);
//
// Create background brush for static controls
//
Context->hBrushBack = CreateSolidBrush(RGB(255, 255, 255));
//
// Create listview object wraps list control
//
ListView = (PLISTVIEW_OBJECT)SdkMalloc(sizeof(LISTVIEW_OBJECT));
ZeroMemory(ListView, sizeof(LISTVIEW_OBJECT));
ListView->Column = CpuFuncColumn;
ListView->Count = CpuFuncColumnCount;
ListView->NotifyCallback = CpuFuncOnNotify;
Context->ListView = ListView;
hWndCtrl = GetDlgItem(hWnd, IDC_LIST_FUNCTION);
ListView_SetExtendedListViewStyleEx(hWndCtrl, LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT);
for (i = 0; i < CpuFuncColumnCount; i++) {
lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
lvc.iSubItem = i;
lvc.pszText = CpuFuncColumn[i].Title;
lvc.cx = CpuFuncColumn[i].Width;
lvc.fmt = CpuFuncColumn[i].Align;
ListView_InsertColumn(hWndCtrl, i, &lvc);
}
GetClientRect(hWnd, &Rect);
MoveWindow(hWndCtrl, Rect.left, Rect.top,
Rect.right - Rect.left,
Rect.bottom - Rect.top, TRUE);
//
// Register dialog scaler
//
Object->Scaler = &CpuFuncScaler;
DialogRegisterScaler(Object);
return TRUE;
}
示例3: GeneralPage
LRESULT CALLBACK GeneralPage(HWND hDlg, UINT unMsg, WPARAM /*wParam*/, LPARAM lParam)
{
/******************************************************************************
*
* G e n e r a l P a g e
*
******************************************************************************
*
* Input: hDlg - Handle to the page dialog
* unMsg - Message ID
* wParam - WPARAM message parameter
* lParam - LPARAM message parameter
*
* Return: FALSE if message is not processed
* TRUE if message is processed here
*
* Description: This is the window procedure for the "General" page dialog
* of the property sheet dialog box. All the Property Sheet
* related events are passed as WM_NOTIFY messages and they
* are identified within the LPARAM which will be pointer to
* the NMDR structure
*****************************************************************************/
HINSTANCE hInstance = (HINSTANCE) GetWindowLongPtr(hDlg, GWLP_HINSTANCE);
switch (unMsg)
{
case WM_INITDIALOG:
{
char szText[256];
char szWindowText[MAXPATHLEN];
char szFullPath[MAXPATHLEN];
int index = 0;
const int NCOLS = 3;
// Display the number of times the server has been started by
// this session of the guardian
SetDlgItemInt(hDlg, IDC_RESTARTS, nRestarts, FALSE);
// get the path to the exe.
// Make sure that it is null terminated
GetModuleFileName(hInstance, szWindowText, sizeof(szWindowText));
char* pszPtr = strrchr(szWindowText, '\\');
*(pszPtr + 1) = 0x00;
ChopFileName(szWindowText, szWindowText, 38);
SetDlgItemText(hDlg, IDC_LOCATION, szWindowText);
// Get version information from the application
GetModuleFileName(hInstance, szFullPath, sizeof(szFullPath));
DWORD dwVerHnd;
const DWORD dwVerInfoSize = GetFileVersionInfoSize(szFullPath, &dwVerHnd);
if (dwVerInfoSize)
{
// If we were able to get the information, process it:
UINT cchVer = 25;
LPSTR lszVer = NULL;
HANDLE hMem = GlobalAlloc(GMEM_MOVEABLE, dwVerInfoSize);
LPVOID lpvMem = GlobalLock(hMem);
GetFileVersionInfo(szFullPath, dwVerHnd, dwVerInfoSize, lpvMem);
if (VerQueryValue(lpvMem, "\\StringFileInfo\\040904E4\\FileVersion",
reinterpret_cast<void**>(&lszVer), &cchVer))
{
SetDlgItemText(hDlg, IDC_VERSION, lszVer);
}
else
SetDlgItemText(hDlg, IDC_VERSION, "N/A");
GlobalUnlock(hMem);
GlobalFree(hMem);
}
// Create the columns Action, Date, Time for the listbox
HWND hWndLog = GetDlgItem(hDlg, IDC_LOG);
LV_COLUMN lvC;
lvC.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
lvC.fmt = LVCFMT_LEFT; // left-align column
lvC.pszText = szText;
for (index = 0; index < NCOLS; index++)
{
// NOTE: IDS_ACTION = 220
// IDS_DATE = 230
// IDS_TIME = 240
lvC.iSubItem = index;
lvC.cx = 85;
LoadString(hInstance, IDS_ACTION + (index * 10), szText, sizeof(szText));
ListView_InsertColumn(hWndLog, index, &lvC);
}
log_info* liTemp = log_entry->next;
LV_ITEM lvI;
lvI.cchTextMax = sizeof(liTemp->log_action);
lvI.mask = LVIF_TEXT;
for (index = 0; liTemp->log_action; index++, liTemp = liTemp->next)
{
lvI.iItem = index;
lvI.iSubItem = 0;
lvI.pszText = liTemp->log_action;
ListView_InsertItem(hWndLog, &lvI);
ListView_SetItemText(hWndLog, index, 0, lvI.pszText);
//.........这里部分代码省略.........
示例4: PSPProcContactProfile
/**
* name: DlgProcPspAbout()
* desc: dialog procedure
*
* return: 0 or 1
**/
INT_PTR CALLBACK PSPProcContactProfile(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
HWND hList = GetDlgItem(hDlg, LIST_PROFILE);
LPLISTCTRL pList;
switch (uMsg) {
case WM_INITDIALOG:
{
LVCOLUMN lvc;
RECT rc;
LOGFONT lf;
HFONT hFont;
TOOLINFO ti;
if (!hList || !(pList = (LPLISTCTRL)mir_alloc(sizeof(LISTCTRL))))
return FALSE;
ZeroMemory(pList, sizeof(LISTCTRL));
TranslateDialogDefault(hDlg);
Ctrl_InitTextColours();
// init info structure
pList->hList = hList;
pList->nType = CTRL_LIST_PROFILE;
ZeroMemory(&pList->labelEdit, sizeof(pList->labelEdit));
SetUserData(hList, pList);
// set new window procedure
OldListViewProc = (WNDPROC)SetWindowLongPtr(hList, GWLP_WNDPROC, (LONG_PTR)&ProfileList_SubclassProc);
// remove static edge in aero mode
if (IsAeroMode())
SetWindowLongPtr(hList, GWL_EXSTYLE, GetWindowLongPtr(hList, GWL_EXSTYLE)&~WS_EX_STATICEDGE);
// insert columns into the listboxes
ListView_SetExtendedListViewStyle(hList, LVS_EX_FULLROWSELECT);
PSGetBoldFont(hDlg, hFont);
SendDlgItemMessage(hDlg, IDC_PAGETITLE, WM_SETFONT, (WPARAM)hFont, 0);
// set listfont
pList->hFont = (HFONT)SendMessage(hList, WM_GETFONT, 0, 0);
pList->wFlags |= LVF_EDITLABEL;
GetObject(pList->hFont, sizeof(lf), &lf);
lf.lfHeight -= 6;
hFont = CreateFontIndirect(&lf);
SendMessage(hList, WM_SETFONT, (WPARAM)hFont, 0);
GetClientRect(hList, &rc);
rc.right -= GetSystemMetrics(SM_CXVSCROLL);
// initiate the tooltips
pList->hTip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL,
WS_POPUP|TTS_BALLOON|TTS_NOPREFIX|TTS_ALWAYSTIP,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
hList, NULL, ghInst, NULL);
if (pList->hTip) {
SetWindowPos(pList->hTip, HWND_TOPMOST,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
ZeroMemory(&ti, sizeof(TOOLINFO));
ti.cbSize = sizeof(TOOLINFO);
ti.uFlags = TTF_IDISHWND|TTF_SUBCLASS|TTF_TRANSPARENT;
ti.hinst = ghInst;
ti.hwnd = hList;
ti.uId = (UINT_PTR)hList;
SendMessage(pList->hTip, TTM_ADDTOOL, NULL, (LPARAM)&ti);
SendMessage(pList->hTip, TTM_ACTIVATE, FALSE, (LPARAM)&ti);
}
// insert columns into the listboxes
lvc.mask = LVCF_WIDTH;
lvc.cx = rc.right / 8 * 3;
ListView_InsertColumn(hList, 0, &lvc);
lvc.cx = rc.right / 8 * 5;
ListView_InsertColumn(hList, 1, &lvc);
return TRUE;
}
case WM_CTLCOLORSTATIC:
case WM_CTLCOLORDLG:
if (IsAeroMode())
return (INT_PTR)GetStockBrush(WHITE_BRUSH);
break;
case WM_NOTIFY:
switch (((LPNMHDR)lParam)->idFrom) {
case 0:
{
HANDLE hContact = (HANDLE)((LPPSHNOTIFY)lParam)->lParam;
LPCSTR pszProto;
//.........这里部分代码省略.........
示例5: ToolsPageWndProc
INT_PTR CALLBACK
ToolsPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
LV_COLUMN column;
TCHAR szTemp[MAX_PATH*2];
TCHAR szTemp2[256];
TCHAR * Ptr = NULL;
LPNMITEMACTIVATE lpnmitem;
LPNMHDR nmh;
DWORD dwStyle;
PROCESS_INFORMATION pi;
STARTUPINFO si;
switch (message)
{
case WM_INITDIALOG:
{
hToolsListCtrl = GetDlgItem(hDlg, IDC_TOOLS_LIST);
hToolsDialog = hDlg;
dwStyle = (DWORD) SendMessage(hToolsListCtrl, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0);
dwStyle = dwStyle | LVS_EX_FULLROWSELECT;
SendMessage(hToolsListCtrl, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, dwStyle);
SetWindowPos(hDlg, NULL, 10, 32, 0, 0, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOSIZE | SWP_NOZORDER);
// Initialize the application page's controls
column.mask = LVCF_TEXT | LVCF_WIDTH;
LoadString(hInst, IDS_TOOLS_COLUMN_NAME, szTemp, 256);
column.pszText = szTemp;
column.cx = 150;
(void)ListView_InsertColumn(hToolsListCtrl, 0, &column);
column.mask = LVCF_TEXT | LVCF_WIDTH;
LoadString(hInst, IDS_TOOLS_COLUMN_DESCR, szTemp, 256);
column.pszText = szTemp;
column.cx = 500;
(void)ListView_InsertColumn(hToolsListCtrl, 1, &column);
FillListView();
return TRUE;
}
case WM_COMMAND:
{
switch (LOWORD(wParam))
{
case IDC_BTN_RUN:
{
if (ListView_GetSelectionMark(hToolsListCtrl) != -1)
{
if (SHGetSpecialFolderPath(NULL, szTemp, ListItems_Locations[ListView_GetSelectionMark(hToolsListCtrl)], FALSE))
Ptr = PathAddBackslash(szTemp);
if (!Ptr)
Ptr = szTemp;
szTemp2[0] = _T('\0');
LoadString(hInst, ListItems_Cmds[ListView_GetSelectionMark(hToolsListCtrl)], Ptr, 256);
LoadString(hInst, ListItems_Params[ListView_GetSelectionMark(hToolsListCtrl)], szTemp2, 256);
if (_tcslen(szTemp2))
{
_tcscat(szTemp, _T(" "));
_tcscat(Ptr, szTemp2);
}
ZeroMemory(&si, sizeof(STARTUPINFO));
si.cb = sizeof(STARTUPINFO);
if (CreateProcess(NULL, szTemp, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
{
CloseHandle(pi.hThread);
CloseHandle(pi.hProcess);
}
}
}
}
break;
}
case WM_NOTIFY:
{
nmh = (LPNMHDR) lParam;
if (nmh->hwndFrom == hToolsListCtrl)
{
switch (nmh->code)
{
case LVN_ITEMCHANGED:
{
lpnmitem = (LPNMITEMACTIVATE) lParam;
if (lpnmitem->iItem > -1)
{
LoadString(hInst, ListItems_Cmds[lpnmitem->iItem], szTemp, 256);
szTemp2[0] = _T('\0');
LoadString(hInst, ListItems_Params[lpnmitem->iItem], szTemp2, 256);
_tcscat(szTemp, _T(" "));
_tcscat(szTemp, szTemp2);
SendDlgItemMessage(hToolsDialog, IDC_TOOLS_CMDLINE, WM_SETTEXT, 0, (LPARAM) szTemp);
}
break;
}
case NM_DBLCLK:
{
//.........这里部分代码省略.........
示例6: EnableWindow
void
CRecoveryHandler::InitInstance(
HWND inDialogHwnd,
HWND inListCtrlHwnd)
/*++
Routine Description:
This functions does the UI related intialization first and then launches
the recovery thread. This function is called from Recovery dialog's
WM_INITDIALOG.
Arguments:
inDialogHwnd - Handle to the Recovery dialog
inListCtrlHwnd - Handle to the recovery status list view
Returns:
None
--*/
{
m_hwndDlg = inDialogHwnd;
m_hwndListCtrl = inListCtrlHwnd;
// Disable the close & terminate button
EnableWindow(
GetDlgItem(m_hwndDlg, IDC_BTN_CLOSE),
FALSE);
EnableWindow(
GetDlgItem(m_hwndDlg, IDC_BTN_TERMINATE),
FALSE);
LVCOLUMN lvColumn;
lvColumn.mask = LVCF_WIDTH;
lvColumn.cx = 1024;
ListView_InsertColumn(inListCtrlHwnd, 0, &lvColumn);
ListView_SetBkColor(m_hwndListCtrl, RGB(230, 232, 208));
ListView_SetExtendedListViewStyle(
m_hwndListCtrl,
LVS_EX_FULLROWSELECT);
//
// Launch recovery thread
//
mThreadHandle = CreateThread(
NULL,
0,
RecoveryThread,
(LPVOID)this,
0,
&mThreadId);
// If thread creation failed, then enable the close button
// if it succeeded then enable the terminate button
if (mThreadHandle == NULL)
{
EnableWindow(
GetDlgItem(m_hwndDlg, IDC_BTN_CLOSE),
TRUE);
}
else
{
EnableWindow(
GetDlgItem(m_hwndDlg, IDC_BTN_TERMINATE),
TRUE);
}
}
示例7: MemMgr_OnInit
void MemMgr_OnInit (void)
{
DWORD dwFlags = WS_CHILD | WS_TABSTOP | WS_VISIBLE;
MakeWindow (TEXT("Button"), TEXT("Allocation Statistics"), dwFlags | BS_GROUPBOX, NULL, l.hManager, IDC_BOX_ALLOC);
MakeWindow (TEXT("Static"), TEXT("C++ Objects:"), dwFlags, NULL, l.hManager, IDC_LABEL_CPP);
MakeWindow (TEXT("Static"), TEXT("Dynamic:"), dwFlags, NULL, l.hManager, IDC_LABEL_OTHER);
MakeWindow (TEXT("Static"), TEXT("Combined:"), dwFlags, NULL, l.hManager, IDC_LABEL_TOTAL);
MakeWindow (TEXT("Static"), TEXT("Tared:"), dwFlags, NULL, l.hManager, IDC_LABEL_TARED);
MakeWindow (TEXT("Static"), TEXT("Count"), dwFlags | SS_CENTER, NULL, l.hManager, IDC_LABEL_COUNT);
MakeWindow (TEXT("Static"), TEXT("Size"), dwFlags | SS_CENTER, NULL, l.hManager, IDC_LABEL_SIZE);
MakeWindow (TEXT("Static"), TEXT("Average"), dwFlags | SS_CENTER, NULL, l.hManager, IDC_LABEL_AVERAGE);
MakeWindow (TEXT("Static"), TEXT("0"), dwFlags | SS_CENTER, NULL, l.hManager, IDC_VALUE_CPP_COUNT);
MakeWindow (TEXT("Static"), TEXT("1"), dwFlags | SS_CENTER, NULL, l.hManager, IDC_VALUE_OTHER_COUNT);
MakeWindow (TEXT("Static"), TEXT("2"), dwFlags | SS_CENTER, NULL, l.hManager, IDC_VALUE_TARED_COUNT);
MakeWindow (TEXT("Static"), TEXT("3"), dwFlags | SS_CENTER, NULL, l.hManager, IDC_VALUE_TOTAL_COUNT);
MakeWindow (TEXT("Static"), TEXT("4"), dwFlags | SS_CENTER, NULL, l.hManager, IDC_VALUE_CPP_SIZE);
MakeWindow (TEXT("Static"), TEXT("5"), dwFlags | SS_CENTER, NULL, l.hManager, IDC_VALUE_OTHER_SIZE);
MakeWindow (TEXT("Static"), TEXT("6"), dwFlags | SS_CENTER, NULL, l.hManager, IDC_VALUE_TARED_SIZE);
MakeWindow (TEXT("Static"), TEXT("7"), dwFlags | SS_CENTER, NULL, l.hManager, IDC_VALUE_TOTAL_SIZE);
MakeWindow (TEXT("Static"), TEXT("8"), dwFlags | SS_CENTER, NULL, l.hManager, IDC_VALUE_CPP_AVERAGE);
MakeWindow (TEXT("Static"), TEXT("9"), dwFlags | SS_CENTER, NULL, l.hManager, IDC_VALUE_OTHER_AVERAGE);
MakeWindow (TEXT("Static"), TEXT("10"), dwFlags | SS_CENTER, NULL, l.hManager, IDC_VALUE_TARED_AVERAGE);
MakeWindow (TEXT("Static"), TEXT("11"), dwFlags | SS_CENTER, NULL, l.hManager, IDC_VALUE_TOTAL_AVERAGE);
MakeWindow (TEXT("Button"), TEXT("Details"), dwFlags | BS_GROUPBOX, NULL, l.hManager, IDC_BOX_DETAILS);
MakeWindow (WC_LISTVIEW, TEXT(""), dwFlags | LVS_REPORT | LVS_SINGLESEL, NULL, l.hManager, IDC_LIST, WS_EX_CLIENTEDGE);
// MakeWindow (TEXT("Button"), TEXT("Label"), dwFlags, NULL, l.hManager, IDC_LABEL);
// MakeWindow (TEXT("Button"), TEXT("Hidden"), dwFlags, NULL, l.hManager, IDC_HIDE);
MakeWindow (TEXT("Button"), TEXT("Tare"), dwFlags, NULL, l.hManager, IDC_TARE);
MakeWindow (TEXT("Button"), TEXT("Restore"), dwFlags, NULL, l.hManager, IDC_RESET);
MakeWindow (TEXT("Button"), TEXT("Close"), dwFlags, NULL, l.hManager, IDCANCEL);
MemMgr_OnSize();
HWND hList = GetDlgItem (l.hManager, IDC_LIST);
LV_COLUMN Col;
Col.mask = LVCF_WIDTH | LVCF_TEXT | LVCF_FMT | LVCF_SUBITEM;
Col.fmt = LVCFMT_LEFT;
Col.iSubItem = 0;
Col.cx = lr.acxColumns[0];
Col.pszText = TEXT("Time");
ListView_InsertColumn (hList, Col.iSubItem, &Col);
Col.cx = lr.acxColumns[1];
Col.pszText = TEXT("Flags");
Col.iSubItem++;
ListView_InsertColumn (hList, Col.iSubItem, &Col);
Col.cx = lr.acxColumns[2];
Col.pszText = TEXT("Expression");
Col.iSubItem++;
ListView_InsertColumn (hList, Col.iSubItem, &Col);
Col.cx = lr.acxColumns[3];
Col.pszText = TEXT("Location");
Col.iSubItem++;
ListView_InsertColumn (hList, Col.iSubItem, &Col);
Col.fmt = LVCFMT_RIGHT;
Col.cx = lr.acxColumns[4];
Col.pszText = TEXT("Size");
Col.iSubItem++;
ListView_InsertColumn (hList, Col.iSubItem, &Col);
Col.cx = lr.acxColumns[5];
Col.pszText = TEXT("Address");
Col.iSubItem++;
ListView_InsertColumn (hList, Col.iSubItem, &Col);
EnterCriticalSection (l.pcs);
SendMessage (GetDlgItem (l.hManager, IDC_LIST), WM_SETREDRAW, FALSE, 0);
for (size_t iChunk = 0; iChunk < l.cChunks; ++iChunk)
{
PMEMCHUNK pChunk;
if ((pChunk = (PMEMCHUNK)l.pHeap->GetAt(iChunk)) == NULL)
continue;
pChunk->fInList = FALSE;
if (!pChunk->fTared && !pChunk->fFreed)
MemMgr_AddToList (pChunk);
}
SendMessage (GetDlgItem (l.hManager, IDC_LIST), WM_SETREDRAW, TRUE, 0);
LeaveCriticalSection (l.pcs);
l.idTimer = SetTimer (l.hManager, 0, cmsecREFRESH, NULL);
}
示例8: FinderProc
BOOL CALLBACK FinderProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
int wmId,wmEvent;
LRESULT lStyle;
switch(uMsg)
{
case WM_PAINT:
INIT_CHECK(IDC_UNSIGNED,Unsigned);
return FALSE;
case WM_INITDIALOG:
mptr[0]=psM;
mptr[1]=psxM;
hWndFinder=hWnd;
ENABLE_CONTROL(IDC_VALUE,false);
GROUP_INIT(IDC_EE,Source);
GROUP_SELECT(IDC_EE);
GROUP_SELECT(IDC_IOP);
GROUP_INIT(IDC_OLD,CompareTo);
GROUP_SELECT(IDC_OLD);
GROUP_SELECT(IDC_SET);
ENABLE_CONTROL(IDC_VALUE,(CompareTo!=0));
GROUP_INIT(IDC_EQ,Compare);
GROUP_SELECT(IDC_EQ);
GROUP_SELECT(IDC_GT);
GROUP_SELECT(IDC_LT);
GROUP_SELECT(IDC_GE);
GROUP_SELECT(IDC_LE);
GROUP_SELECT(IDC_NE);
GROUP_INIT(IDC_8B,Size);
GROUP_SELECT(IDC_8B);
GROUP_SELECT(IDC_16B);
GROUP_SELECT(IDC_32B);
GROUP_SELECT(IDC_64B);
INIT_CHECK(IDC_UNSIGNED,Unsigned);
//Listview Init
lStyle = SendMessage(GetDlgItem(hWnd,IDC_RESULTS), LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0);
SendMessage(GetDlgItem(hWnd,IDC_RESULTS), LVM_SETEXTENDEDLISTVIEWSTYLE, 0, lStyle | LVS_EX_FULLROWSELECT);
ListView_InsertColumn(GetDlgItem(hWnd,IDC_RESULTS),0,&cols[0]);
ListView_InsertColumn(GetDlgItem(hWnd,IDC_RESULTS),1,&cols[1]);
ListView_InsertColumn(GetDlgItem(hWnd,IDC_RESULTS),2,&cols[2]);
if(FirstShow)
{
SearchReset();
SetWindowText(GetDlgItem(hWnd,IDC_MATCHES),"ready to search.");
FirstShow=false;
}
else {
AddResults(hWnd);
}
break;
case WM_COMMAND:
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
// Parse the menu selections:
switch (wmId)
{
case IDCANCEL:
EndDialog(hWnd,1);
break;
case IDC_ADD:
AddCheat(pInstance,hWnd);
break;
case IDC_RESET:
ENABLE_CONTROL(IDC_EE, true);
ENABLE_CONTROL(IDC_IOP, true);
ENABLE_CONTROL(IDC_STATUS, true);
ENABLE_CONTROL(IDC_UNSIGNED,true);
ENABLE_CONTROL(IDC_8B, true);
ENABLE_CONTROL(IDC_16B, true);
ENABLE_CONTROL(IDC_32B, true);
ENABLE_CONTROL(IDC_64B, true);
SetWindowText(GetDlgItem(hWnd,IDC_MATCHES),"ready to search.");
SearchReset();
ListView_DeleteAllItems(GetDlgItem(hWnd,IDC_RESULTS));
break;
case IDC_SEARCH:
GetWindowText(GetDlgItem(hWnd,IDC_VALUE),mtext,100);
CompareValue=atoi(mtext);
ENABLE_CONTROL(IDC_SEARCH, false);
ENABLE_CONTROL(IDC_RESET, false);
ENABLE_CONTROL(IDC_ADD, false);
ENABLE_CONTROL(IDCANCEL, false);
if(FirstSearch) {
//.........这里部分代码省略.........
示例9: GetMessagePos
void CManageBookmarksDialog::OnListViewHeaderRClick()
{
DWORD dwCursorPos = GetMessagePos();
POINT ptCursor;
ptCursor.x = GET_X_LPARAM(dwCursorPos);
ptCursor.y = GET_Y_LPARAM(dwCursorPos);
HMENU hMenu = CreatePopupMenu();
int iItem = 0;
for each(auto ci in m_pmbdps->m_vectorColumnInfo)
{
TCHAR szColumn[128];
GetColumnString(ci.ColumnType,szColumn,SIZEOF_ARRAY(szColumn));
MENUITEMINFO mii;
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_ID|MIIM_STRING|MIIM_STATE;
mii.wID = ci.ColumnType;
mii.dwTypeData = szColumn;
mii.fState = 0;
if(ci.bActive)
{
mii.fState |= MFS_CHECKED;
}
/* The name column cannot be removed. */
if(ci.ColumnType == CManageBookmarksDialogPersistentSettings::COLUMN_TYPE_NAME)
{
mii.fState |= MFS_DISABLED;
}
InsertMenuItem(hMenu,iItem,TRUE,&mii);
++iItem;
}
int iCmd = TrackPopupMenu(hMenu,TPM_LEFTALIGN|TPM_RETURNCMD,ptCursor.x,ptCursor.y,0,m_hDlg,NULL);
DestroyMenu(hMenu);
int iColumn = 0;
for(auto itr = m_pmbdps->m_vectorColumnInfo.begin();itr != m_pmbdps->m_vectorColumnInfo.end();++itr)
{
if(itr->ColumnType == iCmd)
{
HWND hListView = GetDlgItem(m_hDlg,IDC_MANAGEBOOKMARKS_LISTVIEW);
if(itr->bActive)
{
itr->iWidth = ListView_GetColumnWidth(hListView,iColumn);
ListView_DeleteColumn(hListView,iColumn);
}
else
{
LVCOLUMN lvCol;
TCHAR szTemp[128];
GetColumnString(itr->ColumnType,szTemp,SIZEOF_ARRAY(szTemp));
lvCol.mask = LVCF_TEXT|LVCF_WIDTH;
lvCol.pszText = szTemp;
lvCol.cx = itr->iWidth;
ListView_InsertColumn(hListView,iColumn,&lvCol);
HWND hTreeView = GetDlgItem(m_hDlg,IDC_MANAGEBOOKMARKS_TREEVIEW);
HTREEITEM hSelected = TreeView_GetSelection(hTreeView);
CBookmarkFolder &BookmarkFolder = m_pBookmarkTreeView->GetBookmarkFolderFromTreeView(hSelected);
int iItem = 0;
for(auto itrBookmarks = BookmarkFolder.begin();itrBookmarks != BookmarkFolder.end();++itrBookmarks)
{
TCHAR szColumn[256];
GetBookmarkItemColumnInfo(*itrBookmarks,itr->ColumnType,szColumn,SIZEOF_ARRAY(szColumn));
ListView_SetItemText(hListView,iItem,iColumn,szColumn);
++iItem;
}
}
itr->bActive = !itr->bActive;
break;
}
else
{
if(itr->bActive)
{
++iColumn;
}
}
}
}
示例10: yzInitSystem
BOOL WINAPI yzInitSystem()
{
int i;
long DriverOpenFlag = LoadDRV ( );
if ( DriverOpenFlag ) {
MessageBox ( hGWnd, "Load driver FAIL", "Message", MB_OK );
return FALSE;
}
TotalLine = CheckValidCh();
if ( EnableCard(TotalLine,1024*8) != (long)0) {
FreeDRV();
MessageBox ( hGWnd, "Enable Card FAIL", "Message", MB_OK );
return FALSE;
}
Lines=new LINESTRUCT[TotalLine];
SetBusyPara(350);
for(i=0;i<TotalLine;i++)
{
Lines[i].nType=CheckChType(i);
Lines[i].State = CH_FREE;
}
static int ColumnWidth[60] = {50, 50, 150, 150, 150, 100, 50, 150};
LV_COLUMN lvc;
char dig[10];
lvc.mask = LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
lvc.iSubItem = 0;
lvc.pszText = "通道号" ;
lvc.cx = ColumnWidth[0];
ListView_InsertColumn(GetDlgItem(hGWnd,IDC_STATELIST),0,&lvc);
lvc.iSubItem = 1;
lvc.pszText = " 通道类型" ;
lvc.cx = ColumnWidth[1];
ListView_InsertColumn(GetDlgItem(hGWnd,IDC_STATELIST),1,&lvc);
lvc.iSubItem = 2;
lvc.pszText = "流程状态" ;
lvc.cx = ColumnWidth[2];
ListView_InsertColumn(GetDlgItem(hGWnd,IDC_STATELIST),2,&lvc);
lvc.iSubItem = 3;
lvc.pszText = "号码" ;
lvc.cx = ColumnWidth[3];
ListView_InsertColumn(GetDlgItem(hGWnd,IDC_STATELIST),3,&lvc);
LV_ITEM lvi;
for(i = 0; i < TotalLine; i++)
{
lvi.mask = LVIF_TEXT;
lvi.iItem = i;
lvi.iSubItem = 0;
itoa( i, dig, 10 ) ;
lvi.pszText = dig;
ListView_InsertItem(GetDlgItem(hGWnd,IDC_STATELIST),&lvi);
}
GetVoicePath();
char FileName[128];
for(i=0;i<TotalLine;i++)
{
if(Lines[i].nType==CHTYPE_TRUNK)
{
itoa(i,dig,10);
SendMessage(GetDlgItem(hGWnd,IDC_CHANNEL),CB_ADDSTRING,0,(LPARAM)dig);
ListView_SetItemText(GetDlgItem(hGWnd,IDC_STATELIST), i, 1, "外线")
}
else if(Lines[i].nType==CHTYPE_USER)
示例11: extrasCreateSSDTDialog
/*
* extrasCreateSSDTDialog
*
* Purpose:
*
* Create and initialize KiServiceTable Dialog.
*
*/
VOID extrasCreateSSDTDialog(
_In_ HWND hwndParent
)
{
LVCOLUMN col;
//allow only one dialog
if (g_wobjDialogs[WOBJ_SSDTDLG_IDX]) {
if (IsIconic(g_wobjDialogs[WOBJ_SSDTDLG_IDX]))
ShowWindow(g_wobjDialogs[WOBJ_SSDTDLG_IDX], SW_RESTORE);
else
SetActiveWindow(g_wobjDialogs[WOBJ_SSDTDLG_IDX]);
return;
}
RtlSecureZeroMemory(&SdtDlgContext, sizeof(SdtDlgContext));
SdtDlgContext.hwndDlg = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_DIALOG_EXTRASLIST),
hwndParent, &SdtDialogProc, 0);
if (SdtDlgContext.hwndDlg == NULL) {
return;
}
g_wobjDialogs[WOBJ_SSDTDLG_IDX] = SdtDlgContext.hwndDlg;
SdtDlgContext.SizeGrip = supCreateSzGripWindow(SdtDlgContext.hwndDlg);
SetWindowText(SdtDlgContext.hwndDlg, TEXT("System Service Table"));
extrasSetDlgIcon(SdtDlgContext.hwndDlg);
SdtDlgContext.ListView = GetDlgItem(SdtDlgContext.hwndDlg, ID_EXTRASLIST);
if (SdtDlgContext.ListView) {
ListView_SetImageList(SdtDlgContext.ListView, ListViewImages, LVSIL_SMALL);
ListView_SetExtendedListViewStyle(SdtDlgContext.ListView,
LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER | LVS_EX_GRIDLINES | LVS_EX_LABELTIP);
//columns
RtlSecureZeroMemory(&col, sizeof(col));
col.mask = LVCF_TEXT | LVCF_SUBITEM | LVCF_FMT | LVCF_WIDTH | LVCF_ORDER | LVCF_IMAGE;
col.iSubItem++;
col.pszText = TEXT("Id");
col.fmt = LVCFMT_LEFT | LVCFMT_BITMAP_ON_RIGHT;
col.iImage = ImageList_GetImageCount(ListViewImages) - 1;
col.cx = 80;
ListView_InsertColumn(SdtDlgContext.ListView, col.iSubItem, &col);
col.iSubItem++;
col.pszText = TEXT("Service Name");
col.iOrder++;
col.iImage = -1;
col.cx = 200;
ListView_InsertColumn(SdtDlgContext.ListView, col.iSubItem, &col);
col.iSubItem++;
col.pszText = TEXT("Address");
col.iOrder++;
col.cx = 130;
ListView_InsertColumn(SdtDlgContext.ListView, col.iSubItem, &col);
col.iSubItem++;
col.pszText = TEXT("Module");
col.iOrder++;
col.cx = 200;
ListView_InsertColumn(SdtDlgContext.ListView, col.iSubItem, &col);
//remember columns count
SdtDlgContext.lvColumnCount = col.iSubItem;
SdtListTable();
SendMessage(SdtDlgContext.hwndDlg, WM_SIZE, 0, 0);
ListView_SortItemsEx(SdtDlgContext.ListView, &SdtDlgCompareFunc, 0);
}
}
示例12: KG_PROCESS_ERROR
int KUiFontManage::Init(HWND hWnd)
{
int nResult = false;
int nRetCode = false;
KG_PROCESS_ERROR(hWnd);
KG_PROCESS_ERROR(m_szFontFileName[0]);
m_hWnd = hWnd;
RECT rcWindow;
::GetWindowRect(m_hWnd, &rcWindow);
::SetWindowPos(m_hWnd, HWND_TOP, 400, 200,
rcWindow.right -rcWindow.left, rcWindow.bottom - rcWindow.top,
SWP_SHOWWINDOW);
m_hListWnd = ::GetDlgItem(hWnd, IDC_WND_FONT_MANAGE_FONT_LIST);
KG_PROCESS_ERROR(m_hListWnd);
//设置文件列表框的属性与分栏信息
ListView_SetExtendedListViewStyle(m_hListWnd,
ListView_GetExtendedListViewStyle(m_hListWnd) | LVS_EX_FULLROWSELECT);
RECT rc;
::GetClientRect(m_hListWnd, &rc);
LVCOLUMN lvc;
char szHeaderText[128];
lvc.mask = LVCF_TEXT | LVCF_WIDTH;
lvc.cx = (rc.right - rc.left) / 3;
lvc.pszText = szHeaderText;
lvc.cchTextMax = 128;
strcpy(szHeaderText, "字体名:");
ListView_InsertColumn(m_hListWnd, 0, &lvc);
lvc.cx = (rc.right - rc.left) / 3;
lvc.mask |= LVCF_SUBITEM;
lvc.iSubItem = 1;
strcpy(szHeaderText, "字体颜色");
ListView_InsertColumn(m_hListWnd, 1, &lvc);
lvc.cx = (rc.right - rc.left) / 3;
lvc.mask |= LVCF_SUBITEM;
lvc.iSubItem = 1;
strcpy(szHeaderText, "字边颜色");
ListView_InsertColumn(m_hListWnd, 2, &lvc);
lvc.cx = (rc.right - rc.left) / 3;
lvc.mask |= LVCF_SUBITEM;
lvc.iSubItem = 1;
strcpy(szHeaderText, "阴影颜色");
ListView_InsertColumn(m_hListWnd, 3, &lvc);
//读入Font配置文件
if (m_pFontIni == NULL)
{
m_pFontIni = g_OpenIniFile(m_szFontFileName);
}
KG_PROCESS_ERROR(m_pFontIni);
int nFontNum = 0;
char szName[8] = "";
char szKey[32] = "";
int i = 0;
nFontNum = m_pFontIni->GetSectionCount();
for (i = 0; i < nFontNum; i++)
{
sprintf(szName, "%d", i);
m_pFontIni->GetString(szName, "Name", "", szKey, sizeof(szKey));
LV_ITEM lvi;
memset(&lvi, 0, sizeof(LV_ITEM));
lvi.mask = LVIF_TEXT;
lvi.pszText = (char*)szKey;
lvi.cchTextMax = 128;
lvi.iItem = ListView_GetItemCount(m_hListWnd);
lvi.iItem = ListView_InsertItem(m_hListWnd, &lvi);
m_pFontIni->GetString(szName, "Color", "", szKey, sizeof(szKey));
ListView_SetItemText(m_hListWnd, lvi.iItem, 1, szKey);
m_pFontIni->GetString(szName, "BorderColor", "", szKey, sizeof(szKey));
ListView_SetItemText(m_hListWnd, lvi.iItem, 2, szKey);
m_pFontIni->GetString(szName, "ProjectionColor", "", szKey, sizeof(szKey));
ListView_SetItemText(m_hListWnd, lvi.iItem, 3, szKey);
}
nResult = true;
Exit0:
return nResult;
}
示例13: DlgProcMirOTROptsFinger
static INT_PTR CALLBACK DlgProcMirOTROptsFinger(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
HWND lv = GetDlgItem(hwndDlg, IDC_LV_FINGER_LIST);
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) new FPModifyMap());
SendDlgItemMessage(hwndDlg, IDC_LV_FINGER_LIST, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT);// | LVS_EX_CHECKBOXES);
{
// add list columns
LVCOLUMN lvc;
// Initialize the LVCOLUMN structure.
// The mask specifies that the format, width, text, and
// subitem members of the structure are valid.
lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
lvc.fmt = LVCFMT_LEFT;
lvc.iSubItem = 0;
lvc.pszText = TranslateT(LANG_CONTACT);
lvc.cx = 100; // width of column in pixels
ListView_InsertColumn(lv, 0, &lvc);
lvc.iSubItem = 1;
lvc.pszText = TranslateT(LANG_PROTO);
lvc.cx = 90; // width of column in pixels
ListView_InsertColumn(lv, 1, &lvc);
lvc.iSubItem = 2;
lvc.pszText = TranslateT(LANG_ACTIVE);
lvc.cx = 50; // width of column in pixels
ListView_InsertColumn(lv, 2, &lvc);
lvc.iSubItem = 3;
lvc.pszText = TranslateT(LANG_VERIFIED);
lvc.cx = 50; // width of column in pixels
ListView_InsertColumn(lv, 3, &lvc);
lvc.iSubItem = 4;
lvc.pszText = TranslateT(LANG_FINGERPRINT);
lvc.cx = 300; // width of column in pixels
ListView_InsertColumn(lv, 4, &lvc);
}
SendMessage(hwndDlg, WMU_REFRESHLIST, 0, 0);
return TRUE;
case WMU_REFRESHLIST:
// enumerate contacts, fill in list
ListView_DeleteAllItems(lv);
{
LVITEM lvI = { 0 };
// Some code to create the list-view control.
// Initialize LVITEM members that are common to all
// items.
lvI.mask = LVIF_TEXT | LVIF_PARAM;// | LVIF_NORECOMPUTE;// | LVIF_IMAGE;
TCHAR *user, hash[45] = { 0 };
for (ConnContext *context = otr_user_state->context_root; context; context = context->next) {
if (context->app_data) {
user = (TCHAR*)contact_get_nameT((UINT_PTR)context->app_data);
if (user) {
PROTOACCOUNT *pa = Proto_GetAccount(context->protocol);
for (Fingerprint *fp = context->fingerprint_root.next; fp; fp = fp->next) {
otrl_privkey_hash_to_humanT(hash, fp->fingerprint);
lvI.iSubItem = 0;
lvI.lParam = (LPARAM)fp;
lvI.pszText = user;
int d = ListView_InsertItem(lv, &lvI);
ListView_SetItemText(lv, d, 1, pa->tszAccountName);
ListView_SetItemText(lv, d, 2, (context->active_fingerprint == fp) ? TranslateT(LANG_YES) : TranslateT(LANG_NO));
ListView_SetItemText(lv, d, 3, (fp->trust && fp->trust[0] != '\0') ? TranslateT(LANG_YES) : TranslateT(LANG_NO));
ListView_SetItemText(lv, d, 4, hash);
}
}
}
}
}
return TRUE;
case WM_COMMAND:
switch (HIWORD(wParam)) {
int sel;
case BN_CLICKED:
switch (LOWORD(wParam)) {
case IDC_BTN_FINGER_DONTTRUST:
sel = ListView_GetSelectionMark(GetDlgItem(hwndDlg, IDC_LV_FINGER_LIST));
if (sel != -1) {
LVITEM lvi = { 0 };
lvi.mask = LVIF_PARAM;
lvi.iItem = sel;
ListView_GetItem(GetDlgItem(hwndDlg, IDC_LV_FINGER_LIST), &lvi);
Fingerprint *fp = (Fingerprint*)lvi.lParam;
FPModifyMap* fpm = (FPModifyMap*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
(*fpm)[fp] = FPM_NOTRUST;
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_LV_FINGER_LIST), sel, 3, TranslateT(LANG_NO));
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
//.........这里部分代码省略.........
示例14: CheatsListBox_Proc
//==============================================================================
BOOL CALLBACK CheatsListBox_Proc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
{
switch(msg)
{
case WM_INITDIALOG:
{
LV_COLUMN lvColumn;
u32 address = 0;
u32 val = 0;
cheatListView = GetDlgItem(dialog, IDC_LIST1);
ListView_SetExtendedListViewStyle(cheatListView, LVS_EX_FULLROWSELECT | LVS_EX_TWOCLICKACTIVATE);
memset(&lvColumn,0,sizeof(LV_COLUMN));
lvColumn.mask=LVCF_FMT|LVCF_WIDTH|LVCF_TEXT;
lvColumn.fmt=LVCFMT_CENTER;
lvColumn.cx=20;
lvColumn.pszText="X";
ListView_InsertColumn(cheatListView, 0, &lvColumn);
lvColumn.fmt=LVCFMT_LEFT;
lvColumn.cx=84;
lvColumn.pszText="Address";
ListView_InsertColumn(cheatListView, 1, &lvColumn);
lvColumn.cx=100;
lvColumn.pszText="Value";
ListView_InsertColumn(cheatListView, 2, &lvColumn);
lvColumn.cx=245;
lvColumn.pszText="Description";
ListView_InsertColumn(cheatListView, 3, &lvColumn);
lvColumn.fmt=LVCFMT_CENTER;
LVITEM lvi;
memset(&lvi,0,sizeof(LVITEM));
lvi.mask = LVIF_TEXT|LVIF_STATE;
lvi.iItem = INT_MAX;
cheatsGetListReset();
SendMessage(cheatListView, WM_SETREDRAW, (WPARAM)FALSE,0);
while (cheatsGetList(&tempCheat))
{
char buf[256];
if (tempCheat.enabled)
lvi.pszText= "X";
else
lvi.pszText= "";
switch (tempCheat.type)
{
case 0: // Internal
{
u32 row = ListView_InsertItem(cheatListView, &lvi);
wsprintf(buf, "0x02%06X", tempCheat.hi[0]);
ListView_SetItemText(cheatListView, row, 1, buf);
ltoa(tempCheat.lo[0], buf, 10);
ListView_SetItemText(cheatListView, row, 2, buf);
ListView_SetItemText(cheatListView, row, 3, tempCheat.description);
break;
}
case 1: // Action Replay
{
u32 row = ListView_InsertItem(cheatListView, &lvi);
ListView_SetItemText(cheatListView, row, 1, "Action");
ListView_SetItemText(cheatListView, row, 2, "Replay");
ListView_SetItemText(cheatListView, row, 3, tempCheat.description);
break;
}
case 2: // Codebreaker
{
u32 row = ListView_InsertItem(cheatListView, &lvi);
ListView_SetItemText(cheatListView, row, 1, "Code");
ListView_SetItemText(cheatListView, row, 2, "breaker");
ListView_SetItemText(cheatListView, row, 3, tempCheat.description);
break;
}
}
}
SendMessage(cheatListView, WM_SETREDRAW, (WPARAM)TRUE,0);
ListView_SetItemState(searchListView,0, LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED);
SetFocus(searchListView);
return TRUE;
}
case WM_NOTIFY:
if (wparam == IDC_LIST1)
{
LPNMHDR tmp_msg = (LPNMHDR)lparam;
if ( tmp_msg->code == LVN_ITEMACTIVATE )
{
cheatEditPos = ListView_GetNextItem(cheatListView, -1, LVNI_SELECTED|LVNI_FOCUSED);
cheatsGet(&tempCheat, cheatEditPos);
tempCheat.enabled = !tempCheat.enabled;
switch (tempCheat.type)
{
case 0: // internal
//.........这里部分代码省略.........
示例15: ConfirmDlgProc
static BOOL CALLBACK ConfirmDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam)
{
switch(msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
{
HWND hList=GetDlgItem(hwndDlg,IDC_STARTUPLIST);
SendMessage(hList,LVM_SETEXTENDEDLISTVIEWSTYLE,0,LVS_EX_FULLROWSELECT);
// create columns
LVCOLUMN lvCol = { 0 };
lvCol.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;
lvCol.pszText = TranslateT("Protocol");
ListView_InsertColumn(hList, 0, &lvCol );
lvCol.cx = 100;
lvCol.pszText = TranslateT("Status");
ListView_InsertColumn(hList, 1, &lvCol );
lvCol.pszText = TranslateT("Message");
ListView_InsertColumn(hList, 2, &lvCol );
}
// create items
SetStatusList(hwndDlg);
EnableWindow(GetDlgItem(hwndDlg, IDC_SETSTSMSG), FALSE);
// fill profile combo box
if (!ServiceExists(MS_SS_GETPROFILE))
EnableWindow(GetDlgItem(hwndDlg, IDC_PROFILE), FALSE);
else {
int defaultProfile;
int profileCount = (int)CallService(MS_SS_GETPROFILECOUNT, (WPARAM)&defaultProfile, 0);
for ( int i=0; i < profileCount; i++ ) {
char profileName[128];
CallService( MS_SS_GETPROFILENAME, i, (LPARAM)profileName );
int item = SendDlgItemMessageA( hwndDlg, IDC_PROFILE, CB_ADDSTRING, 0, (LPARAM)profileName );
SendDlgItemMessage( hwndDlg, IDC_PROFILE, CB_SETITEMDATA, item, ( LPARAM )i );
}
if ( profileCount == 0 )
EnableWindow(GetDlgItem(hwndDlg, IDC_PROFILE), FALSE);
}
// start timer
if (timeOut > 0) {
TCHAR text[32];
_sntprintf(text, SIZEOF(text), TranslateT("Closing in %d"), timeOut);
SetDlgItemText(hwndDlg, IDC_CLOSE, text);
SetTimer(hwndDlg, TIMER_ID, 1000, NULL);
}
break;
case WM_TIMER:
{
TCHAR text[32];
_sntprintf(text, SIZEOF(text), TranslateT("Closing in %d"), timeOut-1);
SetDlgItemText(hwndDlg, IDC_CLOSE, text);
if (timeOut <= 0) {
KillTimer(hwndDlg, TIMER_ID);
SendMessage(hwndDlg, UM_CLOSECONFIRMDLG, 0, 0);
}
else timeOut--;
}
break;
case WM_COMMAND:
// stop timer
KillTimer(hwndDlg, TIMER_ID);
SetDlgItemText(hwndDlg, IDC_CLOSE, TranslateT("Close"));
if ( (HIWORD(wParam) == CBN_SELCHANGE) || (HIWORD(wParam) == BN_CLICKED) || (HIWORD(wParam) == NM_CLICK) ) { // something clicked
switch (LOWORD(wParam)) {
case IDC_PROFILE:
{
int i, profile = (int)SendDlgItemMessage(hwndDlg, IDC_PROFILE, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0), 0);
for ( i=0; i < confirmSettings.getCount(); i++ ) {
if (confirmSettings[i].szMsg != NULL) {
free(confirmSettings[i].szMsg);
confirmSettings[i].szMsg = NULL;
} }
CallService(MS_SS_GETPROFILE, (WPARAM)profile, (LPARAM)&confirmSettings);
for ( i=0; i < confirmSettings.getCount(); i++ )
if (confirmSettings[i].szMsg != NULL) // we free this later, copy to our memory space
confirmSettings[i].szMsg = _strdup(confirmSettings[i].szMsg);
SetStatusList(hwndDlg);
}
break;
case IDC_STATUS:
{
LVITEM lvItem = { 0 };
lvItem.mask = LVIF_TEXT | LVIF_PARAM;
lvItem.iSubItem = 0;
lvItem.iItem = ListView_GetNextItem(GetDlgItem(hwndDlg,IDC_STARTUPLIST),-1,LVNI_SELECTED);
if (lvItem.iItem == -1)
break;
ListView_GetItem(GetDlgItem(hwndDlg,IDC_STARTUPLIST), &lvItem);
PROTOCOLSETTINGEX* proto = (PROTOCOLSETTINGEX*)lvItem.lParam;
int actualStatus = proto->status = (int)SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_GETCURSEL, 0, 0), 0);
//.........这里部分代码省略.........