[Home]
[Edit this page]
[Recent Changes]
[Special Pages]
[Help]
CppGetRegionData
Uses the function GetRgnDataSize below:
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
CppGetRegionData
(Win32 API) GetRegionData
Gets the ?RGNDATA from a HRGN.int main() { //Create an elliptic region HRGN r = CreateEllipticRgn(2,3,6,10); const int size = GetRgnDataSize(r); RGNDATA * const d = (RGNDATA*)std::malloc(sizeof(RGNDATA) + (size * sizeof(char))); assert(d!=0 || !"Memory allocation RGNDATA failed"); const int getRegionDataVal = GetRegionData(r,size,d); assert(getRegionDataVal > 0); //Free the RGNDATA std::free(d); }
- include <cassert>
Uses the function GetRgnDataSize below:
int GetRgnDataSize(const HRGN region) { int size = 10; for ( ; ; size*=10) { RGNDATA * const d = (RGNDATA*)std::malloc(sizeof(RGNDATA) + (size * sizeof(char))); assert(d!=0 || !"Memory allocation RGNDATA failed"); //Get the data size const int getRegionDataVal = GetRegionData(region,size,d); std::free(d); if (getRegionDataVal > 0) return getRegionDataVal; } }
- include <cassert>
Code links
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
