+ // Allocate a window ID
+ {
+ int idx;
+ tWindowBlock *block, *prev;
+ block = &gAxWin3_WindowList;
+ newWinID = giAxWin3_LowestFreeWinID;
+ for( idx = 0; block; newWinID ++ )
+ {
+ if( block->Windows[idx] == NULL )
+ break;
+ idx ++;
+ if(idx == WINDOWS_PER_ALLOC) {
+ prev = block;
+ block = block->Next;
+ idx = 0;
+ }
+ }
+
+ if( !block )
+ {
+ block = calloc(sizeof(tWindowBlock), 1);
+ prev->Next = block;
+ idx = 0;
+ }
+
+ ret = block->Windows[idx] = AxWin3_int_CreateWindowStruct(newWinID, DataBytes);