[Home]  [Edit this page]  [Recent Changes]  [Special Pages]  [Help
CppGetRegionData

(Win32 API) GetRegionData

Gets the  ?RGNDATA from a HRGN.

  1. include <cassert>
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); }


Uses the function GetRgnDataSize below:
  1. include <cassert>
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; } }


Code links



last edited (May 23, 2007) by bilderbikkel, Number of views: 1108, Current Rev: 5 (Diff)

[Edit this page]  [Page history]  [What links here]  [Discuss this topic]  [Printer Friendly]  

Members

Username:

Password:


Register
Forgot Password?




Programmers Heaven - for .NET, Java, C/C++ and WEB Developers!
© 1996-2008 Community Networks Ltd. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited. Violators of this policy may be subject to legal action. Please read Terms Of Use and Privacy Statement for more information. Development by Tore Nestenius at .NET Consultant - Synchron Data.