Winamp ó·³ º®¿¡ ºÙÀ̱â


1.¿ä¾à

Winamp ¿¡¼­ º¸¸é ÇÁ·Î±×·¥ÀÌ ¿òÁ÷ÀÌ´Ù°¡ º®¿¡ ´Þ¶ó ºÙÁÒ? ±×°É ±¸ÇöÇØ º¸µµ·Ï ÇϰڽÀ´Ï´Ù.


2.º»¹®

À©µµ¿ì°¡ ¿òÁ÷À϶§ ¸Þ¼¼Áö°¡ ¹ß»ýÇÕ´Ï´Ù. WM_WINDOWPOSCHANGING À̶ó´Â ¸Þ¼¼Áö°¡ ¹ß»ýÇÏÁÒ. À̶§ ¹ß»ýÇÏ´Â ¸Þ¼¼Áö¿¡¼­ À©µµ¿ìÀÇ À§Ä¡¸¦ ºñ±³Çؼ­ Àû´çÇÑ Offset ¿¡ °É·ÈÀ»¶§ À©µµ¿ì¸¦ °­Á¦·Î ¿Å°Ü ÁÖ¸é µË´Ï´Ù.
¾Æ·¡ÀÇ ¼Ò½º¸¦ Âü°íÇϼ¼¿ä.


3.¿¹Á¦


// m_nYOffset °ú m_nXOffset °ªÀ» ¹Ù²Ù¾î ÁÖ½Ã¸é µË´Ï´Ù. 



void CSnapDialog::OnWindowPosChanging( WINDOWPOS* lpwndpos ) 

{ 

    CRect wndRect, trayRect; 

    int leftTaskbar = 0, rightTaskbar = 0, topTaskbar = 0, bottomTaskbar = 0; 

    

    GetWindowRect(&wndRect); 

    

    // Screen resolution 

    int screenWidth = GetSystemMetrics(SM_CXSCREEN); 

    int screenHeight = GetSystemMetrics(SM_CYSCREEN); 

    

    // Find the taskbar 

    CWnd* pWnd = FindWindow(_T("Shell_TrayWnd"), _T("")); 

    pWnd->GetWindowRect(&trayRect); 

    

    int wndWidth = wndRect.right - wndRect.left; 

    int wndHeight = wndRect.bottom - wndRect.top; 

    

    if(trayRect.top <= 0 && trayRect.left <= 0 && trayRect.right >= screenWidth) { 

        // top taskbar 

        topTaskbar = trayRect.bottom - trayRect.top; 

    } 

    else if(trayRect.top > 0 && trayRect.left <= 0) { 

        // bottom taskbar 

        bottomTaskbar = trayRect.bottom - trayRect.top; 

    } 

    else if(trayRect.top <= 0 && trayRect.left > 0) { 

        // right taskbar 

        rightTaskbar = trayRect.right - trayRect.left; 

    } 

    else { 

        // left taskbar 

        leftTaskbar = trayRect.right - trayRect.left; 

    } 

    

    // Snap to screen border 

    // Left border 

    if(lpwndpos->x >= -m_nXOffset + leftTaskbar && lpwndpos->x <= leftTaskbar + m_nXOffset) { 

        lpwndpos->x = leftTaskbar; 

    } 

    

    // Top border 

    if(lpwndpos->y >= -m_nYOffset && lpwndpos->y <= topTaskbar + m_nYOffset) { 

        lpwndpos->y = topTaskbar; 

    } 

    

    // Right border 

    if(lpwndpos->x + wndWidth <= screenWidth - rightTaskbar + m_nXOffset && 

        lpwndpos->x + wndWidth >= screenWidth - rightTaskbar - m_nXOffset) { 

        lpwndpos->x = screenWidth - rightTaskbar - wndWidth; 

    } 

    

    // Bottom border 

    if( lpwndpos->y + wndHeight <= screenHeight - bottomTaskbar + m_nYOffset 

        && lpwndpos->y + wndHeight >= screenHeight - bottomTaskbar - m_nYOffset) { 

        lpwndpos->y = screenHeight - bottomTaskbar - wndHeight; 

    } 

} 

winamp.zip ´Ù¿î·Îµå


- 2001.08.13 Smile Seo -