我正在尝试使用以下代码迭代Window对象指针列表:
auto windowPtr = reinterpret_cast<std::list<Window>*>(lParam);
for (std::list<Window*>::const_iterator it = windowPtr.begin(); it != windowPtr.end(); ++it)
{
if ((*it)->handle == hwnd)
{
state = true;
}
}
但是我收到错误标记windowPtr.begin()
和windowPtr.end()
说:
std::list<Window> *windowPtr Error: expression must have class type
我在这里做错了什么?
答案 0 :(得分:0)
你正在寻找这样的东西吗?
<Panel>
<content>
<Button class="btn editTable"></Button>
</content>
</Panel>
<Table id="Listing" class="tableList" mode="MultiSelect" items="{path: 'masterData>/contactsList'}">
<columns>
<Column minScreenWidth="Tablet" demandPopin="true">
<Text text="{i18n>vendorNum}"/>
</Column>
<Column minScreenWidth="Tablet" demandPopin="true">
<Text text="{i18n>recipientType}"/>
</Column>
<Column minScreenWidth="Tablet" demandPopin="true">
<Text text="{i18n>eMail}"/>
</Column>
</columns>
<items>
<ColumnListItem>
<cells>
<Text text="{masterData>vendorNum}"/>
</cells>
<cells>
<Text text="{masterData>recipientType}"/>
</cells>
<cells>
<Text text="{masterData>eMail}"/>
</cells>
</ColumnListItem>
</items>
</Table>
或者您可以使用某些标准函数
BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam)
{
std::list<Window*>* windows = reinterpret_cast<std::list<Window*>>(lParam);
bool state = false;
for (std::list<Window*>::const_iterator it = windowPtr->begin(); it != windowPtr->end(); ++it)
{
if ((*it)->handle == hwnd)
{
state = true;
}
}
return TRUE;
}
int main(int argc, char** argv)
{
std::list<Window*> windows;
...
EnumWindows(EnumWindowsProc, (LPARAM)&windows);
}