³ª.´ëÈ­»óÀÚ Á¤¸®

µµ¿ò¸» ¸Þ´ºÀÇ ÇÁ·Î±×·¥ ¼Ò°³¸¦ ÀÛ¼ºÇÑ´Ù. ´ëÈ­»óÀÚ ÅÛÇø®Æ®¸¦ ¸¸µç´Ù¸é Á» ¸ÚÀÖ°Ô ÀÛ¼ºÇÒ ¼öµµ ÀÖÁö¸¸ ½Ç½À ¿¹Á¦ ¼öÁØ¿¡´Â ¸ÂÁö ¾ÊÀ¸¹Ç·Î ¸Þ½ÃÁö ¹Ú½º·Î °£´ÜÇÏ°Ô ¼Ò°³¸¸ Çϱâ·Î ÇÏÀÚ.

 

LRESULT Main_OnCommand(HWND hWnd,WPARAM wParam,LPARAM lParam)

{

   ....

   case IDM_HELP_ABOUT:

      MessageBox(hWnd,"C¾ð¾î¿Í API ½Ç½ÀÀ» À§ÇÑ ¿¹Á¦ ApiDrawÀÔ´Ï´Ù.\n"

          "ÀÌ ¿¹Á¦ÀÇ ¼Ò½º¿Í ¼³¸í ¹®¼­´Â http://www.winapi.co.kr¿¡ ÀÖ½À´Ï´Ù.",

          "ÇÁ·Î±×·¥ ¼Ò°³",MB_OK);

      break;

 

´ÙÀ½Àº ¸ðµç ´ëÈ­»óÀÚ¸¦ ºÎ¸ðÀÇ Áß¾Ó¿¡ ³ªÅ¸³ªµµ·Ï ÇØ º¸ÀÚ. ´ëÈ­»óÀÚ°¡ Ç×»ó ĵ¹ö½º Á»ó´Ü¿¡ ¿­¸®±â ¶§¹®¿¡ º°·Î º¸±â¿¡ ÁÁÁö ¾Ê´Ù. ´ÙÀ½ À¯Æ¿¸®Æ¼ ÇÔ¼ö¸¦ Ãß°¡ÇÑ´Ù.

 

void MoveToParentCenter(HWND hWnd)

{

   RECT wrt,crt;

   HWND hParent;

 

   hParent=GetParent(hWnd);

   if (IsIconic(hParent)) {

      ShowWindow(hParent,SW_RESTORE);

   }

 

   GetWindowRect(hParent,&wrt);

   GetWindowRect(hWnd,&crt);

   SetWindowPos(hWnd,HWND_NOTOPMOST,wrt.left+(wrt.right-wrt.left)/2-(crt.right-crt.left)/2,

      wrt.top+(wrt.bottom-wrt.top)/2-(crt.bottom-crt.top)/2,0,0,SWP_NOSIZE);

}

 

´ëÈ­»óÀÚÀÇ ÇÚµéÀ» ÁÖ¸é ºÎ¸ðÀÇ Áß¾ÓÀ» Á¶»çÇÏ¿© ´ëÈ­»óÀÚ¸¦ À̵¿½ÃŲ´Ù. ´ëÈ­»óÀÚ ÇÁ·Î½ÃÀúÀÇ WM_INITDIALOG¿¡¼­ ÀÌ ÇÔ¼ö¸¦ È£ÃâÇÏ¸é µÈ´Ù. ÀÌ ÇÁ·Î±×·¥¿¡´Â ¼¼ °³ÀÇ ´ëÈ­»óÀÚ°¡ Àִµ¥ ¸ðµÎ ¶È°°ÀÌ Ã³¸®ÇÏ¸é µÈ´Ù.

 

BOOL CALLBACK GridDlgProc(HWND hDlg,UINT iMessage,WPARAM wParam,LPARAM lParam)

{

   switch(iMessage) {

   case WM_INITDIALOG:

      MoveToParentCenter(hDlg);

      ....

 

³ª¸ÓÁö µÎ ´ëÈ­»óÀÚ¿¡µµ °°Àº Äڵ带 »ðÀÔÇϵµ·Ï ÇÏÀÚ. ÀÌÁ¦ ´ëÈ­»óÀÚ°¡ ºÎ¸ðÀÇ Áß¾Ó¿¡ ³ªÅ¸³¯ °ÍÀÌ´Ù.