本文整理汇总了C++中MAKEWPARAM函数的典型用法代码示例。如果您正苦于以下问题:C++ MAKEWPARAM函数的具体用法?C++ MAKEWPARAM怎么用?C++ MAKEWPARAM使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MAKEWPARAM函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RulesDlgProc
BOOL CALLBACK RulesDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
int i, iCount;
char str[256];
static HWND hWndList;
LV_COLUMN lvC;
LV_ITEM lvI;
LV_DISPINFO *pItem;
char tempString1[256], tempString2[256];
switch (uMsg)
{
case WM_INITDIALOG:
hWndList = GetDlgItem(hDlg, IDC_LIST);
ListView_SetExtendedListViewStyleEx(hWndList, LVS_EX_GRIDLINES, LVS_EX_GRIDLINES );
ListView_SetExtendedListViewStyleEx(hWndList, LVS_EX_CHECKBOXES, LVS_EX_CHECKBOXES );
lvC.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT;
lvC.cx = 525;
lvC.pszText = "Rule";
lvC.iSubItem = 0;
lvC.fmt = LVCFMT_LEFT;
ListView_InsertColumn(hWndList, 0, &lvC);
PopulateRulesList(hWndList, 0);
SendDlgItemMessage(hDlg, IDC_RULE, EM_SETLIMITTEXT, (WPARAM) 255, 0);
if (bEnableFilter == TRUE)
CheckRadioButton(hDlg, IDC_RADIO_FILTER, IDC_RADIO_NOFILTER, IDC_RADIO_FILTER);
else
{
CheckRadioButton(hDlg, IDC_RADIO_FILTER, IDC_RADIO_NOFILTER, IDC_RADIO_NOFILTER);
SendMessage(hDlg, WM_COMMAND, MAKEWPARAM(IDC_RADIO_NOFILTER, 0), 0);
}
RestoreWindowPosition(hDlg);
return TRUE;
case WM_NOTIFY:
switch (((LPNMHDR) lParam)->code)
{
case LVN_ENDLABELEDIT:
pItem = (LV_DISPINFO *) lParam;
ListView_SetItemText(hWndList, pItem->item.iItem, 0, pItem->item.pszText);
return TRUE;
}
break;
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDC_ADD:
GetDlgItemText(hDlg, IDC_RULE, str, 255);
iCount = getnumtokens(str);
if ((iCount != 8) && (iCount != 3))
{
MessageBox(hDlg, "Incorrect number of parameters, please correct rule.", APP_NAME, MB_ICONEXCLAMATION | MB_OK);
return TRUE;
}
lvI.mask = LVIF_TEXT;
lvI.iSubItem = 0;
lvI.cchTextMax = 255;
i = ListView_GetItemCount(hWndList);
lvI.iItem = i;
lvI.pszText = str;
ListView_InsertItem(hWndList, &lvI);
SetDlgItemText(hDlg, IDC_RULE, "");
ListView_SetCheckState(hWndList, i, TRUE);
ListView_EnsureVisible(hWndList, i, FALSE);
return TRUE;
case IDC_DELETE:
lvI.mask = LVIF_STATE;
lvI.stateMask =LVIS_SELECTED;
lvI.iSubItem = 0;
iCount = ListView_GetItemCount( hWndList );
for( i = 0; i < iCount; i++ )
{
lvI.iItem = i;
ListView_GetItem(hWndList, &lvI);
if( lvI.state == LVIS_SELECTED )
{
ListView_DeleteItem(hWndList, i);
--iCount; --i;
}
}
return TRUE;
//.........这里部分代码省略.........
示例2: ResStr
//.........这里部分代码省略.........
CCheckListBox::OnRButtonDown(nFlags, point);
CMenu m;
m.CreatePopupMenu();
enum {
ENABLE_ALL = 1,
DISABLE_ALL,
ENABLE_FFMPEG,
DISABLE_FFMPEG,
ENABLE_DXVA,
DISABLE_DXVA,
};
int totalFilters = 0, totalChecked = 0;
for (int i = 0; i < FILTER_TYPE_NB; i++) {
totalFilters += m_nbFiltersPerType[i];
totalChecked += m_nbChecked[i];
}
UINT state = (totalChecked != totalFilters) ? MF_ENABLED : MF_GRAYED;
m.AppendMenu(MF_STRING | state, ENABLE_ALL, ResStr(IDS_ENABLE_ALL_FILTERS));
state = (totalChecked != 0) ? MF_ENABLED : MF_GRAYED;
m.AppendMenu(MF_STRING | state, DISABLE_ALL, ResStr(IDS_DISABLE_ALL_FILTERS));
if (m_n == 1) {
m.AppendMenu(MF_SEPARATOR);
state = (m_nbChecked[FFMPEG_DECODER] != m_nbFiltersPerType[FFMPEG_DECODER]) ? MF_ENABLED : MF_GRAYED;
m.AppendMenu(MF_STRING | state, ENABLE_FFMPEG, ResStr(IDS_ENABLE_FFMPEG_FILTERS));
state = (m_nbChecked[FFMPEG_DECODER] != 0) ? MF_ENABLED : MF_GRAYED;
m.AppendMenu(MF_STRING | state, DISABLE_FFMPEG, ResStr(IDS_DISABLE_FFMPEG_FILTERS));
m.AppendMenu(MF_SEPARATOR);
state = (m_nbChecked[DXVA_DECODER] != m_nbFiltersPerType[DXVA_DECODER]) ? MF_ENABLED : MF_GRAYED;
m.AppendMenu(MF_STRING | state, ENABLE_DXVA, ResStr(IDS_ENABLE_DXVA_FILTERS));
state = (m_nbChecked[DXVA_DECODER] != 0) ? MF_ENABLED : MF_GRAYED;
m.AppendMenu(MF_STRING | state, DISABLE_DXVA, ResStr(IDS_DISABLE_DXVA_FILTERS));
}
CPoint p = point;
::MapWindowPoints(m_hWnd, HWND_DESKTOP, &p, 1);
UINT id = m.TrackPopupMenu(TPM_LEFTBUTTON|TPM_RETURNCMD, p.x, p.y, this);
if (id == 0) {
return;
}
int index = 0;
for (int i = 0; i < countof(s_filters); i++) {
switch (s_filters[i].type) {
case SOURCE_FILTER:
if (m_n == 1) {
continue;
}
break;
case DECODER:
case DXVA_DECODER:
case FFMPEG_DECODER:
if (m_n == 0) {
continue;
}
break;
default:
continue;
}
switch (id) {
case ENABLE_ALL:
SetCheck(index, TRUE);
break;
case DISABLE_ALL:
SetCheck(index, FALSE);
break;
case ENABLE_FFMPEG:
if (s_filters[i].type == FFMPEG_DECODER) {
SetCheck(index, TRUE);
}
break;
case DISABLE_FFMPEG:
if (s_filters[i].type == FFMPEG_DECODER) {
SetCheck(index, FALSE);
}
break;
case ENABLE_DXVA:
if (s_filters[i].type == DXVA_DECODER) {
SetCheck(index, TRUE);
}
break;
case DISABLE_DXVA:
if (s_filters[i].type == DXVA_DECODER) {
SetCheck(index, FALSE);
}
break;
}
index++;
}
GetParent()->SendMessage(WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(), CLBN_CHKCHANGE), (LPARAM)m_hWnd);
}
示例3: DlgProcRecvFile
//.........这里部分代码省略.........
CONTACTINFO ci = { 0 };
ci.cbSize = sizeof(ci);
ci.hContact = dat->hContact;
ci.szProto = szProto;
ci.dwFlag = CNF_UNIQUEID;
if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) {
switch (ci.type) {
case CNFT_ASCIIZ:
hasName = 1;
mir_snprintf(buf, SIZEOF(buf), "%s", ci.pszVal);
mir_free(ci.pszVal);
break;
case CNFT_DWORD:
hasName = 1;
mir_snprintf(buf, SIZEOF(buf), "%u", ci.dVal);
break;
}
}
if (hasName)
SetDlgItemTextA(hwndDlg, IDC_NAME, buf);
else
SetDlgItemText(hwndDlg, IDC_NAME, contactName);
}
if (db_get_b(dat->hContact, "CList", "NotOnList", 0)) {
RECT rcBtn1, rcBtn2, rcDateCtrl;
GetWindowRect(GetDlgItem(hwndDlg, IDC_ADD), &rcBtn1);
GetWindowRect(GetDlgItem(hwndDlg, IDC_USERMENU), &rcBtn2);
GetWindowRect(GetDlgItem(hwndDlg, IDC_DATE), &rcDateCtrl);
SetWindowPos(GetDlgItem(hwndDlg, IDC_DATE), 0, 0, 0, rcDateCtrl.right - rcDateCtrl.left - (rcBtn2.left - rcBtn1.left), rcDateCtrl.bottom - rcDateCtrl.top, SWP_NOZORDER | SWP_NOMOVE);
}
else if (db_get_b(NULL, "SRFile", "AutoAccept", 0)) {
//don't check auto-min here to fix BUG#647620
PostMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDOK, BN_CLICKED), (LPARAM)GetDlgItem(hwndDlg, IDOK));
}
if (!db_get_b(dat->hContact, "CList", "NotOnList", 0))
ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), SW_HIDE);
}
return TRUE;
case WM_MEASUREITEM:
return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam);
case WM_DRAWITEM:
{
LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam;
if (dis->hwndItem == GetDlgItem(hwndDlg, IDC_PROTOCOL)) {
char *szProto = GetContactProto(dat->hContact);
if (szProto) {
HICON hIcon = (HICON)CallProtoService(szProto, PS_LOADICON, PLI_PROTOCOL|PLIF_SMALL, 0);
if (hIcon) {
DrawIconEx(dis->hDC, dis->rcItem.left, dis->rcItem.top, hIcon, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, NULL, DI_NORMAL);
DestroyIcon(hIcon);
} } } }
return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
case WM_COMMAND:
if (CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM)dat->hContact))
break;
switch (LOWORD(wParam)) {
case IDC_FILEDIRBROWSE:
{
TCHAR szDirName[MAX_PATH], szExistingDirName[MAX_PATH];
GetDlgItemText(hwndDlg, IDC_FILEDIR, szDirName, SIZEOF(szDirName));
示例4: EventAreaWndProc
LRESULT CALLBACK EventAreaWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg) {
case WM_CREATE:
hwndEventFrame = hwnd;
return FALSE;
case WM_MEASUREITEM:
{
MEASUREITEMSTRUCT *lpi = (LPMEASUREITEMSTRUCT) lParam;
MENUITEMINFOA mii = {0};
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_DATA | MIIM_ID;
if (GetMenuItemInfoA(cfg::dat.hMenuNotify, lpi->itemID, FALSE, &mii) != 0) {
if (mii.dwItemData == lpi->itemData) {
lpi->itemWidth = 8 + 16;
lpi->itemHeight = 0;
return TRUE;
}
}
break;
}
case WM_NCCALCSIZE:
return FrameNCCalcSize(hwnd, DefWindowProc, wParam, lParam,
wndFrameEventArea ? wndFrameEventArea->TitleBar.ShowTitleBar : 0);
case WM_NCPAINT:
return FrameNCPaint(hwnd, DefWindowProc, wParam, lParam,
wndFrameEventArea ? wndFrameEventArea->TitleBar.ShowTitleBar : 0);
case WM_DRAWITEM:
{
LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT) lParam;
if (dis->hwndItem == (HWND) cfg::dat.hMenuNotify) {
MENUITEMINFOA mii = {0};
struct NotifyMenuItemExData *nmi = 0;
int iIcon;
HICON hIcon;
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_DATA;
if (GetMenuItemInfoA(cfg::dat.hMenuNotify, (UINT) dis->itemID, FALSE, &mii) != 0) {
nmi = (struct NotifyMenuItemExData *) mii.dwItemData;
if (nmi) {
iIcon = CallService(MS_CLIST_GETCONTACTICON, (WPARAM) nmi->hContact, 0);
hIcon = ImageList_GetIcon(hCListImages, iIcon, ILD_NORMAL);
pcli->pfnDrawMenuItem(dis, hIcon, nmi->hIcon);
return TRUE;
}
}
}
break;
}
case WM_LBUTTONUP:
if(cfg::dat.bEventAreaEnabled)
SendMessage(hwnd, WM_COMMAND, MAKEWPARAM(IDC_NOTIFYBUTTON, 0), 0);
break;
case WM_COMMAND:
if(LOWORD(wParam) == IDC_NOTIFYBUTTON) {
int iSelection;
MENUITEMINFO mii = {0};
POINT pt;
struct NotifyMenuItemExData *nmi = 0;
int iCount = GetMenuItemCount(cfg::dat.hMenuNotify);
BOOL result;
GetCursorPos(&pt);
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_DATA;
if (iCount > 1)
iSelection = TrackPopupMenu(cfg::dat.hMenuNotify, TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, NULL);
else
iSelection = GetMenuItemID(cfg::dat.hMenuNotify, 0);
result = GetMenuItemInfo(cfg::dat.hMenuNotify, (UINT) iSelection, FALSE, &mii);
if (result != 0) {
nmi = (struct NotifyMenuItemExData *) mii.dwItemData;
if (nmi) {
CLISTEVENT *cle = MyGetEvent(iSelection);
if (cle) {
CLISTEVENT *cle1 = NULL;
CallService(cle->pszService, (WPARAM) NULL, (LPARAM) cle);
// re-obtain the pointer, it may already be invalid/point to another event if the
// event we're interested in was removed by the service (nasty one...)
cle1 = MyGetEvent(iSelection);
if (cle1 != NULL)
CallService(MS_CLIST_REMOVEEVENT, (WPARAM) cle->hContact, (LPARAM) cle->hDbEvent);
}
}
}
break;
}
break;
case WM_ERASEBKGND:
return TRUE;
case WM_PAINT:
{
PAINTSTRUCT ps;
RECT rc, rcClient;
//.........这里部分代码省略.........
示例5: switch
//.........这里部分代码省略.........
case IDC_ROOM:
switch (HIWORD(wParam)) {
case CBN_DROPDOWN:
if (!SendDlgItemMessage(m_hwnd, IDC_ROOM, CB_GETCOUNT, 0, 0)) {
int iqid = GetWindowLongPtr(GetDlgItem(m_hwnd, IDC_ROOM), GWLP_USERDATA);
if (iqid) {
m_proto->m_iqManager.ExpireIq(iqid);
SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_ROOM), GWLP_USERDATA, 0);
}
SendDlgItemMessage(m_hwnd, IDC_ROOM, CB_RESETCONTENT, 0, 0);
int len = GetWindowTextLength(GetDlgItem(m_hwnd, IDC_SERVER)) + 1;
TCHAR *server = (TCHAR*)_alloca(len * sizeof(TCHAR));
GetDlgItemText(m_hwnd, IDC_SERVER, server, len);
if (*server) {
sttRoomListAppend(GetDlgItem(m_hwnd, IDC_ROOM), RoomInfo::ROOM_WAIT, TranslateT("Loading..."), TranslateT("Please wait for room list to download."), _T(""));
CJabberIqInfo *pInfo = m_proto->AddIQ(&CJabberProto::OnIqResultDiscovery, JABBER_IQ_TYPE_GET, server, 0, -1, (void*)GetDlgItem(m_hwnd, IDC_ROOM));
pInfo->SetTimeout(30000);
XmlNodeIq iq(pInfo);
iq << XQUERY(JABBER_FEAT_DISCO_ITEMS);
m_proto->m_ThreadInfo->send(iq);
SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_ROOM), GWLP_USERDATA, pInfo->GetIqId());
}
else
sttRoomListAppend(GetDlgItem(m_hwnd, IDC_ROOM), RoomInfo::ROOM_FAIL,
TranslateT("Jabber Error"),
TranslateT("Please specify group chat directory first."),
_T(""));
}
break;
}
break;
case IDC_BOOKMARKS:
{
HMENU hMenu = CreatePopupMenu();
LISTFOREACH(i, m_proto, LIST_BOOKMARK)
{
JABBER_LIST_ITEM *item = 0;
if (item = m_proto->ListGetItemPtrFromIndex(i))
if (!mir_tstrcmp(item->type, _T("conference")))
AppendMenu(hMenu, MF_STRING, (UINT_PTR)item, item->name);
}
AppendMenu(hMenu, MF_SEPARATOR, 0, NULL);
AppendMenu(hMenu, MF_STRING, (UINT_PTR)-1, TranslateT("Bookmarks..."));
AppendMenu(hMenu, MF_STRING, (UINT_PTR)0, TranslateT("Cancel"));
RECT rc; GetWindowRect(GetDlgItem(m_hwnd, IDC_BOOKMARKS), &rc);
CheckDlgButton(m_hwnd, IDC_BOOKMARKS, BST_CHECKED);
int res = TrackPopupMenu(hMenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, m_hwnd, NULL);
CheckDlgButton(m_hwnd, IDC_BOOKMARKS, BST_UNCHECKED);
DestroyMenu(hMenu);
if (res == -1)
m_proto->OnMenuHandleBookmarks(0, 0);
else if (res) {
JABBER_LIST_ITEM *item = (JABBER_LIST_ITEM *)res;
TCHAR *room = NEWTSTR_ALLOCA(item->jid);
if (room) {
TCHAR *server = _tcschr(room, _T('@'));
if (server) {
*server++ = 0;
SendMessage(m_hwnd, WM_COMMAND, MAKEWPARAM(IDC_SERVER, CBN_EDITCHANGE), (LPARAM)GetDlgItem(m_hwnd, IDC_SERVER));
SetDlgItemText(m_hwnd, IDC_SERVER, server);
SetDlgItemText(m_hwnd, IDC_ROOM, room);
SetDlgItemText(m_hwnd, IDC_NICK, item->nick);
SetDlgItemText(m_hwnd, IDC_PASSWORD, item->password);
}
}
}
}
break;
case IDC_RECENT1:
case IDC_RECENT2:
case IDC_RECENT3:
case IDC_RECENT4:
case IDC_RECENT5:
JabberGcRecentInfo info(m_proto, LOWORD(wParam) - IDC_RECENT1);
info.fillForm(m_hwnd);
if (GetAsyncKeyState(VK_CONTROL))
break;
OnBtnOk(NULL);
Close();
}
break;
case WM_JABBER_CHECK_ONLINE:
if (!m_proto->m_bJabberOnline)
EndDialog(m_hwnd, 0);
break;
}
示例6: DefWindowProcA
return 0;
}
defwndproc_counter++;
ret = DefWindowProcA(hwnd, message, wParam, lParam);
defwndproc_counter--;
return ret;
}
static const struct message setfocus_seq[] =
{
{ WM_IME_SETCONTEXT, sent|wparam|optional, 1 },
{ WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 },
{ WM_SETFOCUS, sent|wparam },
{ WM_COMMAND, sent|wparam|parent, MAKEWPARAM(ID_BUTTON, BN_SETFOCUS) },
{ WM_APP, sent|wparam|lparam },
{ WM_PAINT, sent },
{ 0 }
};
static const struct message killfocus_seq[] =
{
{ WM_KILLFOCUS, sent|wparam, 0 },
{ WM_COMMAND, sent|wparam|parent, MAKEWPARAM(ID_BUTTON, BN_KILLFOCUS) },
{ WM_IME_SETCONTEXT, sent|wparam|optional, 0 },
{ WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 1 },
{ WM_APP, sent|wparam|lparam, 0, 0 },
{ WM_PAINT, sent },
{ 0 }
};
示例7: ContactListSubclassProc
//.........这里部分代码省略.........
else {
TreeView_SetItemState(hWnd, hItem, 0, TVIS_SELECTED);
dat->SelectedItems.RemoveElem(nIndex);
}
dat->SelectGroups(hItem, nIndex == -1);
NMCLIST nm;
nm.hdr.code = MCLN_SELCHANGED;
nm.hdr.hwndFrom = hWnd;
nm.hdr.idFrom = GetDlgCtrlID(hWnd);
nm.OldSelection = &OldSelection;
nm.NewSelection = &dat->SelectedItems;
SendMessage(GetParent(hWnd), WM_NOTIFY, 0, (LPARAM)&nm);
return 0;
}
// if it was a click on the selected item and there's need to do something in this case, then send SELCHANGED notification by ourselves, as the tree control doesn't do anything
if (hItem == TreeView_GetSelection(hWnd) && (dat->SelectedItems.GetSize() != 1 || (dat->SelectedItems.GetSize() == 1 && dat->SelectedItems[0] != hItem))) {
TreeView_SetItemState(hWnd, hItem, TVIS_SELECTED, TVIS_SELECTED);
NMTREEVIEW nm = { 0 };
nm.hdr.code = TVN_SELCHANGED;
nm.hdr.hwndFrom = hWnd;
nm.hdr.idFrom = GetDlgCtrlID(hWnd);
nm.itemOld.hItem = TreeView_GetSelection(hWnd);
nm.itemOld.mask = TVIF_HANDLE | TVIF_STATE | TVIF_PARAM;
TreeView_GetItem(hWnd, &nm.itemOld);
nm.itemNew = nm.itemOld;
SendMessage(GetParent(hWnd), WM_NOTIFY, 0, (LPARAM)&nm);
}
}
}
break;
case WM_SETFOCUS:
case WM_KILLFOCUS:
for (int i = 0; i < dat->SelectedItems.GetSize(); i++) {
RECT rc;
if (TreeView_GetItemRect(hWnd, dat->SelectedItems[i], &rc, false))
InvalidateRect(hWnd, &rc, false);
}
break;
case WM_SIZE:
case WM_HSCROLL:
InvalidateRect(hWnd, NULL, false);
break;
case WM_MEASUREITEM:
if (!wParam) // if the message was sent by a menu
return Menu_MeasureItem((LPMEASUREITEMSTRUCT)lParam);
break;
case WM_DRAWITEM:
if (!wParam) // if the message was sent by a menu
return Menu_DrawItem((LPDRAWITEMSTRUCT)lParam);
break;
case WM_CONTEXTMENU:
{
POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
HTREEITEM hItem = NULL;
if (pt.x == -1 && pt.y == -1) {
if (dat->SelectedItems.GetSize() == 1) {
hItem = dat->SelectedItems[0];
TreeView_EnsureVisible(hWnd, hItem);
RECT rc;
TreeView_GetItemRect(hWnd, hItem, &rc, true);
pt.x = rc.left;
pt.y = rc.bottom;
}
}
else {
DWORD hitFlags;
ScreenToClient(hWnd, &pt);
hItem = dat->HitTest(&pt, &hitFlags);
if (!(hitFlags & MCLCHT_ONITEM))
hItem = NULL;
}
if (hItem) {
MCONTACT hContact = dat->GetItemData(hItem).hContact;
if (IsHContactContact(hContact)) {
HMENU hMenu = Menu_BuildContactMenu(hContact);
if (hMenu) {
ClientToScreen(hWnd, &pt);
CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, hWnd, NULL), MPCF_CONTACTMENU), hContact);
DestroyMenu(hMenu);
return 0;
}
}
}
}
break;
case WM_DESTROY:
if (dat->ExtraImageList)
ImageList_Destroy(dat->ExtraImageList);
dat->SelectedItems.RemoveAll();
dat->Items.RemoveAll();
break;
}
return CallWindowProc(dat->OrigTreeViewProc, hWnd, Msg, wParam, lParam);
}
示例8: GetOwner
void CXTPEditListBox::EditListItem(BOOL bNewItem)
{
if (!m_bEnableEdit)
return;
CWnd* pOwner = GetOwner();
ASSERT(pOwner);
if (!pOwner)
return;
// Turn off redraw until we are ready to
// create the edit field.
SetRedraw(FALSE);
// flush the item text string.
m_strItemText = m_strItemDefaultText;
// if this is a new item, add a temporary string
// to the list box and set the selection to it. This
// is where the in place edit box will appear.
if (bNewItem || GetCurSel() == LB_ERR)
{
pOwner->SendMessage(WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(),
LBN_XTP_PRENEWITEM), (LPARAM)m_hWnd);
m_nIndex = AddString(m_strItemText);
SetCurSel(m_nIndex);
m_bNewItem = TRUE;
}
// get the text for the currently selected
// item and set the new flag to FALSE.
else
{
m_bNewItem = FALSE;
int iCount = GetCount();
m_nIndex = GetCurSel();
if (m_nIndex >= iCount || iCount <= 0)
{
m_nIndex = LB_ERR;
SetCurSel(LB_ERR);
// turn redraw back.
SetRedraw(TRUE);
Invalidate();
return;
}
GetEditItemText();
}
// turn redraw back.
SetRedraw(TRUE);
Invalidate();
if (m_dwLStyle & LBS_XTP_BROWSE_ONLY)
{
// Send notification to owner.
pOwner->SendMessage( WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(),
LBN_XTP_ONBROWSE), (LPARAM)m_hWnd );
return;
}
// Get the size of the currently selected item.
CRect rcItem;
GetItemRect(m_nIndex, rcItem);
rcItem.InflateRect(-2, 2);
// create the edit box.
m_pItemEdit = CreateEditControl(rcItem);
// if defined, set the filter for the item edit control.
if (!m_strFilter.IsEmpty())
{
m_pItemEdit->SetDlgFilter(m_strFilter);
}
if (!m_strInitialDir.IsEmpty())
{
m_pItemEdit->SetDlgInitialDir(m_strInitialDir);
}
}
示例9: k5_ccconfig_dlgproc
INT_PTR CALLBACK
k5_ccconfig_dlgproc(HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam) {
k5_ccc_dlg_data * d;
switch(uMsg) {
case WM_INITDIALOG:
d = PMALLOC(sizeof(*d));
#ifdef DEBUG
assert(d);
#endif
ZeroMemory(d, sizeof(*d));
k5_read_file_cc_data(&d->save);
k5_copy_file_cc_data(&d->work, &d->save);
d->node = (khui_config_node) lParam;
#pragma warning(push)
#pragma warning(disable: 4244)
SetWindowLongPtr(hwnd, DWLP_USER, (LONG_PTR) d);
#pragma warning(pop)
{
LVCOLUMN lvc;
HWND lv;
wchar_t buf[256];
RECT r;
lv = GetDlgItem(hwnd, IDC_CFG_FCLIST);
#ifdef DEBUG
assert(lv);
#endif
ZeroMemory(&lvc, sizeof(lvc));
lvc.mask = LVCF_TEXT | LVCF_WIDTH;
LoadString(hResModule, IDS_CFG_FCTITLE,
buf, ARRAYLENGTH(buf));
GetWindowRect(lv, &r);
lvc.pszText = buf;
lvc.cx = (r.right - r.left) * 9 / 10;
ListView_InsertColumn(lv, 0, &lvc);
}
SendDlgItemMessage(hwnd, IDC_CFG_FCNAME, EM_SETLIMITTEXT,
MAX_PATH - 1, 0);
k5_ccc_update_ui(hwnd, d);
break;
case WM_COMMAND:
d = (k5_ccc_dlg_data *) (DWORD_PTR)
GetWindowLongPtr(hwnd, DWLP_USER);
if (d == NULL)
break;
switch(wParam) {
case MAKEWPARAM(IDC_CFG_ADD, BN_CLICKED):
{
wchar_t path[MAX_PATH];
wchar_t cpath[MAX_PATH];
khm_size i;
GetDlgItemText(hwnd, IDC_CFG_FCNAME,
cpath, ARRAYLENGTH(cpath));
PathCanonicalize(path, cpath);
if (!*path)
return TRUE; /* nothing to add */
for (i=0; i < d->work.n_file_ccs; i++) {
if (!_wcsicmp(path, d->work.file_ccs[i].path)) {
/* allow the user to correct case, as appropriate */
StringCbCopy(d->work.file_ccs[i].path,
sizeof(d->work.file_ccs[i].path),
path);
k5_ccc_update_ui(hwnd, d);
return TRUE;
}
}
/* not there. we need to add. but check a few things
first */
if (!PathFileExists(path)) {
wchar_t title[64];
wchar_t text[128];
LoadString(hResModule, IDS_CFG_FCN_WARNING,
title, ARRAYLENGTH(title));
LoadString(hResModule, IDS_CFG_FCN_W_NOTFOUND,
text, ARRAYLENGTH(text));
//.........这里部分代码省略.........
示例10: ADDRUNMsgProc
BOOL CALLBACK ADDRUNMsgProc(HWND hWndDlg, UINT Message, WPARAM wParam, LPARAM lParam)
{
static PDISPLAYINFO pDI;
static HANDLE hCtlALLRGRPS;
static HANDLE hCtlALLWITHLABEL;
static HANDLE hCtlLABELS;
static HANDLE hCtlORRGRP;
static HANDLE hCtlRGRP;
static HANDLE hCtlSGRP;
static HANDLE hCtlNA;
static HANDLE hCtlONLYASSIGNED;
static HANDLE hCtlNODELIST;
static HANDLE hCtlLISTBOXTITLE;
static HANDLE hCtlBLOCKS;
static HANDLE hCtlIDREMOVE;
static HANDLE hCtlIDINTERACTIVE;
static HANDLE hCtlIDVISUAL;
static long RGRPRouteRecordID;
static long SGRPServiceRecordID;
static int tabPos[TABSET] = {22, 32};
static int selectedFrom;
static int numRoutes;
HCURSOR saveCursor;
WORD DlgWidthUnits;
BOOL bFound;
char RGRPNumber[ROUTES_NUMBER_LENGTH + 1];
char RGRPName[ROUTES_NAME_LENGTH + 1];
char SGRPName[SERVICES_NAME_LENGTH + 1];
char NODEName[NODES_ABBRNAME_LENGTH + 1];
char dummy[256];
int adjustedTabPos[TABSET];
int nI;
int nJ;
int rcode2;
int numGarages;
int nRc;
short int wmId;
short int wmEvent;
long flags;
long tempLong;
int numSelected;
long position;
BLOCKSINDEXDef BLOCKSINDEX;
int selectedLabel;
long commentsRecordID;
BLOCKSDef *pTRIPSChunk;
int serviceIndex;
long SERVICESrecordID;
long NODESrecordID;
long ROUTESrecordID;
int garageIndex;
int numBlocks;
int bEnable;
int *pSelected = NULL;
switch(Message)
{
//
// WM_INITDIALOG - Initialize the dialog
//
case WM_INITDIALOG:
pDI = (PDISPLAYINFO)lParam;
if(pDI == NULL)
{
SendMessage(hWndDlg, WM_COMMAND, MAKEWPARAM(IDCANCEL, 0), (LPARAM)0);
break;
}
//
// Set up the handle to the controls
//
hCtlALLRGRPS = GetDlgItem(hWndDlg, ADDRUN_ALLRGRPS);
hCtlALLWITHLABEL = GetDlgItem(hWndDlg, ADDRUN_ALLWITHLABEL);
hCtlLABELS = GetDlgItem(hWndDlg, ADDRUN_LABELS);
hCtlORRGRP = GetDlgItem(hWndDlg, ADDRUN_ORRGRP);
hCtlRGRP = GetDlgItem(hWndDlg, ADDRUN_RGRP);
hCtlSGRP = GetDlgItem(hWndDlg, ADDRUN_SGRP);
hCtlNA = GetDlgItem(hWndDlg, ADDRUN_NA);
hCtlONLYASSIGNED = GetDlgItem(hWndDlg, ADDRUN_ONLYASSIGNED);
hCtlNODELIST = GetDlgItem(hWndDlg, ADDRUN_NODELIST);
hCtlLISTBOXTITLE = GetDlgItem(hWndDlg, ADDRUN_LISTBOXTITLE);
hCtlBLOCKS = GetDlgItem(hWndDlg, ADDRUN_BLOCKS);
hCtlIDREMOVE = GetDlgItem(hWndDlg, IDREMOVE);
hCtlIDINTERACTIVE = GetDlgItem(hWndDlg, IDINTERACTIVE);
hCtlIDVISUAL = GetDlgItem(hWndDlg, IDVISUAL);
//
// Set up the tab stops for ADDRUN_LISTBOXTITLE and ADDRUN_BLOCKS, and draw the title
//
DlgWidthUnits = LOWORD(GetDialogBaseUnits()) / 4;
for(nJ = 0; nJ < TABSET; nJ++)
{
adjustedTabPos[nJ] = (DlgWidthUnits * tabPos[nJ] * 2);
}
SendMessage(hCtlLISTBOXTITLE, LB_SETTABSTOPS, (WPARAM)TABSET, (LPARAM)adjustedTabPos);
LoadString(hInst, TEXT_024, tempString, TEMPSTRING_LENGTH);
SendMessage(hCtlLISTBOXTITLE, LB_ADDSTRING, (WPARAM)0, (LONG)(LPSTR)tempString);
SendMessage(hCtlBLOCKS, LB_SETTABSTOPS, (WPARAM)TABSET, (LPARAM)adjustedTabPos);
//
// Display the "destination"
//.........这里部分代码省略.........
示例11: ColourPickerWndProc
static LRESULT CALLBACK ColourPickerWndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)
{
switch(message) {
case WM_CREATE:
SetWindowLongPtr(hwnd,0,0);
SetWindowLongPtr(hwnd,sizeof(COLORREF),0);
break;
case CPM_SETDEFAULTCOLOUR:
SetWindowLongPtr(hwnd,sizeof(COLORREF),lParam);
break;
case CPM_GETDEFAULTCOLOUR:
return GetWindowLongPtr(hwnd,sizeof(COLORREF));
case CPM_SETCOLOUR:
SetWindowLongPtr(hwnd,0,lParam);
InvalidateRect(hwnd,NULL,FALSE);
break;
case CPM_GETCOLOUR:
return GetWindowLongPtr(hwnd,0);
case WM_LBUTTONUP:
{
CHOOSECOLOR cc={0};
COLORREF custColours[16]={0};
custColours[0]=GetWindowLongPtr(hwnd,sizeof(COLORREF));
cc.lStructSize=sizeof(CHOOSECOLOR);
cc.hwndOwner=hwnd;
cc.hInstance=(HWND)hMirandaInst;
cc.rgbResult=GetWindowLongPtr(hwnd,0);
cc.lpCustColors=custColours;
cc.Flags=CC_ANYCOLOR|CC_FULLOPEN|CC_RGBINIT;
if(ChooseColor(&cc)) {
SetWindowLongPtr(hwnd,0,cc.rgbResult);
SendMessage(GetParent(hwnd),WM_COMMAND,MAKEWPARAM(GetDlgCtrlID(hwnd),CPN_COLOURCHANGED),(LPARAM)hwnd);
InvalidateRect(hwnd,NULL,FALSE);
}
break;
}
case WM_ENABLE:
InvalidateRect(hwnd,NULL,FALSE);
break;
case WM_NCPAINT:
case WM_PAINT:
{ PAINTSTRUCT ps;
HDC hdc1;
RECT rc;
HBRUSH hBrush;
hdc1=BeginPaint(hwnd,&ps);
GetClientRect(hwnd,&rc);
DrawEdge(hdc1,&rc,EDGE_ETCHED,BF_RECT);
InflateRect(&rc,-2,-2);
if(IsWindowEnabled(hwnd))
hBrush=CreateSolidBrush(GetWindowLongPtr(hwnd,0));
else
hBrush=CreateHatchBrush(HS_BDIAGONAL,GetSysColor(COLOR_GRAYTEXT));
SetBkColor(hdc1,GetSysColor(COLOR_BTNFACE));
FillRect(hdc1,&rc,hBrush);
DeleteObject(hBrush);
EndPaint(hwnd,&ps);
break;
}
case WM_DESTROY:
break;
}
return DefWindowProc(hwnd,message,wParam,lParam);
}
示例12: DisasmCtl
LRESULT CALLBACK DisasmCtl(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
DisasmCtl_struct *cc=(DisasmCtl_struct *)GetWindowLong(hwnd, 0);
switch(message)
{
case WM_NCCREATE:
{
LRESULT ret = InitCustomCtl(hwnd, wParam, lParam, sizeof(DisasmCtl_struct));
if (ret != FALSE)
{
cc = (DisasmCtl_struct *)GetWindowLong(hwnd, 0);
cc->addr = 0;
cc->cursel = 0;
cc->disinst = DisasmInstructionNull;
SetScrollRange(hwnd, SB_VERT, 0, 65535, TRUE);
}
return ret;
}
case WM_NCDESTROY:
DestroyCustomCtl((CustomCtl_struct *)cc);
break;
case WM_PAINT:
return DisasmCtl_OnPaint(cc, wParam, lParam);
case WM_ERASEBKGND:
return TRUE;
case WM_SETFONT:
return CustomCtl_SetFont((CustomCtl_struct *)cc, wParam, lParam);
case WM_SETFOCUS:
CustomCtl_SetFocus((CustomCtl_struct *)cc);
break;
case WM_KILLFOCUS:
CustomCtl_KillFocus((CustomCtl_struct *)cc);
break;
case WM_VSCROLL:
return DisasmCtl_Vscroll(cc, wParam, lParam);
case WM_LBUTTONDOWN:
return 0;
case WM_LBUTTONDBLCLK:
{
cc->cursel = HIWORD(lParam) / cc->fontmetric.tmHeight;
PostMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(hwnd), LBN_DBLCLK), (LPARAM)hwnd);
return 0;
}
case WM_KEYDOWN:
return DisasmCtl_KeyDown(cc, wParam, lParam);
case DIS_SETDISFUNC:
cc->disinst = (int (*)(u32, char *))lParam;
return 0;
case DIS_SETENDADDRESS:
{
int highestbit=0;
int i;
cc->e_addr = (u32)lParam;
for (i = 0; i < 31; i++)
{
if (lParam & 0x1)
highestbit = i;
lParam >>= 1;
}
if (highestbit > 15)
cc->scrollscale = highestbit - 15;
else
cc->scrollscale = 2;
SetScrollRange(hwnd, SB_VERT, 0, cc->e_addr >> cc->scrollscale, TRUE);
return 0;
}
case DIS_GOTOADDRESS:
cc->addr = (u32)lParam;
SetScrollPos(cc->hwnd, SB_VERT, cc->addr >> cc->scrollscale, TRUE);
InvalidateRect(cc->hwnd, NULL, FALSE);
SetFocus(cc->hwnd);
return 0;
case DIS_SETPC:
cc->pc = (u32)lParam;
return 0;
case DIS_GETCURSEL:
{
char text[MAX_PATH];
u32 addr=cc->addr;
int i;
for (i = 0; i < cc->cursel; i++)
addr += cc->disinst(addr, text);
return addr;
}
case DIS_GETCURADDRESS:
return cc->addr;
default:
break;
}
return DefWindowProc(hwnd, message, wParam, lParam);
}
示例13: GetParent
void CPlayerSeekBar::SyncVideoToThumb()
{
GetParent()->PostMessage(WM_HSCROLL, MAKEWPARAM((short)m_rtPos, SB_THUMBTRACK), (LPARAM)m_hWnd);
}
示例14: GetSystemMetrics
void CScrollBar::CalcRects(int y /*= 0*/)
{
const int &cx = m_mdc.cx;
const int &cy = m_mdc.cy;
const int cxBtn = GetSystemMetrics(SM_CXHTHUMB);
const int cyBtn = cxBtn + SCX(1);
// Buttons
m_rcBtn1 = RRect(0, 0, cxBtn, cyBtn);
m_rcBtn2 = RRect(0, cy - cyBtn, cxBtn, cy);
// Thumb
m_rcThumb.x = 0;
m_rcThumb.cx = cxBtn;
int nFullRange = m_nRangeMax - m_nRangeMin + 1;
int nVarRange = nFullRange - m_nPageSize;
if (nVarRange <= 0)
return;
int cyFullRange = cy - 2 * cyBtn;
m_rcThumb.cy = max((m_nPageSize * cyFullRange) / nFullRange, SCX(20));
int cyVarRange = cyFullRange - m_rcThumb.cy;
if (cyVarRange <= 0)
return;
if (m_bDragging)
{
// Calculate virtual thumb position from mouse position and correct it
m_rcThumb = m_rcDragging;
m_rcThumb.y += y - m_ptDragging.y;
if (m_rcThumb.y < cyBtn)
m_rcThumb.y = cyBtn;
if (m_rcThumb.bottom > cy - cyBtn)
m_rcThumb.y -= m_rcThumb.bottom - (cy - cyBtn);
// Calculate track position from virtual thumb position
double dVarPos = (double)(m_rcThumb.y - cyBtn) / cyVarRange;
int nTrackPos = m_nRangeMin + round(dVarPos * nVarRange);
if (m_nTrackPos != nTrackPos)
{
m_nTrackPos = nTrackPos;
PostMessage(GetParent(m_hWnd), WM_VSCROLL,
MAKEWPARAM(SB_THUMBTRACK, m_nTrackPos), (LPARAM)m_hWnd);
}
// Calculate thumb position from track position
m_rcThumb.y = cyBtn + round((double)((m_nTrackPos - m_nRangeMin) *
cyVarRange) / nVarRange);
}
else
{
m_rcThumb.y = cyBtn + round((double)((m_nPos - m_nRangeMin) *
cyVarRange) / nVarRange);
// Calculate page up and down rectangles
m_rcBtnPageUp = RRect(0, cyBtn, cxBtn, m_rcThumb.top);
m_rcBtnPageDown = RRect(0, m_rcThumb.bottom, cxBtn, cy - cyBtn);
}
}
示例15: WndProc
//
// FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM)
//
// PURPOSE: Processes messages for the main window.
//
// WM_COMMAND - process the application menu
// WM_PAINT - Paint the main window
// WM_DESTROY - post a quit message and return
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
int tbh, sbh;
RECT rect;
INITCOMMONCONTROLSEX InitCtrlEx;
char strtime[128];
switch (message)
{
case WM_SIZE:
SendMessage(hWndStatusbar, WM_SIZE, wParam, lParam);
GetWindowRect(hWndStatusbar, &rect);
sbh = rect.bottom - rect.top;
GetWindowRect(hWndToolbar, &rect);
tbh = rect.bottom - rect.top;
iBitmapY = tbh;
iBitmapH = HIWORD(lParam) - sbh - tbh;
SendMessage(hWndBitmapper, WM_SIZE, wParam, MAKELPARAM(LOWORD(lParam), iBitmapH));
break;
case WM_CREATE:
InitCtrlEx.dwSize = sizeof(INITCOMMONCONTROLSEX);
InitCtrlEx.dwICC = ICC_BAR_CLASSES;
InitCommonControlsEx(&InitCtrlEx);
InitCommonControls();
hWndToolbar = CreateCoolToolbar(hWnd, hInst);
CreateAllResources(CGBrushes);
applicatieprogramma(CIF_INIT);
CIF_WPS[CIF_PROG_STATUS] = CIF_STAT_REG;
CIF_KLOK[CIF_DAG] = 1;
CIF_KLOK[CIF_MAAND] = 1;
CIF_KLOK[CIF_JAAR] = 2000;
DisplayParameters();
BitmapperSetFilename("test.bmp");
BitmapperControlRegister();
if (!(hBitmap = (HBITMAP)LoadImage(NULL, "test.bmp"/*(LPCSTR)lpcsPicturePath*/, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE)))
{
MessageBox(hWnd, TEXT("Bitmap was not found"), TEXT("Bitmap not found"), MB_OK);
SendMessage(hWnd, WM_CLOSE, NULL, NULL);
}
GetObject(hBitmap, sizeof(BITMAP), (LPVOID)&Bitmap);
hWndStatusbar = CreateStatusBar(hWnd, ID_STATUSBAR, hInst, 4);
CreateThread(NULL, 0, ApplProc, 0, 0, NULL);
// ClientResize(hWnd, Bitmap.bmWidth, Bitmap.bmHeight);
{
RECT rcClient, rcWindow;
POINT ptDiff;
GetWindowRect(hWndStatusbar, &rect);
int sbh = rect.bottom - rect.top;
GetWindowRect(hWndToolbar, &rect);
int tbh = rect.bottom - rect.top;
GetWindowRect(hWnd, &rcWindow);
GetClientRect(hWnd, &rcClient);
ptDiff.x = (rcWindow.right - rcWindow.left) - rcClient.right;
ptDiff.y = (rcWindow.bottom - rcWindow.top) - rcClient.bottom;
MoveWindow(hWnd, rcWindow.left, rcWindow.top, Bitmap.bmWidth + ptDiff.x, Bitmap.bmHeight + ptDiff.y + tbh + sbh, FALSE);
}
hWndBitmapper = CreateWindow(BITMAPPER_WC, NULL, WS_CHILD | WS_VISIBLE,
0, iBitmapY, Bitmap.bmWidth, Bitmap.bmHeight, hWnd, NULL, hInst, NULL);
/* Get the sizes of the system font, for formatting */
hdc = GetDC(hWnd);
memHdc = CreateCompatibleDC(hdc);
bufBMP = CreateCompatibleBitmap(hdc, Bitmap.bmWidth, Bitmap.bmHeight);
mainTimer = SetTimer(hWnd, NULL, 5, &TimerProc);
snprintf(strtime, 128, "Mon %02d-%02d-%04d %02d:%02d:%02d", CIF_KLOK[CIF_DAG], CIF_KLOK[CIF_MAAND], CIF_KLOK[CIF_JAAR], CIF_KLOK[CIF_UUR], CIF_KLOK[CIF_MINUUT], CIF_KLOK[CIF_SECONDE]);
SendMessage(hWndStatusbar, SB_SETTEXT, MAKEWPARAM(0, SBT_NOBORDERS), (LPARAM)strtime);
break;
case WM_COMMAND:
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
// Parse the menu selections:
//.........这里部分代码省略.........