- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
//generate the new objects
EnterCriticalSection(&csWinEvent);
value arr = alloc_array(windowStates.size());
int i=0;
for(
std::tr1::unordered_map<int,windowState>::const_iterator it = windowStates.begin();
it!=windowStates.end();
++it )
{
value o = alloc_empty_object();
//int hwnd
//int x,y,w,h
//int minimized,maximized,restored,closed
alloc_field(o, val_id("hwnd"), alloc_int(it->first));
alloc_field(o, val_id("window"), *(value*)GetWindowLongPtr((HWND)it->first,GWLP_USERDATA) );
alloc_field(o, val_id("x"), alloc_int(it->second.x));
alloc_field(o, val_id("y"), alloc_int(it->second.y));
alloc_field(o, val_id("w"), alloc_int(it->second.w));
alloc_field(o, val_id("h"), alloc_int(it->second.h));
alloc_field(o, val_id("minimized"), alloc_int(it->second.minimized));
alloc_field(o, val_id("maximized"), alloc_int(it->second.maximized));
alloc_field(o, val_id("restored"), alloc_int(it->second.restored));
alloc_field(o, val_id("closed"), alloc_int(it->second.closed));
val_array_set_i(arr,i,o);
++i;
}
windowStates.clear();
LeaveCriticalSection(&csWinEvent);