Not sure what you mean. Do you expect a thread to do some work inside your window proc and end before the window proc ends?
well, yea. i want it to do all the MoveWindow calls that ive done under WM_SIZE so that it will happen faster and the screen wont blink when i resize the window.
Code:
case WM_SIZE:
// on every WM_SIZE msg to parent window, we want the children windows to resize as well
hdc = GetDC (hwnd) ;
GetTextMetrics (hdc, &tm) ;
ReleaseDC (hwnd, hdc) ;
//rect.right is how wide the list window is
rect.right=
// new width of parent window
LOWORD(lParam)
// - size mod tmAveCharWidth to avoid letter clipping
- (LOWORD(lParam)%tm.tmAveCharWidth)
// + vScrollSize
+ vScrollSize
// - area dedicated for IDD_LIST_BUTTONS dialog
- tm.tmAveCharWidth*18;
//calculates the size of one colume
rect.right=rect.right/4-rect.right%tm.tmAveCharWidth;
//rect.bottom is how high the list window is
rect.bottom=
// new height of parent window
HIWORD(lParam)
// - size mod tmHeight to avoid letter clipping
- (HIWORD(lParam)%tm.tmHeight)
// - Y position of list window to leave some empty space under it
- tm.tmHeight * 3;
MoveWindow(hwndListFname,
tm.tmAveCharWidth, // 1 char from the left side of main window
tm.tmHeight * 3, // 3 chars from the top side of main window
rect.right,
rect.bottom,
FALSE);
MoveWindow(hwndListLname,
tm.tmAveCharWidth+rect.right, // starts where 1st one stops
tm.tmHeight * 3, // 3 chars from the top side of main window
rect.right,
rect.bottom,
FALSE);
MoveWindow(hwndListHphone,
tm.tmAveCharWidth+2*rect.right, // starts where 2nd one stops
tm.tmHeight * 3, // 3 chars from the top side of main window
rect.right,
rect.bottom,
FALSE);
MoveWindow(hwndListCphone,
tm.tmAveCharWidth+3*rect.right, // starts where 3rd one stops
tm.tmHeight * 3, // 3 chars from the top side of main window
rect.right,
rect.bottom,
FALSE);
MoveWindow(hwndListButtons,
4*rect.right+tm.tmAveCharWidth,
tm.tmHeight * 3,
13*tm.tmAveCharWidth,
8*tm.tmHeight, FALSE);
return 0 ;
and ive changed it to this:
Code:
case WM_SIZE:
EnterCriticalSection( &cs );
handle=_beginthread( MoveWindowThread, 0, NULL );
LeaveCriticalSection( &cs );
GetExitCodeThread(handle,&code);
ExitThread(code);
return 0 ;
where MoveWindowThread does all of the above. should i post it as well? i didnt coz i dont want to fill up with too much code....
oh, and ive just saw there is a CreateThread function for win32 progs... should i use that one instead?