www.pudn.com > SDK 工具条,分割条,TREE 等控件演示代码.rar > childwindow.cpp


#include "WinMain.h" 
#include "childwindow.h" 
#include "listviewchat.h" 
#include "comlist.h" 
#include "richeditt.h"  
#include "fenge.h" 
#include "button.h" 
 
 
extern HINSTANCE hInst; 
 
 int b; 
 
 
 
HWND hChildw; 
registerchildwindow(HWND hWnd) 
{ 
	WNDCLASSEX chiwclass; 
 
	chiwclass.cbSize = sizeof(chiwclass); 
	chiwclass.style = CS_HREDRAW|CS_VREDRAW|CS_OWNDC; 
	chiwclass.lpfnWndProc = ChildWndProcw; 
	chiwclass.cbClsExtra =0; 
	chiwclass.cbWndExtra =0; 
	chiwclass.hInstance = hInst; 
	chiwclass.hIcon = NULL; 
	chiwclass.hCursor = LoadCursor(NULL,IDC_ARROW); 
	chiwclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); 
	chiwclass.lpszMenuName = NULL; 
	chiwclass.lpszClassName = "ChildWindoww"; 
	chiwclass.hIconSm = NULL; 
	RegisterClassEx(&chiwclass); 
 
	hChildw = CreateWindow("ChildWindoww", 
		"cw", 
		//WS_POPUP| 
		  WS_CHILD| 
		//WS_THICKFRAME| 
		  WS_VISIBLE, 
		//|WS_OVERLAPPEDWINDOW, 
		40,40, 
		400,100, 
		hWnd, 
		NULL, 
		hInst, 
		NULL 
		); 
 
 
} 
 
 
 
 
 
LRESULT CALLBACK ChildWndProcw(HWND hChildw,UINT iMsg,WPARAM wParam,LPARAM lParam) 
{ 
  
    
    RECT rectw,listbox,fenger,buttonr,hcwrect,comlistkks; 
	GetClientRect(hwndButton, &buttonr); 
 
    GetClientRect(hChildw, &rectw); 
    GetClientRect(fenge, &fenger); 
	GetClientRect(hListbox, &listbox); 
    GetClientRect(hChildw, &hcwrect); 
    GetClientRect(comlistkk, &comlistkks); 
    PAINTSTRUCT pss; 
	HDC mydc; 
	switch(iMsg) 
	{ 
	case WM_LBUTTONDOWN: 
 
 
 
 
		//  InvalidateRect(hChildw ,NULL,TRUE); 
		  return 0; 
 
	case WM_CREATE: 
       
      createcomlistkk(hChildw,0,200,hcwrect.right,144); 
      CreateListViewChat(hChildw); 
      createfenge(hChildw,0,150,200,3); 
      button(hChildw,0,0,160,100); 
	  
 
	      return 0; 
	case WM_SIZE: 
     // SendMessage(comlistkk, iMsg, wParam, lParam); 
		 
	  HDWP hdwp; 
 
       
	  hdwp = BeginDeferWindowPos(4); 
 
	   
  
	   
	  
      DeferWindowPos(hdwp,hListbox,NULL,0,rectw.bottom-(listbox.bottom-listbox.top)-31,rectw.right,62,SWP_NOZORDER); 
	  DeferWindowPos(hdwp,comlistkk,NULL,0,rectw.bottom-26,rectw.right-50,120,SWP_NOZORDER); 
 
	  DeferWindowPos(hdwp,fenge,NULL,0,rectw.bottom-29-4-2-(listbox.bottom -listbox.top),rectw.right,3,SWP_NOZORDER); 
       
      DeferWindowPos(hdwp,hwndButton,NULL,rectw.right-50+3,rectw.bottom-26,47,23,SWP_NOZORDER); 
 
	  switch (b) 
{ 
case 1: 
	{ 
	  DeferWindowPos(hdwp,hwndButton,NULL,0,0,rectw.right,rectw.bottom - (listbox.bottom - listbox.top) -4-3-5-(comlistkks.bottom - comlistkks.top),SWP_NOZORDER); 
	break; 
	} 
case 2: 
	{ 
	  DeferWindowPos(hdwp,hwndButton,NULL,0,0,rectw.right,rectw.bottom - (listbox.bottom - listbox.top) -4-3-5-(comlistkks.bottom - comlistkks.top)-50,SWP_NOZORDER); 
 
	} 
} 
 
	  EndDeferWindowPos(hdwp); 
	   
	  return 0; 
		 
    case WM_NOTIFY: 
 
		  return 0; 
	   
	case WM_DESTROY: 
		  
 
		return 0; 
	} 
	return DefWindowProc(hChildw,iMsg,wParam,lParam); 
} 
 
 
 
int cvut(int b) 
{ 
	 	 
		return b; 
} 
 
 
 
int dating(int b) 
{ 
 
    RECT rectw,listbox,fenger,buttonr,hcwrect,comlistkks; 
	GetClientRect(hwndButton, &buttonr); 
 
    GetClientRect(hChildw, &rectw); 
    GetClientRect(fenge, &fenger); 
	GetClientRect(hListbox, &listbox); 
    GetClientRect(hChildw, &hcwrect); 
    GetClientRect(comlistkk, &comlistkks); 
 
		  HDWP hdwp; 
 
       
	  hdwp = BeginDeferWindowPos(4); 
 
	   
  
	   
	  
      DeferWindowPos(hdwp,hListbox,NULL,0,rectw.bottom-(listbox.bottom-listbox.top)-31,rectw.right,62,SWP_NOZORDER); 
	  DeferWindowPos(hdwp,comlistkk,NULL,0,rectw.bottom-26,rectw.right-30,120,SWP_NOZORDER); 
	  DeferWindowPos(hdwp,fenge,NULL,0,rectw.bottom-29-4-2-(listbox.bottom -listbox.top),rectw.right,3,SWP_NOZORDER); 
switch (b) 
{ 
case 1: 
	{ 
	  DeferWindowPos(hdwp,hwndButton,NULL,0,0,rectw.right,rectw.bottom - (listbox.bottom - listbox.top) -4-3-5-(comlistkks.bottom - comlistkks.top),SWP_NOZORDER); 
	break; 
	} 
	case 2: 
	{ 
	  DeferWindowPos(hdwp,hwndButton,NULL,0,0,rectw.right,rectw.bottom - (listbox.bottom - listbox.top) -4-3-5-(comlistkks.bottom - comlistkks.top)-50,SWP_NOZORDER); 
 
	} 
} 
	  EndDeferWindowPos(hdwp); 
	  return 1; 
}