GetResObj returns an CIFWnd-pointer by default. This is the base type. For all UI types.
CIFStatic is a CIFWnd, but CIFWnd is not a CIFStatic. Assigning an CIFWnd-pointer to a CIFStatic-pointer would be an upcast (since CIFWnd is the parent and CIFStatic the derived class). So this wont work.
Since we KNOW (or at least hope) which type will be returned from GetResObject, we can use the reinterpret_cast-pry bar and make it a CIFStatic:
Code:
CIFStatic* label = reinterpret_cast<CIFStatic*>(wnd->m_IRM.GetResObj(13, 1));
Since this code is ugly, I made another version which casts it to the given type internally. Functionality is the same, but code is shorter and more readable.
Code:
CIFStatic* label = wnd->m_IRM.GetResObj<CIFStatic>(13, 1);
There are plenty of occurrences to use as examples:
[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]