本文整理汇总了C++中ListView_SetItemState函数的典型用法代码示例。如果您正苦于以下问题:C++ ListView_SetItemState函数的具体用法?C++ ListView_SetItemState怎么用?C++ ListView_SetItemState使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ListView_SetItemState函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateFilterGrid
void COutputDialog::OnBnClickedBtnFilterAdd()
{
TCHAR szPluginName[MAX_PATH];
szPluginName[0]=_T('\0');
if ( DialogBoxParam(GetModuleHandle(_T("ATCTNR.dll")), MAKEINTRESOURCE(IDD_ADDFILTERDIALOG),
m_hWnd, AddPluginDialogProc, (LPARAM)szPluginName) == IDOK )
{
ATPLUGIN_ARGUMENT arg;
arg.strPluginName=szPluginName;
(MAINAPP)->m_cMultiPlugin.Add(arg);
UpdateFilterGrid();
CWnd* pList = GetDlgItem(IDC_LIST_FILTER);
int nSelected = (MAINAPP)->m_cMultiPlugin.GetFilterCount() - 1;
if(nSelected >= 0)
{
ListView_SetItemState(pList->m_hWnd, nSelected, LVIS_FOCUSED | LVIS_SELECTED, LVIS_FOCUSED | LVIS_SELECTED);
::SetFocus(pList->m_hWnd);
OnNMClickListFilter(NULL, NULL);
}
}
}
示例2: GetDlgItem
void COutputDialog::OnBnClickedBtnFilterDown()
{
CWnd* pList = GetDlgItem(IDC_LIST_FILTER);
int nSelected = ListView_GetSelectionMark(pList->m_hWnd);
if (nSelected < 0)
{
MessageBox(_T("플러그인을 먼저 선택해 주세요"), _T("Aral Trans"), MB_OK | MB_ICONINFORMATION );
}
else
{
if(nSelected < (MAINAPP)->m_cMultiPlugin.GetFilterCount()-1 )
{
(MAINAPP)->m_cMultiPlugin.MoveDown(nSelected);
UpdateFilterGrid();
nSelected++;
}
//ListView_SetSelectionMark(pList->m_hWnd, nSelected);
ListView_SetItemState(pList->m_hWnd, nSelected, LVIS_FOCUSED | LVIS_SELECTED, LVIS_FOCUSED | LVIS_SELECTED);
::SetFocus(pList->m_hWnd);
OnNMClickListFilter(NULL, NULL);
}
}
示例3: UpdateMultiple
static void UpdateMultiple(openfile* p)
{
int Count,i;
if (p->Flags & OPENFLAG_SINGLE)
return;
if (p->Win.Smartphone || p->Win.PPCSoftMenu)
{
WinMenuCheck(&p->Win,1,OPENFILE_MORE,p->Multiple);
}
else
{
TBBUTTONINFO Button;
Button.cbSize = sizeof(Button);
Button.dwMask = TBIF_STATE;
Button.fsState = TBSTATE_ENABLED;
if (p->Multiple)
Button.fsState |= TBSTATE_CHECKED;
SendMessage(p->Win.WndTB,TB_SETBUTTONINFO,OPENFILE_MORE,(LPARAM)&Button);
}
p->OwnSelect = 1;
Count = ListView_GetItemCount(p->WndList);
for (i=0;i<Count;++i)
{
int State = 0;
if (!p->Multiple && ListView_GetItemState(p->WndList,i,LVIS_FOCUSED)==LVIS_FOCUSED)
State = LVIS_SELECTED;
ListView_SetItemState(p->WndList,i,State,LVIS_SELECTED);
}
p->OwnSelect = 0;
}
示例4: GetDlgItem
void CPlayListDlg::OnUp(BOOL fVisible)
{
HWND hwndLV = GetDlgItem(m_hWnd, IDC_PLAY_LIST);
SetFocus(hwndLV);
int nCount = ListView_GetItemCount(hwndLV);
if (ListView_GetItemState(hwndLV, 0, LVIS_SELECTED))
return;
for (int i = 1; i < nCount; i++) {
if (ListView_GetItemState(hwndLV, i, LVIS_SELECTED)) {
// ListViewの更新
TCHAR szTitle[MAX_PATH] = {0};
LVITEM li;
memset(&li, 0, sizeof(LVITEM));
li.mask = LVIF_TEXT | LVIF_IMAGE;
li.iItem = i;
li.pszText = szTitle;
li.cchTextMax = MAX_PATH;
ListView_GetItem(hwndLV, &li);
ListView_DeleteItem(hwndLV, i);
li.iItem = i - 1;
ListView_InsertItem(hwndLV, &li);
// プレイリストの更新
m_pParent->UpFile(i);
ListView_SetItemState(hwndLV, i - 1,
LVIS_FOCUSED | LVIS_SELECTED, LVIS_FOCUSED | LVIS_SELECTED);
if (fVisible)
ListView_EnsureVisible(hwndLV, i - 1, FALSE);
}
}
}
示例5: ListView_GetNextItem
/* リスト中で選択されているキーワードを削除する */
void CPropKeyword::Delete_List_KeyWord( HWND hwndDlg, HWND hwndLIST_KEYWORD )
{
int nIndex1;
LV_ITEM lvi;
nIndex1 = ListView_GetNextItem( hwndLIST_KEYWORD, -1, LVNI_ALL | LVNI_SELECTED );
if( -1 == nIndex1 ){
return;
}
lvi.mask = LVIF_PARAM;
lvi.iItem = nIndex1;
lvi.iSubItem = 0;
ListView_GetItem( hwndLIST_KEYWORD, &lvi );
/* n番目のセットのm番目のキーワードを削除 */
m_Common.m_sSpecialKeyword.m_CKeyWordSetMgr.DelKeyWord( m_Common.m_sSpecialKeyword.m_CKeyWordSetMgr.m_nCurrentKeyWordSetIdx, lvi.lParam );
/* ダイアログデータの設定 Keyword 指定キーワードセットの設定 */
SetKeyWordSet( hwndDlg, m_Common.m_sSpecialKeyword.m_CKeyWordSetMgr.m_nCurrentKeyWordSetIdx );
ListView_SetItemState( hwndLIST_KEYWORD, nIndex1, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED );
//キーワード数を表示する。
DispKeywordCount( hwndDlg );
return;
}
示例6: SelectAll
static void SelectAll(openfile* p)
{
LVITEM Item;
int n;
int State;
p->OwnSelect = 1;
for (n=0;n<ListView_GetItemCount(p->WndList);++n)
{
Item.iItem=n;
Item.iSubItem=0;
Item.mask=LVIF_PARAM;
ListView_GetItem(p->WndList,&Item);
State = 0;
if (Item.lParam && (((openitem*)Item.lParam)->Image != IMG_DIR || p->SelectDir))
State = LVIS_SELECTED;
ListView_SetItemState(p->WndList,n,State,LVIS_SELECTED);
}
p->OwnSelect = 0;
}
示例7: 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
//.........这里部分代码省略.........
示例8: RamWatchProc
//.........这里部分代码省略.........
return true;
case IDC_C_WATCH_EDIT:
watchIndex = ListView_GetSelectionMark(GetDlgItem(hDlg,IDC_WATCHLIST));
DialogBoxParam(hAppInst, MAKEINTRESOURCE(IDD_EDITWATCH), hDlg, (DLGPROC) EditWatchProc,(LPARAM) watchIndex);
SetFocus(GetDlgItem(hDlg,IDC_WATCHLIST));
return true;
case IDC_C_WATCH:
rswatches[WatchCount].Address = rswatches[WatchCount].WrongEndian = 0;
rswatches[WatchCount].Size = 'b';
rswatches[WatchCount].Type = 's';
DialogBoxParam(hAppInst, MAKEINTRESOURCE(IDD_EDITWATCH), hDlg, (DLGPROC) EditWatchProc,(LPARAM) WatchCount);
SetFocus(GetDlgItem(hDlg,IDC_WATCHLIST));
return true;
case IDC_C_WATCH_DUPLICATE:
watchIndex = ListView_GetSelectionMark(GetDlgItem(hDlg,IDC_WATCHLIST));
rswatches[WatchCount].Address = rswatches[watchIndex].Address;
rswatches[WatchCount].WrongEndian = rswatches[watchIndex].WrongEndian;
rswatches[WatchCount].Size = rswatches[watchIndex].Size;
rswatches[WatchCount].Type = rswatches[watchIndex].Type;
DialogBoxParam(hAppInst, MAKEINTRESOURCE(IDD_EDITWATCH), hDlg, (DLGPROC) EditWatchProc,(LPARAM) WatchCount);
SetFocus(GetDlgItem(hDlg,IDC_WATCHLIST));
return true;
case IDC_C_WATCH_UP:
{
watchIndex = ListView_GetSelectionMark(GetDlgItem(hDlg,IDC_WATCHLIST));
if (watchIndex == 0 || watchIndex == -1)
return true;
void *tmp = malloc(sizeof(AddressWatcher));
memcpy(tmp,&(rswatches[watchIndex]),sizeof(AddressWatcher));
memcpy(&(rswatches[watchIndex]),&(rswatches[watchIndex - 1]),sizeof(AddressWatcher));
memcpy(&(rswatches[watchIndex - 1]),tmp,sizeof(AddressWatcher));
free(tmp);
ListView_SetSelectionMark(GetDlgItem(hDlg,IDC_WATCHLIST),watchIndex-1);
ListView_SetItemState(GetDlgItem(hDlg,IDC_WATCHLIST),watchIndex-1,LVIS_FOCUSED|LVIS_SELECTED,LVIS_FOCUSED|LVIS_SELECTED);
ListView_SetItemCount(GetDlgItem(hDlg,IDC_WATCHLIST),WatchCount);
RWfileChanged=true;
return true;
}
case IDC_C_WATCH_DOWN:
{
watchIndex = ListView_GetSelectionMark(GetDlgItem(hDlg,IDC_WATCHLIST));
if (watchIndex >= WatchCount - 1 || watchIndex == -1)
return true;
void *tmp = malloc(sizeof(AddressWatcher));
memcpy(tmp,&(rswatches[watchIndex]),sizeof(AddressWatcher));
memcpy(&(rswatches[watchIndex]),&(rswatches[watchIndex + 1]),sizeof(AddressWatcher));
memcpy(&(rswatches[watchIndex + 1]),tmp,sizeof(AddressWatcher));
free(tmp);
ListView_SetSelectionMark(GetDlgItem(hDlg,IDC_WATCHLIST),watchIndex+1);
ListView_SetItemState(GetDlgItem(hDlg,IDC_WATCHLIST),watchIndex+1,LVIS_FOCUSED|LVIS_SELECTED,LVIS_FOCUSED|LVIS_SELECTED);
ListView_SetItemCount(GetDlgItem(hDlg,IDC_WATCHLIST),WatchCount);
RWfileChanged=true;
return true;
}
case RAMMENU_FILE_AUTOLOAD:
{
AutoRWLoad ^= 1;
CheckMenuItem(ramwatchmenu, RAMMENU_FILE_AUTOLOAD, AutoRWLoad ? MF_CHECKED : MF_UNCHECKED);
break;
}
case RAMMENU_FILE_SAVEWINDOW:
{
RWSaveWindowPos ^=1;
CheckMenuItem(ramwatchmenu, RAMMENU_FILE_SAVEWINDOW, RWSaveWindowPos ? MF_CHECKED : MF_UNCHECKED);
break;
}
示例9: NLSDlgProc
///////////////////////////////////////////////////////////////////////////////////////////
// Function: NLSDlgProc
//
// Description: Message-processing function for text tab
//
// Comments:
//
///////////////////////////////////////////////////////////////////////////////////////////
INT_PTR CALLBACK NLSDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
BOOL bProcessedMsg = TRUE;
switch(uMsg)
{
case WM_INITDIALOG:
{
LVCOLUMN lvcCol = {0};
UINT lcid = 0;
LVFINDINFO lvInfo = {0};
int iItem = 0;
// load our own icon
SendMessage(GetParent(hDlg), WM_SETICON, ICON_BIG, (LPARAM) (LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_MAINICON))));
// Create our list column for the listview control
g_hwndList = GetDlgItem(hDlg, IDC_LV_LCID);
g_hDlg = hDlg;
lvcCol.mask = LVCF_TEXT;
LoadString(g_hRes, STR_LANGID, g_tcsTemp, MAX_STR);
lvcCol.pszText = g_tcsTemp;
ListView_InsertColumn(g_hwndList, COLUMN_LANGID, (LV_COLUMN *)&lvcCol);
LoadString(g_hRes, STR_LANG, g_tcsTemp, MAX_STR);
lvcCol.pszText = g_tcsTemp;
ListView_InsertColumn(g_hwndList, COLUMN_LANGUAGE, (LV_COLUMN *)&lvcCol);
LoadString(g_hRes, STR_NLANG, g_tcsTemp, MAX_STR);
lvcCol.pszText = g_tcsTemp;
ListView_InsertColumn(g_hwndList, COLUMN_NATIVELANG, (LV_COLUMN *)&lvcCol);
LoadString(g_hRes, STR_NCOUNTRY, g_tcsTemp, MAX_STR);
lvcCol.pszText = g_tcsTemp;
ListView_InsertColumn(g_hwndList, COLUMN_NATIVECOUNTRYREGION, (LV_COLUMN *)&lvcCol);
LoadString(g_hRes, STR_ACP, g_tcsTemp, MAX_STR);
lvcCol.pszText = g_tcsTemp;
ListView_InsertColumn(g_hwndList, COLUMN_ACP, (LV_COLUMN *)&lvcCol);
LoadString(g_hRes, STR_OEMCP, g_tcsTemp, MAX_STR);
lvcCol.pszText = g_tcsTemp;
ListView_InsertColumn(g_hwndList, COLUMN_OEMCP, (LV_COLUMN *)&lvcCol);
// fill out our listview control with available locales (supported ones).
EnumSystemLocales(EnumLocalesProc, LCID_SUPPORTED);
// Initialize formatting fields related to the selected locale in the listview
InitNLSFields(hDlg, LOCALE_USER_DEFAULT);
// Set the column width of the listview control.
ListView_SetColumnWidth(g_hwndList, COLUMN_LANGID, LVSCW_AUTOSIZE_USEHEADER);
ListView_SetColumnWidth(g_hwndList, COLUMN_LANGUAGE, LVSCW_AUTOSIZE_USEHEADER);
ListView_SetColumnWidth(g_hwndList, COLUMN_NATIVELANG, LVSCW_AUTOSIZE_USEHEADER);
ListView_SetColumnWidth(g_hwndList, COLUMN_NATIVECOUNTRYREGION, LVSCW_AUTOSIZE_USEHEADER);
ListView_SetColumnWidth(g_hwndList, COLUMN_ACP, LVSCW_AUTOSIZE_USEHEADER);
ListView_SetColumnWidth(g_hwndList, COLUMN_OEMCP, LVSCW_AUTOSIZE_USEHEADER);
// Find user's current locale and select that item in the listview control.
lcid = GetUserDefaultLCID();
// Our list has all the LCIDs in 4 digits (0409) whereas GetUserDefaultLCID returs (409).
if (lcid < 0x1000)
{
_sntprintf(g_tcsTemp,MAX_STR,TEXT("0%x"), lcid);
}
else
{
_sntprintf(g_tcsTemp,MAX_STR,TEXT("%x"), lcid);
}
lvInfo.flags = LVFI_STRING;
lvInfo.psz = g_tcsTemp;
iItem = ListView_FindItem(g_hwndList, 0, &lvInfo);
ListView_SetItemState (g_hwndList, iItem, LVIS_FOCUSED | LVIS_SELECTED, 0x000F);
ListView_EnsureVisible(g_hwndList, iItem, FALSE);
// Set some of the extended styles of our list view (cool reports ;-)
ListView_SetExtendedListViewStyle(g_hwndList, LVS_EX_FULLROWSELECT | LVS_EX_HEADERDRAGDROP | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE);
}
break;
case WM_NOTIFY:
switch (((NMHDR *)lParam)->code)
{
case LVN_COLUMNCLICK:
{
NM_LISTVIEW nmv;
static int iLastSort = COLUMN_LANGID;
LPARAM lSortParam = -1;
//.........这里部分代码省略.........
示例10: switch
//.........这里部分代码省略.........
RGB(255,0,255));
}
::SelectObject(hdcMem,hbmOld);
::DeleteDC(hdcMem);
::EndPaint(hDlg,&ps);
}
return TRUE;
case WM_LBUTTONDOWN:
{
POINT pt;
pt.x=GET_X_LPARAM(lParam);
pt.y=GET_Y_LPARAM(lParam);
if (m_hbmSelButtons!=NULL
&& ::PtInRect(&m_ImageRect,pt)) {
const CController *pController=GetCurController();
if (pController==NULL)
return TRUE;
const int NumButtons=pController->NumButtons();
for (int i=0;i<NumButtons;i++) {
CController::ButtonInfo Button;
RECT rc;
pController->GetButtonInfo(i,&Button);
rc.left=m_ImageRect.left+Button.ImageButtonRect.Left;
rc.top=m_ImageRect.top+Button.ImageButtonRect.Top;
rc.right=rc.left+Button.ImageButtonRect.Width;
rc.bottom=rc.top+Button.ImageButtonRect.Height;
if (::PtInRect(&rc,pt)) {
HWND hwndList=::GetDlgItem(hDlg,IDC_CONTROLLER_ASSIGN);
ListView_SetItemState(hwndList,i,
LVIS_FOCUSED | LVIS_SELECTED,
LVIS_FOCUSED | LVIS_SELECTED);
ListView_EnsureVisible(hwndList,i,FALSE);
::SetFocus(hwndList);
break;
}
}
}
}
return TRUE;
case WM_SETCURSOR:
if (LOWORD(lParam)==HTCLIENT) {
if (m_hbmSelButtons!=NULL) {
POINT pt;
::GetCursorPos(&pt);
::ScreenToClient(hDlg,&pt);
if (::PtInRect(&m_ImageRect,pt)) {
const CController *pController=GetCurController();
if (pController==NULL)
break;
const int NumButtons=pController->NumButtons();
for (int i=0;i<NumButtons;i++) {
CController::ButtonInfo Button;
RECT rc;
pController->GetButtonInfo(i,&Button);
rc.left=m_ImageRect.left+Button.ImageButtonRect.Left;
rc.top=m_ImageRect.top+Button.ImageButtonRect.Top;
rc.right=rc.left+Button.ImageButtonRect.Width;
示例11: win32ui_pokemem_proc
INT_PTR CALLBACK
win32ui_pokemem_proc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
switch( msg ) {
case WM_INITDIALOG:
initialize_dialog( hWnd );
return TRUE;
case WM_COMMAND:
switch( LOWORD( wParam ) ) {
case IDOK:
pokemem_update_list();
EndDialog( hWnd, wParam );
return 0;
case IDCLOSE:
case IDCANCEL:
EndDialog( hWnd, wParam );
return 0;
case IDC_PM_ADD:
pokemem_add_custom_poke();
return 0;
}
break;
case WM_CLOSE:
EndDialog( hWnd, wParam );
return 0;
case WM_NOTIFY:
if( LOWORD( wParam ) == IDC_PM_LIST ) {
NMHDR *nmhdr = (NMHDR *) lParam;
LPNMLISTVIEW lpnmitem;
switch( nmhdr->code ) {
case LVN_ITEMCHANGING:
{
lpnmitem = (LPNMLISTVIEW) lParam;
if( lpnmitem->uChanged & LVIF_STATE ) {
unsigned int new_state, old_state;
new_state = ( lpnmitem->uNewState & LVIS_STATEIMAGEMASK ) >> 12;
old_state = ( lpnmitem->uOldState & LVIS_STATEIMAGEMASK ) >> 12;
trainer_t *trainer = (trainer_t *)lpnmitem->lParam;
/* Prevent the check of disabled trainers */
if( new_state != old_state && trainer->disabled )
{
SetWindowLongPtr( hWnd, DWLP_MSGRESULT, TRUE );
return TRUE;
}
}
break;
}
case LVN_ITEMCHANGED:
{
lpnmitem = (LPNMLISTVIEW) lParam;
if( lpnmitem->uChanged & LVIF_STATE && lpnmitem->iItem >= 0 ) {
unsigned int new_state, old_state;
new_state = ( lpnmitem->uNewState & LVIS_STATEIMAGEMASK ) >> 12;
old_state = ( lpnmitem->uOldState & LVIS_STATEIMAGEMASK ) >> 12;
trainer_t *trainer = (trainer_t *)lpnmitem->lParam;
/* Trainer checked, ask for custom value if needed */
if( new_state != old_state && new_state == 2 && !trainer->active
&& trainer->ask_value ) {
ListView_SetItemState( nmhdr->hwndFrom, lpnmitem->iItem,
LVIS_SELECTED, LVIS_SELECTED );
create_custom_edit( nmhdr->hwndFrom, lpnmitem->iItem, 1 );
}
break;
}
}
}
示例12: NewFileProc
long APIENTRY NewFileProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM
lParam)
{
switch (message)
{
case WM_INITDIALOG:
if (!CreateNewFileData(hwnd))
{
EndDialog(hwnd, 1);
}
else
{
CenterWindow(hwnd);
}
return 1;
case WM_NOTIFY:
if (((LPNMHDR)lParam)->code == NM_CUSTOMDRAW)
{
SetWindowLong(hwnd, DWL_MSGRESULT, CustomDrawNewFile(hwnd, (LPNMLVCUSTOMDRAW)lParam));
return TRUE;
}
else if (((LPNMHDR)lParam)->code == LVN_KEYDOWN)
{
switch (((LPNMLVKEYDOWN)lParam)->wVKey)
{
case VK_INSERT:
if (GetKeyState(VK_CONTROL) & 0x80000000)
{
HWND hwndLV = GetDlgItem(hwnd, IDC_LVNEWFILE);
ListView_SetSelectionMark(hwndLV, -1);
}
else
{
HWND hwndLV = GetDlgItem(hwnd, IDC_LVNEWFILE);
int i = ListView_GetSelectionMark(hwndLV);
ListView_SetSelectionMark(hwndLV, i);
ListView_SetItemState(hwndLV, i, LVIS_SELECTED, LVIS_SELECTED);
}
break;
}
}
return 0;
case WM_COMMAND:
switch (wParam &0xffff)
{
case IDOK:
if (ParseNewFileData(hwnd))
EndDialog(hwnd, IDOK);
break;
case IDCANCEL:
EndDialog(hwnd, IDCANCEL);
break;
case IDHELP:
ContextHelp(IDH_NEW_FILE_DIALOG);
break;
}
break;
case WM_CLOSE:
PostMessage(hwnd, WM_COMMAND, IDCANCEL, 0);
break;
}
return 0;
}
示例13: ListView_SetItemState
void HISTORY::redrawList()
{
ListView_SetItemState(hwndHistoryList, historyCursorPos, LVIS_FOCUSED|LVIS_SELECTED, LVIS_FOCUSED|LVIS_SELECTED);
ListView_EnsureVisible(hwndHistoryList, historyCursorPos, FALSE);
InvalidateRect(hwndHistoryList, 0, FALSE);
}
示例14: DlgProc_TransportLayer
//.........这里部分代码省略.........
Dbg(LoadString(g_hInst, DBG_Deleting_DLL, szQuestion, sizeof(szQuestion)));
wsprintf(szMsg, szQuestion, szTransName);
}
char szTitle[MAX_MSG_TXT];
Dbg(LoadString(g_hInst, DLG_Deleting_DLL_Title, szTitle, sizeof(szTitle)));
strcat(szTitle, "'");
strcat(szTitle, szTransName);
strcat(szTitle, "'");
if (MessageBox(hwndDlg, szMsg, szTitle, MB_OKCANCEL | MB_TASKMODAL) == IDOK) {
// Did we erase the selected transport layer
if (pszSelectedTL && !strcmp(szTransName, pszSelectedTL)) {
// Erased
FREE_STR(pszSelectedTL);
}
// Remove the deleted TL from the reg list.
{
TListEntry<CIndiv_TL_WKSP *> * pContEntry =
g_pCCopyOf_All_TLs_WrkSpc->
m_listConts.Find(szTransName, WKSP_Generic_CmpRegName);
Assert(pContEntry);
delete pContEntry->m_tData;
delete pContEntry;
}
Dbg(ListView_DeleteItem(hwndList, nCurSel));
// Select the first item, make sure something is always selected.
ListView_SetItemState(hwndList, 0, LVIS_SELECTED | LVIS_FOCUSED, 0x000F);
BOOL bEmpty = ListView_GetItemCount(hwndList) <= 0;
EnableWindow(hwndEdit, !bEmpty);
EnableWindow(hwndSelect, !bEmpty);
EnableWindow(hwndDelete, !bEmpty);
SetDlgItemText(hwndDlg, IDC_STEXT_SELECT, pszSelectedTL);
}
}
return FALSE;
case IDC_BUT_EDIT:
if (BN_CLICKED == wNotifyCode) {
int nCurSel = ListView_GetNextItem(hwndList, -1, LVNI_SELECTED);
Assert(-1 != nCurSel);
char szTransName[MAX_MSG_TXT]; // Transport name
ListView_GetItemText(hwndList, nCurSel, 0, szTransName, sizeof(szTransName));
TListEntry<CIndiv_TL_WKSP *> * pContEntry =
g_pCCopyOf_All_TLs_WrkSpc->
m_listConts.Find(szTransName, WKSP_Generic_CmpRegName);
if (DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_DLG_TRANSPORTLAYER), hwndDlg,
(DLGPROC)EditTransportLayersDlgProc, (LPARAM)pContEntry->m_tData)) {
// Data has been changed, repopulate the list.
AddDataToList(hwndDlg, g_pCCopyOf_All_TLs_WrkSpc);
}
BOOL bEmpty = ListView_GetItemCount(hwndList) <= 0;
EnableWindow(hwndEdit, !bEmpty);
示例15: DlgProcConnectionNotifyOpts
//.........这里部分代码省略.........
//fill exceptions list
fillExceptionsListView(hwndDlg);
}
break;
case WM_COMMAND://user changed something, so get changes to variables
PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
switch(LOWORD(wParam)) {
case IDC_INTERVAL: settingInterval =GetDlgItemInt(hwndDlg, IDC_INTERVAL, NULL, FALSE); break;
case IDC_INTERVAL1: settingInterval1 =GetDlgItemInt(hwndDlg, IDC_INTERVAL1, NULL, TRUE); break;
case IDC_RESOLVEIP: settingResolveIp=(BYTE) IsDlgButtonChecked(hwndDlg, IDC_RESOLVEIP); break;
case ID_CHK_DEFAULTACTION: settingDefaultAction=(BYTE) IsDlgButtonChecked(hwndDlg, ID_CHK_DEFAULTACTION); break;
case ID_ADD:
{
struct CONNECTION *cur=(struct CONNECTION *)mir_alloc(sizeof(struct CONNECTION));
memset(cur,0,sizeof(struct CONNECTION));
cur->intExtPort=-1;
cur->intIntPort=-1;
cur->Pid=0;
cur->PName[0]='*';
cur->strExtIp[0]='*';
cur->strIntIp[0]='*';
if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_FILTER_DIALOG), hwndDlg, FilterEditProc, (LPARAM)cur)==IDCANCEL) {
mir_free(cur);
cur = NULL;
}
else {
cur->next = connExceptionsTmp;
connExceptionsTmp = cur;
}
fillExceptionsListView(hwndDlg);
ListView_SetItemState(GetDlgItem(hwndDlg,IDC_LIST_EXCEPTIONS),0,LVNI_FOCUSED|LVIS_SELECTED , LVNI_FOCUSED|LVIS_SELECTED );
SetFocus(GetDlgItem(hwndDlg,IDC_LIST_EXCEPTIONS));
}
break;
case ID_DELETE:
{
int pos,pos1;
struct CONNECTION *cur = connExceptionsTmp, *pre = NULL;
pos=(int)ListView_GetNextItem(GetDlgItem(hwndDlg, IDC_LIST_EXCEPTIONS),-1,LVNI_FOCUSED );
if (pos==-1)break;
pos1=pos;
while(pos--)
{
pre=cur;
cur=cur->next;
}
if (pre==NULL)
connExceptionsTmp=connExceptionsTmp->next;
else
(pre)->next=cur->next;
mir_free(cur);
fillExceptionsListView(hwndDlg);
ListView_SetItemState(GetDlgItem(hwndDlg,IDC_LIST_EXCEPTIONS),pos1,LVNI_FOCUSED|LVIS_SELECTED , LVNI_FOCUSED|LVIS_SELECTED );
SetFocus(GetDlgItem(hwndDlg,IDC_LIST_EXCEPTIONS));
break;
}
case ID_UP:
{
int pos,pos1;
struct CONNECTION *cur=NULL,*pre=NULL,*prepre=NULL;