comctl32: Use IS_INTRESOURCE instead of HIWORD to check a resource.

This commit is contained in:
Michael Stefaniuc 2010-01-26 00:50:44 +01:00 committed by Alexandre Julliard
parent 02bddd1caf
commit 223603cc1c
4 changed files with 30 additions and 30 deletions

View File

@ -717,7 +717,7 @@ static BOOL ANIMATE_OpenW(ANIMATE_INFO *infoPtr, HINSTANCE hInstance, LPWSTR lps
TRACE("(%s)\n", debugstr_w(lpszName));
if (HIWORD(lpszName))
if (!IS_INTRESOURCE(lpszName))
{
if (!ANIMATE_LoadResW(infoPtr, hInstance, lpszName))
{
@ -775,7 +775,7 @@ static BOOL ANIMATE_OpenA(ANIMATE_INFO *infoPtr, HINSTANCE hInstance, LPSTR lpsz
LRESULT result;
INT len;
if (!HIWORD(lpszName))
if (IS_INTRESOURCE(lpszName))
return ANIMATE_OpenW(infoPtr, hInstance, (LPWSTR)lpszName);
len = MultiByteToWideChar(CP_ACP, 0, lpszName, -1, NULL, 0);

View File

@ -1634,7 +1634,7 @@ ImageList_LoadImageA (HINSTANCE hi, LPCSTR lpbmp, INT cx, INT cGrow,
LPWSTR lpbmpW;
DWORD len;
if (!HIWORD(lpbmp))
if (IS_INTRESOURCE(lpbmp))
return ImageList_LoadImageW(hi, (LPCWSTR)lpbmp, cx, cGrow, clrMask,
uType, uFlags);

View File

@ -330,7 +330,7 @@ static void PROPSHEET_CollectSheetInfoA(LPCPROPSHEETHEADERA lppsh,
psInfo->ppshheader.pszCaption = NULL;
else
{
if (HIWORD(lppsh->pszCaption))
if (!IS_INTRESOURCE(lppsh->pszCaption))
{
int len = MultiByteToWideChar(CP_ACP, 0, lppsh->pszCaption, -1, NULL, 0);
WCHAR *caption = Alloc( len*sizeof (WCHAR) );
@ -373,7 +373,7 @@ static void PROPSHEET_CollectSheetInfoW(LPCPROPSHEETHEADERW lppsh,
psInfo->ppshheader.pszCaption = NULL;
else
{
if (HIWORD(lppsh->pszCaption))
if (!IS_INTRESOURCE(lppsh->pszCaption))
{
int len = strlenW(lppsh->pszCaption);
WCHAR *caption = Alloc( (len+1)*sizeof(WCHAR) );
@ -553,7 +553,7 @@ static BOOL PROPSHEET_CollectPageInfo(LPCPROPSHEETPAGEW lppsp,
WCHAR *text;
int len;
if ( !HIWORD( lppsp->pszTitle ) )
if (IS_INTRESOURCE( lppsp->pszTitle ))
{
if (!LoadStringW( lppsp->hInstance, (DWORD_PTR)lppsp->pszTitle,szTitle,sizeof(szTitle)/sizeof(szTitle[0]) ))
{
@ -2131,7 +2131,7 @@ static void PROPSHEET_SetCurSelId(HWND hwndDlg, int id)
*/
static void PROPSHEET_SetTitleA(HWND hwndDlg, DWORD dwStyle, LPCSTR lpszText)
{
if(HIWORD(lpszText))
if(!IS_INTRESOURCE(lpszText))
{
WCHAR szTitle[256];
MultiByteToWideChar(CP_ACP, 0, lpszText, -1,
@ -2153,7 +2153,7 @@ static void PROPSHEET_SetTitleW(HWND hwndDlg, DWORD dwStyle, LPCWSTR lpszText)
WCHAR szTitle[256];
TRACE("%s (style %08x)\n", debugstr_w(lpszText), dwStyle);
if (HIWORD(lpszText) == 0) {
if (IS_INTRESOURCE(lpszText)) {
if (!LoadStringW(psInfo->ppshheader.hInstance,
LOWORD(lpszText), szTitle, sizeof(szTitle)/sizeof(szTitle[0])))
return;
@ -2490,7 +2490,7 @@ static void PROPSHEET_SetWizButtons(HWND hwndDlg, DWORD dwFlags)
*/
static BOOL PROPSHEET_InsertPage(HWND hwndDlg, HPROPSHEETPAGE hpageInsertAfter, HPROPSHEETPAGE hpage)
{
if (!HIWORD(hpageInsertAfter))
if (IS_INTRESOURCE(hpageInsertAfter))
FIXME("(%p, %d, %p): stub\n", hwndDlg, LOWORD(hpageInsertAfter), hpage);
else
FIXME("(%p, %p, %p): stub\n", hwndDlg, hpageInsertAfter, hpage);
@ -2624,7 +2624,7 @@ static LRESULT PROPSHEET_IndexToId(HWND hwndDlg, int iPageIndex)
return 0;
}
psp = (LPCPROPSHEETPAGEW)psInfo->proppage[iPageIndex].hpage;
if (psp->dwFlags & PSP_DLGINDIRECT || HIWORD(psp->u.pszTemplate)) {
if (psp->dwFlags & PSP_DLGINDIRECT || !IS_INTRESOURCE(psp->u.pszTemplate)) {
return 0;
}
return (LRESULT)psp->u.pszTemplate;
@ -2684,7 +2684,7 @@ static void PROPSHEET_CleanUp(HWND hwndDlg)
TRACE("\n");
if (!psInfo) return;
if (HIWORD(psInfo->ppshheader.pszCaption))
if (!IS_INTRESOURCE(psInfo->ppshheader.pszCaption))
Free ((LPVOID)psInfo->ppshheader.pszCaption);
for (i = 0; i < psInfo->nPages; i++)
@ -2940,7 +2940,7 @@ HPROPSHEETPAGE WINAPI CreatePropertySheetPageA(
if ( !(ppsp->dwFlags & PSP_DLGINDIRECT) )
{
if (HIWORD( ppsp->u.pszTemplate ))
if (!IS_INTRESOURCE( ppsp->u.pszTemplate ))
{
int len = strlen(lpPropSheetPage->u.pszTemplate) + 1;
char *template = Alloc( len );
@ -2951,13 +2951,13 @@ HPROPSHEETPAGE WINAPI CreatePropertySheetPageA(
if (ppsp->dwFlags & PSP_USEICONID)
{
if (HIWORD( ppsp->u2.pszIcon ))
if (!IS_INTRESOURCE( ppsp->u2.pszIcon ))
PROPSHEET_AtoW(&ppsp->u2.pszIcon, lpPropSheetPage->u2.pszIcon);
}
if (ppsp->dwFlags & PSP_USETITLE)
{
if (HIWORD( ppsp->pszTitle ))
if (!IS_INTRESOURCE( ppsp->pszTitle ))
PROPSHEET_AtoW( &ppsp->pszTitle, lpPropSheetPage->pszTitle );
else
ppsp->pszTitle = load_string( ppsp->hInstance, ppsp->pszTitle );
@ -2970,7 +2970,7 @@ HPROPSHEETPAGE WINAPI CreatePropertySheetPageA(
if (ppsp->dwFlags & PSP_USEHEADERTITLE)
{
if (HIWORD( ppsp->pszHeaderTitle ))
if (!IS_INTRESOURCE( ppsp->pszHeaderTitle ))
PROPSHEET_AtoW(&ppsp->pszHeaderTitle, lpPropSheetPage->pszHeaderTitle);
else
ppsp->pszHeaderTitle = load_string( ppsp->hInstance, ppsp->pszHeaderTitle );
@ -2980,7 +2980,7 @@ HPROPSHEETPAGE WINAPI CreatePropertySheetPageA(
if (ppsp->dwFlags & PSP_USEHEADERSUBTITLE)
{
if (HIWORD( ppsp->pszHeaderSubTitle ))
if (!IS_INTRESOURCE( ppsp->pszHeaderSubTitle ))
PROPSHEET_AtoW(&ppsp->pszHeaderSubTitle, lpPropSheetPage->pszHeaderSubTitle);
else
ppsp->pszHeaderSubTitle = load_string( ppsp->hInstance, ppsp->pszHeaderSubTitle );
@ -3006,7 +3006,7 @@ HPROPSHEETPAGE WINAPI CreatePropertySheetPageW(LPCPROPSHEETPAGEW lpPropSheetPage
if ( !(ppsp->dwFlags & PSP_DLGINDIRECT) )
{
if (HIWORD( ppsp->u.pszTemplate ))
if (!IS_INTRESOURCE( ppsp->u.pszTemplate ))
{
int len = strlenW(lpPropSheetPage->u.pszTemplate) + 1;
WCHAR *template = Alloc( len * sizeof (WCHAR) );
@ -3017,7 +3017,7 @@ HPROPSHEETPAGE WINAPI CreatePropertySheetPageW(LPCPROPSHEETPAGEW lpPropSheetPage
if ( ppsp->dwFlags & PSP_USEICONID )
{
if (HIWORD( ppsp->u2.pszIcon ))
if (!IS_INTRESOURCE( ppsp->u2.pszIcon ))
{
int len = strlenW(lpPropSheetPage->u2.pszIcon) + 1;
WCHAR *icon = Alloc( len * sizeof (WCHAR) );
@ -3065,13 +3065,13 @@ BOOL WINAPI DestroyPropertySheetPage(HPROPSHEETPAGE hPropPage)
if (!psp)
return FALSE;
if ( !(psp->dwFlags & PSP_DLGINDIRECT) && HIWORD( psp->u.pszTemplate ) )
if (!(psp->dwFlags & PSP_DLGINDIRECT) && !IS_INTRESOURCE( psp->u.pszTemplate ))
Free ((LPVOID)psp->u.pszTemplate);
if ( (psp->dwFlags & PSP_USEICONID) && HIWORD( psp->u2.pszIcon ) )
if ((psp->dwFlags & PSP_USEICONID) && !IS_INTRESOURCE( psp->u2.pszIcon ))
Free ((LPVOID)psp->u2.pszIcon);
if ((psp->dwFlags & PSP_USETITLE) && HIWORD( psp->pszTitle ))
if ((psp->dwFlags & PSP_USETITLE) && !IS_INTRESOURCE( psp->pszTitle ))
Free ((LPVOID)psp->pszTitle);
Free(hPropPage);
@ -3292,7 +3292,7 @@ static LRESULT PROPSHEET_Paint(HWND hwnd, HDC hdcParam)
if (ppshpage->dwFlags & PSP_USEHEADERTITLE) {
SetRect(&r, 20, 10, 0, 0);
if (HIWORD(ppshpage->pszHeaderTitle))
if (!IS_INTRESOURCE(ppshpage->pszHeaderTitle))
DrawTextW(hdc, ppshpage->pszHeaderTitle, -1, &r, DT_LEFT | DT_SINGLELINE | DT_NOCLIP);
else
{
@ -3308,7 +3308,7 @@ static LRESULT PROPSHEET_Paint(HWND hwnd, HDC hdcParam)
if (ppshpage->dwFlags & PSP_USEHEADERSUBTITLE) {
SelectObject(hdc, psInfo->hFont);
SetRect(&r, 40, 25, rzone.right - 69, rzone.bottom);
if (HIWORD(ppshpage->pszHeaderTitle))
if (!IS_INTRESOURCE(ppshpage->pszHeaderTitle))
DrawTextW(hdc, ppshpage->pszHeaderSubTitle, -1, &r, DT_LEFT | DT_WORDBREAK);
else
{
@ -3470,7 +3470,7 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
}
}
if (!HIWORD(psInfo->ppshheader.pszCaption) &&
if (IS_INTRESOURCE(psInfo->ppshheader.pszCaption) &&
psInfo->ppshheader.hInstance)
{
WCHAR szText[256];

View File

@ -264,7 +264,7 @@ TOOLBAR_GetText(const TOOLBAR_INFO *infoPtr, const TBUTTON_INFO *btnPtr)
LPWSTR lpText = NULL;
/* NOTE: iString == -1 is undocumented */
if ((HIWORD(btnPtr->iString) != 0) && (btnPtr->iString != -1))
if (!IS_INTRESOURCE(btnPtr->iString) && (btnPtr->iString != -1))
lpText = (LPWSTR)btnPtr->iString;
else if ((btnPtr->iString >= 0) && (btnPtr->iString < infoPtr->nNumStrings))
lpText = infoPtr->strings[btnPtr->iString];
@ -1837,7 +1837,7 @@ TOOLBAR_InternalInsertButtonsT(TOOLBAR_INFO *infoPtr, INT iIndex, UINT nAddButto
btnPtr->dwData = lpTbb[iButton].dwData;
if (btnPtr->fsStyle & BTNS_SEP)
btnPtr->iString = -1;
else if(HIWORD(lpTbb[iButton].iString) && lpTbb[iButton].iString != -1)
else if(!IS_INTRESOURCE(lpTbb[iButton].iString) && lpTbb[iButton].iString != -1)
{
if (fUnicode)
Str_SetPtrW((LPWSTR*)&btnPtr->iString, (LPWSTR)lpTbb[iButton].iString );
@ -2897,7 +2897,7 @@ TOOLBAR_AddStringW (TOOLBAR_INFO *infoPtr, HINSTANCE hInstance, LPARAM lParam)
BOOL fFirstString = (infoPtr->nNumStrings == 0);
INT nIndex = infoPtr->nNumStrings;
if (hInstance && (HIWORD(lParam) == 0)) {
if (hInstance && IS_INTRESOURCE(lParam)) {
WCHAR szString[MAX_RESOURCE_STRING_LENGTH];
WCHAR delimiter;
WCHAR *next_delim;
@ -2965,7 +2965,7 @@ TOOLBAR_AddStringA (TOOLBAR_INFO *infoPtr, HINSTANCE hInstance, LPARAM lParam)
INT nIndex;
INT len;
if (hInstance && (HIWORD(lParam) == 0)) /* load from resources */
if (hInstance && IS_INTRESOURCE(lParam)) /* load from resources */
return TOOLBAR_AddStringW(infoPtr, hInstance, lParam);
p = (LPSTR)lParam;
@ -3362,7 +3362,7 @@ TOOLBAR_GetButtonInfoT(const TOOLBAR_INFO *infoPtr, INT Id, LPTBBUTTONINFOW lpTb
if (lpTbInfo->dwMask & TBIF_TEXT) {
/* TB_GETBUTTONINFO doesn't retrieve text from the string list, so we
can't use TOOLBAR_GetText here */
if (HIWORD(btnPtr->iString) && (btnPtr->iString != -1)) {
if (!IS_INTRESOURCE(btnPtr->iString) && (btnPtr->iString != -1)) {
LPWSTR lpText = (LPWSTR)btnPtr->iString;
if (bUnicode)
Str_GetPtrW(lpText, lpTbInfo->pszText, lpTbInfo->cchText);
@ -4142,7 +4142,7 @@ TOOLBAR_Restore(TOOLBAR_INFO *infoPtr, const TBSAVEPARAMSW *lpSave)
/* can't contain real string as we don't know whether
* the client put an ANSI or Unicode string in there */
if (HIWORD(nmtbr.tbButton.iString))
if (!IS_INTRESOURCE(nmtbr.tbButton.iString))
nmtbr.tbButton.iString = 0;
TOOLBAR_InsertButtonT(infoPtr, -1, &nmtbr.tbButton, TRUE);