This example:
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <commctrl.h>
HWND hWndGrid;
RECT rc;
int nItem, nSubItem;
//#define ListView_GetItemRect(hwnd,i,prc,code) (BOOL)SNDMSG((hwnd),LVM_GETITEMRECT,(WPARAM)(int)(i),((prc)?(((RECT*)(prc))->left = (code),(LPARAM)(RECT*)(prc)):(LPARAM)(RECT*)NULL))
void LVTest(void)
{
if (nSubItem == 0)
{
ListView_GetItemRect(hWndGrid, nItem, &rc, LVIR_LABEL);
}
else
{
ListView_GetSubItemRect(hWndGrid, nItem, nSubItem, LVIR_BOUNDS, &rc);
}
//If I use SendMessage instead of the macros, then I don't get the error message. Strange stuff. Below is the code which compiled with no errors.
if (nSubItem == 0)
{
SendMessage(hWndGrid, (UINT)LVM_GETITEMRECT, (WPARAM)LVIR_BOUNDS, (LPARAM) & rc);
}
else
{
SendMessage(hWndGrid, (UINT)LVM_GETSUBITEMRECT, (WPARAM)LVIR_LABEL, (LPARAM) & rc);
}
}
Gives this error:
LVTest.c(11): error #3114: [asm] Invalid combination of opcode and operands.
LVTest.c(11): error #3114: [asm] Invalid combination of opcode and operands.