Click here to Skip to main content
15,915,702 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: standard behavior for Alt key to show/hide Menu bar Pin
KingsGambit6-May-10 19:02
KingsGambit6-May-10 19:02 
GeneralRe: standard behavior for Alt key to show/hide Menu bar Pin
Emilio Garavaglia6-May-10 23:57
Emilio Garavaglia6-May-10 23:57 
QuestionFolder of self-delete executable not delete. Pin
Le@rner6-May-10 2:23
Le@rner6-May-10 2:23 
AnswerRe: Folder of self-delete executable not delete. Pin
Rajesh R Subramanian6-May-10 2:33
professionalRajesh R Subramanian6-May-10 2:33 
GeneralRe: Folder of self-delete executable not delete. Pin
CPallini6-May-10 2:40
mveCPallini6-May-10 2:40 
AnswerRe: Folder of self-delete executable not delete. Pin
David Crow6-May-10 2:50
David Crow6-May-10 2:50 
JokeRe: Folder of self-delete executable not delete. Pin
Code-o-mat6-May-10 22:17
Code-o-mat6-May-10 22:17 
QuestionGeo Location Pin
john56326-May-10 2:06
john56326-May-10 2:06 
AnswerRe: Geo Location Pin
CPallini6-May-10 2:23
mveCPallini6-May-10 2:23 
GeneralRe: Geo Location Pin
john56326-May-10 2:26
john56326-May-10 2:26 
GeneralRe: Geo Location Pin
markkuk6-May-10 2:42
markkuk6-May-10 2:42 
GeneralRe: Geo Location Pin
john56326-May-10 2:49
john56326-May-10 2:49 
GeneralRe: Geo Location Pin
markkuk6-May-10 3:40
markkuk6-May-10 3:40 
GeneralRe: Geo Location Pin
Cedric Moonen6-May-10 20:16
Cedric Moonen6-May-10 20:16 
QuestionRe: Geo Location Pin
David Crow6-May-10 2:58
David Crow6-May-10 2:58 
AnswerRe: Geo Location Pin
Emilio Garavaglia7-May-10 0:05
Emilio Garavaglia7-May-10 0:05 
QuestionSet size and postion of contols in c++ win 32 Pin
arun_pk5-May-10 23:47
arun_pk5-May-10 23:47 
AnswerRe: Set size and postion of contols in c++ win 32 Pin
csrss5-May-10 23:57
csrss5-May-10 23:57 
GeneralRe: Set size and postion of contols in c++ win 32 Pin
arun_pk6-May-10 0:00
arun_pk6-May-10 0:00 
GeneralRe: Set size and postion of contols in c++ win 32 Pin
CPallini6-May-10 0:15
mveCPallini6-May-10 0:15 
GeneralRe: Set size and postion of contols in c++ win 32 Pin
enhzflep6-May-10 0:25
enhzflep6-May-10 0:25 
Here's a mickey mouse example.

It assumes a child control (a button in my instance) exists and has the ID of IDC_BUTTON1 (#define IDC_BUTTON1 1000)

/*  This function is called by the Windows function DispatchMessage()  */

LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    int wWidth, wHeight;
    int bWidth, bHeight;
    RECT btnRect;
    HWND btnHwnd;
    switch (message)                  /* handle the messages */
    {
        case WM_DESTROY:
            PostQuitMessage (0);       /* send a WM_QUIT to the message queue */
            break;

        case WM_SIZE:
            // get size of the parent window's client area
            wWidth = LOWORD(lParam);
            wHeight = HIWORD(lParam);

            //  get RECT of the button (in parent's client coords)
            btnHwnd = GetDlgItem(hwnd, IDC_BUTTON1);
            GetWindowRect(btnHwnd, &btnRect);

            // determine it's dimensions
            bWidth = btnRect.right - btnRect.left;
            bHeight = btnRect.bottom - btnRect.top;

            // move it so that it retains its width and height, and is centered on the parent window.
            SetWindowPos(btnHwnd, HWND_TOP, (wWidth-bWidth)/2, (wHeight-bHeight)/2, bWidth, bHeight, SWP_SHOWWINDOW);
            break;

        default:                      /* for messages that we don't deal with */
            return DefWindowProc (hwnd, message, wParam, lParam);
    }

    return 0;
}

GeneralRe: Set size and postion of contols in c++ win 32 Pin
arun_pk6-May-10 2:17
arun_pk6-May-10 2:17 
GeneralRe: Set size and postion of contols in c++ win 32 Pin
enhzflep6-May-10 10:24
enhzflep6-May-10 10:24 
QuestionRe: Set size and postion of contols in c++ win 32 Pin
David Crow6-May-10 3:00
David Crow6-May-10 3:00 
Questionwin32 and gtk+ (vista glass) :( Pin
csrss5-May-10 23:30
csrss5-May-10 23:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.