本文整理汇总了C++中ImageList_Destroy函数的典型用法代码示例。如果您正苦于以下问题:C++ ImageList_Destroy函数的具体用法?C++ ImageList_Destroy怎么用?C++ ImageList_Destroy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ImageList_Destroy函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ImageList_Destroy
FileInfoListView::~FileInfoListView()
{
if (m_smallImageList != 0) {
ImageList_Destroy(m_smallImageList);
}
}
示例2: sSplitKeyDlgProc
//.........这里部分代码省略.........
EnableWindow (GetDlgItem (hDlg, IDC_SHARES), TRUE);
EnableWindow (GetDlgItem (hDlg, IDC_SHARESSPIN), TRUE);
EnableWindow (
GetDlgItem (hDlg, IDC_REMOVESHAREHOLDER), TRUE);
}
else {
psks->iIndexCurrent = -1;
psks->pshsCurrent = NULL;
SetDlgItemText (hDlg, IDC_SHARES, "");
SetDlgItemText (hDlg, IDC_CURRENTSHAREHOLDER, "");
EnableWindow (GetDlgItem (hDlg, IDC_SHARES), FALSE);
EnableWindow (
GetDlgItem (hDlg, IDC_REMOVESHAREHOLDER), FALSE);
}
}
break;
}
break;
case WM_DESTROY :
psks = (PSPLITKEYSTRUCT)GetWindowLong (hDlg, GWL_USERDATA);
// terminate drag/drop
RevokeDragDrop (psks->hwndList);
KMReleaseDropTarget (psks->pDropTarget);
CoLockObjectExternal ((IUnknown*)psks->pDropTarget, FALSE, TRUE);
// call function to remove hwnd from list
if (psks->pKM->lpfnHwndListFunc)
(psks->pKM->lpfnHwndListFunc)(hDlg, FALSE, NULL, NULL);
// destroy data objects
ImageList_Destroy (psks->hIml);
sDestroyShareHolders (psks);
sDestroySplitKeyStruct (psks);
break;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDCANCEL :
DestroyWindow (hDlg);
break;
case IDOK :
psks = (PSPLITKEYSTRUCT)GetWindowLong (hDlg, GWL_USERDATA);
EnableWindow (psks->pKM->hWndParent, FALSE);
if (sSplitKey (psks))
{
EnableWindow (psks->pKM->hWndParent, TRUE);
DestroyWindow (hDlg);
}
else
EnableWindow (psks->pKM->hWndParent, TRUE);
break;
case IDHELP :
psks = (PSPLITKEYSTRUCT)GetWindowLong (hDlg, GWL_USERDATA);
WinHelp (hDlg, psks->pKM->szHelpFile, HELP_CONTEXT,
IDH_PGPCLSPLIT_SPLITDIALOG);
break;
case IDC_ADDSHAREHOLDER :
psks = (PSPLITKEYSTRUCT)GetWindowLong (hDlg, GWL_USERDATA);
EnableWindow (psks->pKM->hWndParent, FALSE);
示例3: AddContactDlgAccounts
bool AddContactDlgAccounts(HWND hdlg, AddDialogParam *acs)
{
PROTOACCOUNT** pAccounts;
int iRealAccCount, iAccCount = 0;
ProtoEnumAccounts(&iRealAccCount, &pAccounts);
for (int i = 0; i < iRealAccCount; i++) {
if (!IsAccountEnabled(pAccounts[i]))
continue;
DWORD dwCaps = (DWORD)CallProtoService(pAccounts[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0);
if (dwCaps & PF1_BASICSEARCH || dwCaps & PF1_EXTSEARCH || dwCaps & PF1_SEARCHBYEMAIL || dwCaps & PF1_SEARCHBYNAME)
iAccCount++;
}
if (iAccCount == 0) {
if (GetParent(hdlg) == NULL)
DestroyWindow(hdlg);
else
EndDialog(hdlg, 0);
return false;
}
SIZE textSize;
RECT rc;
int iIndex = 0, cbWidth = 0;
HIMAGELIST hIml = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, iAccCount, 0);
ImageList_Destroy((HIMAGELIST)SendDlgItemMessage(hdlg, IDC_PROTO, CBEM_SETIMAGELIST, 0, (LPARAM)hIml));
SendDlgItemMessage(hdlg, IDC_PROTO, CB_RESETCONTENT, 0, 0);
COMBOBOXEXITEM cbei = { 0 };
cbei.mask = CBEIF_IMAGE | CBEIF_SELECTEDIMAGE | CBEIF_TEXT | CBEIF_LPARAM;
HDC hdc = GetDC(hdlg);
SelectObject(hdc, (HFONT)SendDlgItemMessage(hdlg, IDC_PROTO, WM_GETFONT, 0, 0));
for (int i = 0; i < iRealAccCount; i++) {
if (!IsAccountEnabled(pAccounts[i])) continue;
DWORD dwCaps = (DWORD)CallProtoService(pAccounts[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0);
if (!(dwCaps & PF1_BASICSEARCH) && !(dwCaps & PF1_EXTSEARCH) && !(dwCaps & PF1_SEARCHBYEMAIL) && !(dwCaps & PF1_SEARCHBYNAME))
continue;
cbei.pszText = pAccounts[i]->tszAccountName;
GetTextExtentPoint32(hdc, cbei.pszText, lstrlen(cbei.pszText), &textSize);
if (textSize.cx > cbWidth) cbWidth = textSize.cx;
HICON hIcon = (HICON)CallProtoService(pAccounts[i]->szModuleName, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0);
cbei.iImage = cbei.iSelectedImage = ImageList_AddIcon(hIml, hIcon);
DestroyIcon(hIcon);
cbei.lParam = (LPARAM)pAccounts[i]->szModuleName;
SendDlgItemMessage(hdlg, IDC_PROTO, CBEM_INSERTITEM, 0, (LPARAM)&cbei);
if (cbei.lParam && !strcmp(acs->proto, pAccounts[i]->szModuleName))
iIndex = cbei.iItem;
cbei.iItem++;
}
cbWidth += 32;
SendDlgItemMessage(hdlg, IDC_PROTO, CB_GETDROPPEDCONTROLRECT, 0, (LPARAM)&rc);
if ((rc.right - rc.left) < cbWidth)
SendDlgItemMessage(hdlg, IDC_PROTO, CB_SETDROPPEDWIDTH, cbWidth, 0);
SendDlgItemMessage(hdlg, IDC_PROTO, CB_SETCURSEL, iIndex, 0);
SendMessage(hdlg, WM_COMMAND, MAKEWPARAM(IDC_PROTO, CBN_SELCHANGE), (LPARAM)GetDlgItem(hdlg, IDC_PROTO));
if (iAccCount == 1)
SetFocus(GetDlgItem(hdlg, IDC_USERID));
return true;
}
示例4: RecvDlgProc
//.........这里部分代码省略.........
break;
}
case WM_CONTEXTMENU:
{
HWND hLV = GetDlgItem(hwndDlg, IDC_CONTACTS);
LVHITTESTINFO lvh;
RECT rt;
wndData->iPopupItem = -1;
if ((HWND)wParam != hLV) break; // if not our ListView go away
lvh.pt.x = LOWORD(lParam);
lvh.pt.y = HIWORD(lParam);
if (GetWindowRect(hLV, &rt)==0) return FALSE; // ?? why this, some check ??
ScreenToClient(hLV, &lvh.pt); // convert to ListView local coordinates
int ci = ListView_HitTest(hLV, &lvh);
if (ci==-1) break; // mouse is not over any item
wndData->iPopupItem = ci;
TrackPopupMenu(GetSubMenu(wndData->mhPopup, 0), TPM_LEFTALIGN|TPM_TOPALIGN, LOWORD(lParam), HIWORD(lParam), 0, hwndDlg, NULL);
break;
}
case HM_EVENTSENT:
{
ACKDATA *ack=(ACKDATA*)lParam;
if (ack->type!=ACKTYPE_SEARCH) break; // not search ack, go away
if (ack->hProcess!=wndData->rhSearch) break; //not our search, go away
if (ack->result==ACKRESULT_DATA)
{
HWND hLV = GetDlgItem(hwndDlg, IDC_CONTACTS);
PROTOSEARCHRESULT* psr = (PROTOSEARCHRESULT*)ack->lParam;
LVFINDINFO fi;
fi.flags = LVFI_STRING;
fi.psz = wndData->haUin;
int iLPos = ListView_FindItem(hLV, -1, &fi);
if (iLPos==-1) iLPos=0;
// ListView_SetItemText(hLV, iLPos, 0, psr->email); // not sent by ICQ, and currently unsupported either
if (strcmpnull(psr->nick, "") && psr->nick) ListView_SetItemText(hLV, iLPos, 1, psr->nick);
ListView_SetItemText(hLV, iLPos, 2, psr->firstName);
ListView_SetItemText(hLV, iLPos, 3, psr->lastName);
break;
}
SAFE_FREE((void**)&wndData->haUin);
break;
}
case WM_CLOSE: // user closed window, so destroy it
{
WindowList_Remove(ghRecvWindowList, hwndDlg);
DestroyWindow(hwndDlg);
break;
}
case WM_DESTROY: // last message received by this dialog, cleanup
{
CallService(MS_DB_EVENT_MARKREAD, (WPARAM)wndData->mhContact, (LPARAM)wndData->mhDbEvent);
Utils_SaveWindowPosition(hwndDlg, NULL, MODULENAME, "");
ImageList_Destroy(wndData->mhListIcon);
UnhookEvent(wndData->hHook);
DestroyMenu(wndData->mhPopup);
for (int i=0; i < SIZEOF(wndData->hIcons); i++)
DestroyIcon(wndData->hIcons[i]);
delete wndData; // automatically calls destructor
break;
}
case WM_MEASUREITEM:
return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam);
case WM_DRAWITEM:
{
DrawProtocolIcon(hwndDlg, lParam, wndData->mhContact);
return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
}
case WM_SIZE:
{ // make the dlg resizeable
UTILRESIZEDIALOG urd = {0};
if (IsIconic(hwndDlg)) break;
urd.cbSize = sizeof(urd);
urd.hInstance = hInst;
urd.hwndDlg = hwndDlg;
urd.lParam = 0; // user-defined
urd.lpTemplate = MAKEINTRESOURCEA(IDD_RECEIVE);
urd.pfnResizer = RecvDlg_Resize;
CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM) & urd);
break;
}
case WM_GETMINMAXINFO:
{
MINMAXINFO* mmi=(MINMAXINFO*)lParam;
mmi->ptMinTrackSize.x = 480+2*GetSystemMetrics(SM_CXSIZEFRAME);
mmi->ptMinTrackSize.y = 130+2*GetSystemMetrics(SM_CYSIZEFRAME);
break;
}
case DM_UPDATETITLE:
{
UpdateDialogTitle(hwndDlg, wndData?wndData->mhContact:NULL, "Contacts from");
if (wndData)
UpdateDialogAddButton(hwndDlg, wndData->mhContact);
break;
}
}
return FALSE;
}
示例5: HIDPI_ImageList_LoadImage
HIMAGELIST HIDPI_ImageList_LoadImage(
HINSTANCE hinst,
LPCTSTR lpbmp,
int cx,
int cGrow,
COLORREF crMask,
UINT uType,
UINT uFlags
)
{
HBITMAP hbmImage = NULL;
HIMAGELIST piml = NULL;
BITMAP bm;
int cImages, cxImage, cy;
int BmpLogPixelsX, BmpLogPixelsY;
UINT flags;
if ((uType != IMAGE_BITMAP) || // Image type is not IMAGE_BITMAP
(cx == 0)) // Caller doesn't care about the dimensions of the image - assumes the ones in the file
{
piml = ImageList_LoadImage(hinst, lpbmp, cx, cGrow, crMask, uType, uFlags);
goto cleanup;
}
if (!HIDPI_GetBitmapLogPixels(hinst, lpbmp, &BmpLogPixelsX, &BmpLogPixelsY))
{
goto cleanup;
}
hbmImage = (HBITMAP)LoadImage(hinst, lpbmp, uType, 0, 0, uFlags);
if (!hbmImage || (sizeof(bm) != GetObject(hbmImage, sizeof(bm), &bm)))
{
goto cleanup;
}
// do we need to scale this image?
if (BmpLogPixelsX == g_HIDPI_LogPixelsX)
{
piml = ImageList_LoadImage(hinst, lpbmp, cx, cGrow, crMask, uType, uFlags);
goto cleanup;
}
cxImage = HIDPIMulDiv(cx, BmpLogPixelsX, g_HIDPI_LogPixelsX);
// Bitmap width should be multiple integral of image width.
// If not, that means either your bitmap is wrong or passed in cx is wrong.
// ASSERT((bm.bmWidth % cxImage) == 0);
cImages = bm.bmWidth / cxImage;
cy = HIDPIMulDiv(bm.bmHeight, g_HIDPI_LogPixelsY, BmpLogPixelsY);
if ((g_HIDPI_LogPixelsX % BmpLogPixelsX) == 0)
{
HIDPI_StretchBitmap(&hbmImage, cx * cImages, cy, 1, 1);
}
else
{
// Here means the DPI is not integral multiple of standard DPI (96DPI).
// So if we stretch entire bitmap together, we are not sure each indivisual
// image will be stretch to right place. It is controled by StretchBlt().
// (for example, a 16 pixel icon, the first one might be stretch to 22 pixels
// and next one might be stretched to 20 pixels)
// What we have to do here is stretching indivisual image separately to make sure
// every one is stretched properly.
HIDPI_StretchBitmap(&hbmImage, cx, cy, cImages, 1);
}
flags = 0;
// ILC_MASK is important for supporting CLR_DEFAULT
if (crMask != CLR_NONE)
{
flags |= ILC_MASK;
}
// ILC_COLORMASK bits are important if we ever want to Merge ImageLists
if (bm.bmBits)
{
flags |= (bm.bmBitsPixel & ILC_COLORMASK);
}
// bitmap MUST be de-selected from the DC
// create the image list of the size asked for.
piml = ImageList_Create(cx, cy, flags, cImages, cGrow);
if (piml)
{
int added;
if (crMask == CLR_NONE)
{
added = ImageList_Add(piml, hbmImage, NULL);
}
else
{
added = ImageList_AddMasked(piml, hbmImage, crMask);
}
if (added < 0)
{
ImageList_Destroy(piml);
//.........这里部分代码省略.........
示例6: LOWORD
LRESULT CVideoMarkup::OnButtonUp( UINT, WPARAM, LPARAM lParam, BOOL&)
{
POINT p;
p.x = LOWORD(lParam);
p.y = HIWORD(lParam);
if (draggingIcon) { // we just completed an icon drag
// End the drag-and-drop process
draggingIcon = FALSE;
ImageList_DragLeave(m_sampleListView);
ImageList_EndDrag();
ImageList_Destroy(hDragImageList);
SetCursor(LoadCursor(NULL, IDC_ARROW));
ReleaseCapture();
// Determine the position of the drop point
LVHITTESTINFO lvhti;
lvhti.pt = p;
ClientToScreen(&lvhti.pt);
::ScreenToClient(m_sampleListView, &lvhti.pt);
ListView_HitTestEx(m_sampleListView, &lvhti);
CRect posRect, negRect, motionRect, rangeRect;
ListView_GetGroupRect(m_sampleListView, GROUPID_POSSAMPLES, LVGGR_GROUP, &posRect);
ListView_GetGroupRect(m_sampleListView, GROUPID_NEGSAMPLES, LVGGR_GROUP, &negRect);
ListView_GetGroupRect(m_sampleListView, GROUPID_MOTIONSAMPLES, LVGGR_GROUP, &motionRect);
ListView_GetGroupRect(m_sampleListView, GROUPID_RANGESAMPLES, LVGGR_GROUP, &rangeRect);
int newGroupId;
if (posRect.PtInRect(lvhti.pt)) newGroupId = GROUPID_POSSAMPLES;
else if (negRect.PtInRect(lvhti.pt)) newGroupId = GROUPID_NEGSAMPLES;
else if (motionRect.PtInRect(lvhti.pt)) newGroupId = GROUPID_MOTIONSAMPLES;
else if (rangeRect.PtInRect(lvhti.pt)) newGroupId = GROUPID_RANGESAMPLES;
else newGroupId = GROUPID_TRASH;
// update group membership of selected items based on drop location
int numSelected = ListView_GetSelectedCount(m_sampleListView);
int iSelection = -1;
for (int iIndex=0; iIndex<numSelected; iIndex++) {
// retrieve the selected item
LVITEM lvi;
iSelection = ListView_GetNextItem(m_sampleListView, iSelection, LVNI_SELECTED);
lvi.mask = LVIF_IMAGE | LVIF_STATE | LVIF_GROUPID;
lvi.state = 0;
lvi.stateMask = 0;
lvi.iItem = iSelection;
lvi.iSubItem = 0;
ListView_GetItem(m_sampleListView, &lvi);
// Get the ID of this selected item
UINT sampleId = ListView_MapIndexToID(m_sampleListView, iSelection);
// test if this is an allowable group membership change
int origGroupId = sampleSet.GetOriginalSampleGroup(sampleId);
if (!GroupTransitionIsAllowed(origGroupId, newGroupId)) {
// this is not a valid change so we'll move to the next item
continue;
}
// update sample group in training set
sampleSet.SetSampleGroup(sampleId, newGroupId);
// Update item in list view with new group id
lvi.iGroupId = newGroupId;
ListView_SetItem(m_sampleListView, &lvi);
}
m_sampleListView.Invalidate(FALSE);
} else if (m_videoLoader.videoLoaded && selectingRegion) { // we just finished drawing a selection
ClipCursor(NULL); // restore full cursor movement
if (!m_videoRect.PtInRect(p)) {
InvalidateRect(&m_videoRect,FALSE);
return 0;
}
selectingRegion = false;
Rect selectRect;
selectRect.X = (INT) min(selectStart.X, selectCurrent.X);
selectRect.Y = (INT) min(selectStart.Y, selectCurrent.Y);
selectRect.Width = (INT) abs(selectStart.X - selectCurrent.X);
selectRect.Height = (INT) abs(selectStart.Y - selectCurrent.Y);
Rect drawBounds(0,0,VIDEO_X,VIDEO_Y);
selectRect.Intersect(drawBounds);
double scaleX = ((double)m_videoLoader.videoX) / ((double)VIDEO_X);
double scaleY = ((double)m_videoLoader.videoY) / ((double)VIDEO_Y);
selectRect.X = (INT) (scaleX * selectRect.X);
selectRect.Y = (INT) (scaleY * selectRect.Y);
selectRect.Width = (INT) (scaleX * selectRect.Width);
selectRect.Height = (INT) (scaleY * selectRect.Height);
// discard tiny samples since they won't help
if ((selectRect.Width > 10) && (selectRect.Height > 10)) {
TrainingSample *sample;
// if we're in motion mode, the behavior is a little special
if (recognizerMode == MOTION_FILTER) {
sample = new TrainingSample(m_videoLoader.copyFrame, m_videoLoader.GetMotionHistory(), m_sampleListView, m_hImageList, selectRect, GROUPID_MOTIONSAMPLES);
} else {
sample = new TrainingSample(m_videoLoader.copyFrame, m_sampleListView, m_hImageList, selectRect, currentGroupId);
}
//.........这里部分代码省略.........
示例7: test_layout
//.........这里部分代码省略.........
add_band_w(hRebar, NULL, 40, 70, 100);
add_band_w(hRebar, NULL, 170, 240, 100);
add_band_w(hRebar, "MMMMMMM", 60, 60, 100);
add_band_w(hRebar, NULL, 200, 200, 100);
check_sizes();
SendMessageA(hRebar, RB_MAXIMIZEBAND, 1, TRUE);
check_sizes();
SendMessageA(hRebar, RB_MAXIMIZEBAND, 1, TRUE);
check_sizes();
SendMessageA(hRebar, RB_MAXIMIZEBAND, 2, FALSE);
check_sizes();
SendMessageA(hRebar, RB_MINIMIZEBAND, 2, 0);
check_sizes();
SendMessageA(hRebar, RB_MINIMIZEBAND, 0, 0);
check_sizes();
/* an image will increase the band height */
himl = ImageList_LoadImageA(GetModuleHandleA("comctl32"), MAKEINTRESOURCEA(121), 24, 2,
CLR_NONE, IMAGE_BITMAP, LR_DEFAULTCOLOR);
ri.cbSize = sizeof(ri);
ri.fMask = RBIM_IMAGELIST;
ri.himl = himl;
ok(SendMessageA(hRebar, RB_SETBARINFO, 0, (LPARAM)&ri), "RB_SETBARINFO failed\n");
rbi.fMask = RBBIM_IMAGE;
rbi.iImage = 1;
SendMessageA(hRebar, RB_SETBANDINFOA, 1, (LPARAM)&rbi);
check_sizes();
/* after removing it everything is back to normal*/
rbi.iImage = -1;
SendMessageA(hRebar, RB_SETBANDINFOA, 1, (LPARAM)&rbi);
check_sizes();
/* Only -1 means that the image is not present. Other invalid values increase the height */
rbi.iImage = -2;
SendMessageA(hRebar, RB_SETBANDINFOA, 1, (LPARAM)&rbi);
check_sizes();
DestroyWindow(hRebar);
/* VARHEIGHT resizing test on a horizontal rebar */
hRebar = create_rebar_control();
SetWindowLongA(hRebar, GWL_STYLE, GetWindowLongA(hRebar, GWL_STYLE) | RBS_AUTOSIZE);
check_sizes();
rbi.fMask = RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_SIZE | RBBIM_STYLE;
rbi.fStyle = RBBS_VARIABLEHEIGHT;
rbi.cxMinChild = 50;
rbi.cyMinChild = 10;
rbi.cyIntegral = 11;
rbi.cyChild = 70;
rbi.cyMaxChild = 200;
rbi.cx = 90;
rbi.hwndChild = build_toolbar(0, hRebar);
SendMessageA(hRebar, RB_INSERTBANDA, -1, (LPARAM)&rbi);
rbi.cyChild = 50;
rbi.hwndChild = build_toolbar(0, hRebar);
SendMessageA(hRebar, RB_INSERTBANDA, -1, (LPARAM)&rbi);
rbi.cyMinChild = 40;
rbi.cyChild = 50;
rbi.cyIntegral = 5;
rbi.hwndChild = build_toolbar(0, hRebar);
SendMessageA(hRebar, RB_INSERTBANDA, -1, (LPARAM)&rbi);
check_sizes();
DestroyWindow(hRebar);
/* VARHEIGHT resizing on a vertical rebar */
hRebar = create_rebar_control();
SetWindowLongA(hRebar, GWL_STYLE, GetWindowLongA(hRebar, GWL_STYLE) | CCS_VERT | RBS_AUTOSIZE);
check_sizes();
rbi.fMask = RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_SIZE | RBBIM_STYLE;
rbi.fStyle = RBBS_VARIABLEHEIGHT;
rbi.cxMinChild = 50;
rbi.cyMinChild = 10;
rbi.cyIntegral = 11;
rbi.cyChild = 70;
rbi.cyMaxChild = 90;
rbi.cx = 90;
rbi.hwndChild = build_toolbar(0, hRebar);
SendMessageA(hRebar, RB_INSERTBANDA, -1, (LPARAM)&rbi);
check_sizes();
rbi.cyChild = 50;
rbi.hwndChild = build_toolbar(0, hRebar);
SendMessageA(hRebar, RB_INSERTBANDA, -1, (LPARAM)&rbi);
check_sizes();
rbi.cyMinChild = 40;
rbi.cyChild = 50;
rbi.cyIntegral = 5;
rbi.hwndChild = build_toolbar(0, hRebar);
SendMessageA(hRebar, RB_INSERTBANDA, -1, (LPARAM)&rbi);
check_sizes();
rbsize_results_free();
DestroyWindow(hRebar);
ImageList_Destroy(himl);
}
示例8: DecodeHTML
bool SmileyPackType::LoadSmileyFileXEP(CMString& tbuf, bool onlyInfo, CMString&)
{
_TMatcher *m0, *m1, *m2;
_TPattern *dbname_re = _TPattern::compile(_T("<DataBaseName>\\s*\"(.*?)\"\\s*</DataBaseName>"),
_TPattern::MULTILINE_MATCHING);
_TPattern *author_re = _TPattern::compile(_T("<PackageAuthor>\\s*\"(.*?)\"\\s*</PackageAuthor>"),
_TPattern::MULTILINE_MATCHING);
_TPattern *settings_re = _TPattern::compile(_T("<settings>(.*?)</settings>"),
_TPattern::MULTILINE_MATCHING | _TPattern::DOT_MATCHES_ALL);
m0 = settings_re->createTMatcher(tbuf);
if (m0->findFirstMatch()) {
CMString settings = m0->getGroup(1);
m1 = author_re->createTMatcher(settings);
if (m1->findFirstMatch()) {
m_Author = m1->getGroup(1);
DecodeHTML(m_Author);
}
delete m1;
m1 = dbname_re->createTMatcher(settings);
if (m1->findFirstMatch()) {
m_Name = m1->getGroup(1);
DecodeHTML(m_Name);
}
delete m1;
}
delete m0;
delete dbname_re;
delete author_re;
delete settings_re;
if (!onlyInfo) {
_TPattern *record_re = _TPattern::compile(_T("<record.*?ImageIndex=\"(.*?)\".*?>(?:\\s*\"(.*?)\")?(.*?)</record>"),
_TPattern::MULTILINE_MATCHING | _TPattern::DOT_MATCHES_ALL);
_TPattern *expression_re = _TPattern::compile(_T("<Expression>\\s*\"(.*?)\"\\s*</Expression>"),
_TPattern::MULTILINE_MATCHING);
_TPattern *pastetext_re = _TPattern::compile(_T("<PasteText>\\s*\"(.*?)\"\\s*</PasteText>"),
_TPattern::MULTILINE_MATCHING);
_TPattern *images_re = _TPattern::compile(_T("<images>(.*?)</images>"),
_TPattern::MULTILINE_MATCHING | _TPattern::DOT_MATCHES_ALL);
_TPattern *image_re = _TPattern::compile(_T("<Image>(.*?)</Image>"),
_TPattern::MULTILINE_MATCHING | _TPattern::DOT_MATCHES_ALL);
_TPattern *imagedt_re = _TPattern::compile(_T("<!\\[CDATA\\[(.*?)\\]\\]>"),
_TPattern::MULTILINE_MATCHING);
m0 = images_re->createTMatcher(tbuf);
if (m0->findFirstMatch()) {
CMString images = m0->getGroup(1);
m1 = imagedt_re->createTMatcher(images);
if (m1->findFirstMatch()) {
IStream* pStream = DecodeBase64Data(T2A_SM(m1->getGroup(1).c_str()));
if (pStream != NULL) {
if (m_hSmList != NULL) ImageList_Destroy(m_hSmList);
m_hSmList = ImageList_Read(pStream);
pStream->Release();
}
}
delete m1;
}
delete m0;
m0 = record_re->createTMatcher(tbuf);
while (m0->findNextMatch()) {
SmileyType *dat = new SmileyType;
dat->SetRegEx(true);
dat->SetImList(m_hSmList, _ttol(m0->getGroup(1).c_str()));
dat->m_ToolText = m0->getGroup(2);
DecodeHTML(dat->m_ToolText);
CMString rec = m0->getGroup(3);
m1 = expression_re->createTMatcher(rec);
if (m1->findFirstMatch()) {
dat->m_TriggerText = m1->getGroup(1);
DecodeHTML(dat->m_TriggerText);
}
delete m1;
m1 = pastetext_re->createTMatcher(rec);
if (m1->findFirstMatch()) {
dat->m_InsertText = m1->getGroup(1);
DecodeHTML(dat->m_InsertText);
}
delete m1;
dat->SetHidden(dat->m_InsertText.IsEmpty());
m1 = image_re->createTMatcher(rec);
if (m1->findFirstMatch()) {
CMString images = m1->getGroup(1);
m2 = imagedt_re->createTMatcher(images);
if (m2->findFirstMatch()) {
IStream* pStream = DecodeBase64Data(T2A_SM(m2->getGroup(1).c_str()));
if (pStream != NULL) {
//.........这里部分代码省略.........
示例9: OptTree_ProcessMessage
//.........这里部分代码省略.........
tvis.item.lParam = -1;
tvis.item.state |= TVIS_BOLD;
tvis.item.stateMask |= TVIS_BOLD;
tvis.item.iImage = tvis.item.iSelectedImage = IMG_GRPOPEN;
} else
{
tvis.item.lParam = indx;
if (options[indx].groupId == OPTTREE_CHECK)
{
tvis.item.iImage = tvis.item.iSelectedImage = IMG_NOCHECK;
} else
{
tvis.item.iImage = tvis.item.iSelectedImage = IMG_NORCHECK;
}
}
hItem = TreeView_InsertItem(hwndTree, &tvis);
if (!sectionName)
options[indx].hItem = hItem;
}
}
sectionLevel++;
hSection = hItem;
}
}
OptTree_Translate(hwndTree);
ShowWindow(hwndTree, SW_SHOW);
TreeView_SelectItem(hwndTree, OptTree_FindNamedTreeItemAt(hwndTree, 0, NULL));
break;
}
case WM_DESTROY:
{
ImageList_Destroy(TreeView_GetImageList(hwndTree, TVSIL_NORMAL));
break;
}
case WM_NOTIFY:
{
LPNMHDR lpnmhdr = (LPNMHDR)lparam;
if (lpnmhdr->idFrom != idcTree) break;
switch (lpnmhdr->code)
{
case NM_CLICK:
{
TVHITTESTINFO hti;
hti.pt.x=(short)LOWORD(GetMessagePos());
hti.pt.y=(short)HIWORD(GetMessagePos());
ScreenToClient(lpnmhdr->hwndFrom,&hti.pt);
if(TreeView_HitTest(lpnmhdr->hwndFrom,&hti))
{
if(hti.flags&TVHT_ONITEMICON)
{
TVITEM tvi;
tvi.mask=TVIF_HANDLE|TVIF_PARAM|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
tvi.hItem=hti.hItem;
TreeView_GetItem(lpnmhdr->hwndFrom,&tvi);
switch (tvi.iImage)
{
case IMG_GRPOPEN:
tvi.iImage = tvi.iSelectedImage = IMG_GRPCLOSED;
TreeView_Expand(lpnmhdr->hwndFrom, tvi.hItem, TVE_COLLAPSE);
break;
case IMG_GRPCLOSED:
tvi.iImage = tvi.iSelectedImage = IMG_GRPOPEN;
TreeView_Expand(lpnmhdr->hwndFrom, tvi.hItem, TVE_EXPAND);
示例10: ImageList_Destroy
TreeView::ImageList::~ImageList()
{
if (handle)
ImageList_Destroy( static_cast<HIMAGELIST>(handle) );
}
示例11:
SmileyPackType::~SmileyPackType()
{
if (m_hSmList != NULL) ImageList_Destroy(m_hSmList);
}
示例12: GenMenuOpts
//.........这里部分代码省略.........
case WM_MOUSEMOVE:
if (!dat||!dat->dragging) break;
{
TVHITTESTINFO hti;
hti.pt.x=(short)LOWORD(lParam);
hti.pt.y=(short)HIWORD(lParam);
ClientToScreen(hwndDlg,&hti.pt);
ScreenToClient(GetDlgItem(hwndDlg,IDC_MENUITEMS),&hti.pt);
TreeView_HitTest(GetDlgItem(hwndDlg,IDC_MENUITEMS),&hti);
if (hti.flags&(TVHT_ONITEM|TVHT_ONITEMRIGHT)) {
HTREEITEM it = hti.hItem;
hti.pt.y -= TreeView_GetItemHeight(GetDlgItem(hwndDlg,IDC_MENUITEMS))/2;
TreeView_HitTest(GetDlgItem(hwndDlg,IDC_MENUITEMS),&hti);
if (!(hti.flags&TVHT_ABOVE))
TreeView_SetInsertMark(GetDlgItem(hwndDlg,IDC_MENUITEMS),hti.hItem,1);
else
TreeView_SetInsertMark(GetDlgItem(hwndDlg,IDC_MENUITEMS),it,0);
}
else {
if (hti.flags&TVHT_ABOVE) SendDlgItemMessage(hwndDlg,IDC_MENUITEMS,WM_VSCROLL,MAKEWPARAM(SB_LINEUP,0),0);
if (hti.flags&TVHT_BELOW) SendDlgItemMessage(hwndDlg,IDC_MENUITEMS,WM_VSCROLL,MAKEWPARAM(SB_LINEDOWN,0),0);
TreeView_SetInsertMark(GetDlgItem(hwndDlg,IDC_MENUITEMS),NULL,0);
} }
break;
case WM_LBUTTONUP:
if (!dat->dragging)
break;
TreeView_SetInsertMark(GetDlgItem(hwndDlg,IDC_MENUITEMS),NULL,0);
dat->dragging=0;
ReleaseCapture();
{
TVHITTESTINFO hti;
hti.pt.x=(short)LOWORD(lParam);
hti.pt.y=(short)HIWORD(lParam);
ClientToScreen(hwndDlg,&hti.pt);
ScreenToClient(GetDlgItem(hwndDlg,IDC_MENUITEMS),&hti.pt);
hti.pt.y-=TreeView_GetItemHeight(GetDlgItem(hwndDlg,IDC_MENUITEMS))/2;
TreeView_HitTest(GetDlgItem(hwndDlg,IDC_MENUITEMS),&hti);
if (hti.flags&TVHT_ABOVE) hti.hItem=TVI_FIRST;
if (dat->hDragItem==hti.hItem) break;
dat->hDragItem=NULL;
if (hti.flags&(TVHT_ONITEM|TVHT_ONITEMRIGHT)||(hti.hItem==TVI_FIRST)) {
HWND tvw;
HTREEITEM * pSIT;
HTREEITEM FirstItem=NULL;
UINT uITCnt,uSic ;
tvw=GetDlgItem(hwndDlg,IDC_MENUITEMS);
uITCnt=TreeView_GetCount(tvw);
uSic=0;
if (uITCnt) {
pSIT=(HTREEITEM *)mir_alloc(sizeof(HTREEITEM)*uITCnt);
if (pSIT) {
HTREEITEM hit;
hit=TreeView_GetRoot(tvw);
if (hit)
do {
TVITEM tvi={0};
tvi.mask=TVIF_HANDLE|TVIF_PARAM;
tvi.hItem=hit;
TreeView_GetItem(tvw,&tvi);
if (((MenuItemOptData *)tvi.lParam)->isSelected) {
pSIT[uSic]=tvi.hItem;
uSic++;
}
}while (hit=TreeView_GetNextSibling(tvw,hit));
// Proceed moving
{
UINT i;
HTREEITEM insertAfter;
insertAfter=hti.hItem;
for (i=0; i<uSic; i++) {
if (insertAfter) insertAfter=MoveItemAbove(tvw,pSIT[i],insertAfter);
else break;
if (!i) FirstItem=insertAfter;
} }
// free pointers...
mir_free(pSIT);
} }
if (FirstItem) TreeView_SelectItem(tvw,FirstItem);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
SaveTree(hwndDlg);
} }
break;
case WM_DESTROY:
if ( dat )
mir_free( dat );
ImageList_Destroy(TreeView_SetImageList(GetDlgItem(hwndDlg,IDC_MENUOBJECTS),NULL,TVSIL_NORMAL));
FreeTreeData( hwndDlg );
break;
}
return FALSE;
}
示例13: DlgProcOpts_Tab2
//.........这里部分代码省略.........
int itemType = SendDlgItemMessage(hwndDlg, IDC2_CONTACTS_LIST, CLM_GETITEMTYPE, (WPARAM)hItem, 0);
// Update list
if (itemType == CLCIT_CONTACT) { // A contact
SendDlgItemMessage(hwndDlg, IDC2_CONTACTS_LIST, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(nm->iColumn, iImage));
} else if (itemType == CLCIT_INFO) { // All Contacts
setAllChildIcons(GetDlgItem(hwndDlg, IDC2_CONTACTS_LIST), hItem, nm->iColumn, iImage);
} else if (itemType == CLCIT_GROUP) { // A group
hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC2_CONTACTS_LIST, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem);
if (hItem) {
setAllChildIcons(GetDlgItem(hwndDlg, IDC2_CONTACTS_LIST), hItem, nm->iColumn, iImage);
}
}
// Update the all/none icons
setListGroupIcons(GetDlgItem(hwndDlg, IDC2_CONTACTS_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC2_CONTACTS_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, NULL);
// Activate Apply button
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
}//end case NM_CLICK
}//end switch
break;
case 0:
switch (((LPNMHDR)lParam)->code)
{
case PSN_APPLY:
{
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)){
HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC2_CONTACTS_LIST, CLM_FINDCONTACT, hContact, 0);
if(hItem) {
int iImage = SendDlgItemMessage(hwndDlg, IDC2_CONTACTS_LIST, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(0,0));
MFENUM_MIRANDACONTACT_STATE contactState;
if (iImage == 0xFF){ //TODO impossible??
} else {
if (iImage == 1){
contactState = MFENUM_MIRANDACONTACT_STATE_ON;
} else {
contactState = MFENUM_MIRANDACONTACT_STATE_OFF;
}
}
//save to mirfoxData
int result = mirfoxMiranda.getMirfoxData().updateMirandaContactState(hContact, contactState);
if (result != 0){
//todo errors handling
}
//save to db 1 - on, 2 - off
if (contactState == MFENUM_MIRANDACONTACT_STATE_OFF){
db_set_b(hContact, PLUGIN_DB_ID, "state", 2);
} else {
db_set_b(hContact, PLUGIN_DB_ID, "state", 1);
}
}//TODO else { ... (and at others if(hItem))
//TODO contacts witch are not ay mirfoxData but on list
//( check hash concat(all id) on mirfoxData and on list, if doesn't match - refresh mirfoxData
//same for protocols
//for now it schould be ok
}
//TODO contacts at MirfoxData but not on list now
return TRUE;
}
}
break;
}
break;
case WM_DESTROY:
{
HIMAGELIST hIml=(HIMAGELIST)SendDlgItemMessage(hwndDlg, IDC2_CONTACTS_LIST, CLM_GETEXTRAIMAGELIST, 0, 0); //m_clc.h
ImageList_Destroy(hIml);
// use DestroyIcon only witchout icolib
DestroyIcon(icoHandle_ICON_OFF);
icoHandle_ICON_OFF = NULL;
DestroyIcon(icoHandle_ICON_FF);
icoHandle_ICON_FF = NULL;
break;
}
}//end switch
return 0;
}
示例14: LOWORD
BOOL CFlashPlayerDlg::PreTranslateMessage(MSG* pMsg)
{
int const wmId = LOWORD(pMsg->wParam);
if (pMsg->message == s_uTBBC)
{
if (!g_pTaskbarList)
{
HRESULT hr = CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&g_pTaskbarList));
if (SUCCEEDED(hr))
{
hr = g_pTaskbarList->HrInit();
if (FAILED(hr))
{
g_pTaskbarList->Release();
g_pTaskbarList = NULL;
}
if(g_pTaskbarList) {
hImglist = ImageList_LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_BITMAP_96),
16, 0, RGB(255,0,255), IMAGE_BITMAP, LR_CREATEDIBSECTION);
if (hImglist)
{
hr = g_pTaskbarList->ThumbBarSetImageList(this->m_hWnd, hImglist);
if (SUCCEEDED(hr))
{
THUMBBUTTON buttons[2] = {};
buttons[0].dwMask = THB_BITMAP | THB_FLAGS;
buttons[0].dwFlags = THBF_ENABLED;
buttons[0].iId = IDTB_PLAY_PAUSE;
if(IsFlashPlaying())
buttons[0].iBitmap = 1;
else
buttons[0].iBitmap = 0;
g_pTaskbarList->ThumbBarAddButtons(this->m_hWnd, 1, buttons);
}
g_pTaskbarList->SetProgressState(this->m_hWnd, TBPF_NORMAL);
ImageList_Destroy(hImglist);
}
}
}
}
} else if(pMsg->message == WM_COMMAND && (wmId == IDTB_PLAY_PAUSE)) {
if(IsFlashPlaying())
pFlashPtr->Stop();
else
pFlashPtr->Play();
UpdateThumbnailToolbar(m_hWnd);
} else {
switch(pMsg->message)
{
case WM_NCRBUTTONDOWN:
{
if(pMsg->wParam == HTMAXBUTTON || pMsg->wParam == HTMINBUTTON || pMsg->wParam == HTCLOSE)
break;
m_popmenu.GetSubMenu(0).TrackPopupMenu(TPM_LEFTALIGN, LOWORD(pMsg->lParam), HIWORD(pMsg->lParam), m_hWnd);
return TRUE;
}
case WM_SYSCHAR:
if (pMsg->wParam == 13)
FullScreen();
break;
case WM_KEYDOWN:
SendMessage(CMD_KEYDOWN, CMD_KEY, pMsg->wParam );
if(pMsg->wParam == 13)
return TRUE;
break;
case WM_LBUTTONDOWN:
POINT point;
GetCursorPos(&point);
if(m_fs && m_showctrl)
{
if(point.y < m_scr_height - 16)
break;
if(point.x < 5 || point.x > m_scr_width - 5)
break;
m_changing = true;
double pos = (double)(point.x - 5) / (double) (m_scr_width - 10);
pFlashPtr->GotoFrame((long)(m_fnumber * pos));
pFlashPtr->Play();
m_changing = false;
return TRUE;
}
break;
case WM_RBUTTONDOWN:
if(!m_rmenu)
{
SendMessage(CMD_KEYDOWN, CMD_KEY, WM_RBUTTONDOWN );
return TRUE;
}
break;
case WM_MOUSEMOVE:
{
if(!m_fs)
break;
ShowCursor(TRUE);
SetTimer(TIMER_HIDE_CURSOR, 2000, NULL);
POINT point;
//.........这里部分代码省略.........
示例15: DlgProc_Browse
HRESULT CALLBACK DlgProc_Browse (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
{
BROWSEDIALOGPARAMS *pbdp;
if (AfsAppLib_HandleHelp (IDD_APPLIB_BROWSE, hDlg, msg, wp, lp))
{
return FALSE;
}
if (msg == WM_INITDIALOG)
{
SetWindowLongPtr (hDlg, DWLP_USER, lp);
}
if ((pbdp = (BROWSEDIALOGPARAMS *)GetWindowLongPtr (hDlg, DWLP_USER)) != NULL)
{
switch (msg)
{
case WM_INITDIALOG:
DlgProc_Browse_OnInitDialog (hDlg, pbdp);
break;
case WM_NOTIFY:
switch (((LPNMHDR)lp)->code)
{
case LVN_ITEMCHANGED:
if ( ((LPNM_LISTVIEW)lp)->uNewState & LVIS_SELECTED )
{
DlgProc_Browse_SelectedEntry (hDlg, pbdp);
}
break;
case NM_DBLCLK:
PostMessage (hDlg, WM_COMMAND, MAKELONG(IDC_BROWSE_SELECT,BN_CLICKED), (LPARAM)GetDlgItem(hDlg,IDC_BROWSE_SELECT));
break;
}
break;
case WM_DESTROY:
DlgProc_Browse_StopSearch (pbdp);
if (pbdp->hImages != NULL)
{
ListView_SetImageList (GetDlgItem (hDlg, IDC_BROWSE_LIST), 0, 0);
ImageList_Destroy (pbdp->hImages);
}
break;
case WM_FOUNDNAME:
{
LPTSTR pszName = (LPTSTR)lp;
if (pszName != NULL)
{
HWND hList = GetDlgItem (hDlg, IDC_BROWSE_LIST);
LV_AddItem (hList, 1, INDEX_SORT, 0, 0, pszName);
FreeString (pszName);
}
break;
}
case WM_THREADSTART:
{
TCHAR szText[ cchRESOURCE ];
GetString (szText, IDS_BROWSE_WAITING);
SetDlgItemText (pbdp->hDlg, IDC_BROWSE_STATUS, szText);
break;
}
case WM_THREADDONE:
{
SetDlgItemText (pbdp->hDlg, IDC_BROWSE_STATUS, TEXT(""));
break;
}
case WM_COMMAND:
switch (LOWORD(wp))
{
case IDCANCEL:
EndDialog (hDlg, LOWORD(wp));
break;
case IDC_BROWSE_SELECT:
if ( (GetDlgItem (pbdp->hDlg, IDC_BROWSE_NONE) != NULL) &&
(IsDlgButtonChecked (pbdp->hDlg, IDC_BROWSE_NONE)) )
{
pbdp->szCell[0] = TEXT('\0');
pbdp->szNamed[0] = TEXT('\0');
}
else
{
GetDlgItemText (hDlg, IDC_BROWSE_CELL, pbdp->szCell, cchNAME);
GetDlgItemText (hDlg, IDC_BROWSE_NAMED, pbdp->szNamed, cchRESOURCE);
}
EndDialog (hDlg, IDOK);
break;
case IDC_BROWSE_CELL:
if (HIWORD(wp) == CBN_SELCHANGE)
{
GetDlgItemText (hDlg, IDC_BROWSE_CELL, pbdp->szCell, cchNAME);
//.........这里部分代码省略.........