Please help a newbie

I have 3 questions I need help with. Im using MSVC++.

Firstly can someone help me to load in an image in a console application, any format, which ever is easiest.

Secondly, if I were to uses a switch case statement how could I have a case where if you press a key the program ends. The only way I can end a console application at the moment is to click the 'x' in the corner.

Thirdly, how do I change the icon of a compiled program. I can create a shortcut and then change it, but what I really would like is for it to compile with a new icon rather than the standard window icon.

Thanx in advance for any help

Adam

Comments

  • : I have 3 questions I need help with. Im using MSVC++.
    :
    : Firstly can someone help me to load in an image in a console application, any format, which ever is easiest.
    :

    MB someone else can answer that.

    : Secondly, if I were to uses a switch case statement how could I have a case where if you press a key the program ends. The only way I can end a console application at the moment is to click the 'x' in the corner.
    :
    Here's an example out of one of my progs, mb it can help...
    [code]

    // this is where all window messages are handled
    LRESULT CALLBACK WndProc( HWND hWnd, // Handle For This Window
    UINT uMsg, // Message For This Window
    WPARAM wParam, // Additional Message Information
    LPARAM lParam) // Additional Message Information
    {
    switch (uMsg) // Check For Windows Messages
    {
    case WM_ACTIVATE: // Watch For Window Activate Message
    {
    if (!HIWORD(wParam)) // Check Minimization State
    {
    active=TRUE; // Program Is Active
    }
    else
    {
    active=FALSE; // Program Is No Longer Active
    }

    return 0; // Return To The Message Loop
    }
    case WM_SYSCOMMAND: // Intercept System Commands
    {
    switch (wParam) // Check System Calls
    {
    case SC_SCREENSAVE: // Screensaver Trying To Start?
    case SC_MONITORPOWER: // Monitor Trying To Enter Powersave?
    return 0; // Prevent From Happening
    }
    break; // Exit
    }
    case WM_CLOSE: // Did We Receive A Close Message?
    {
    PostQuitMessage(0); // Send A Quit Message
    return 0; // Jump Back
    }
    case WM_KEYDOWN: // Is A Key Being Held Down?
    {
    keys[wParam] = TRUE; // If So, Mark It As TRUE
    return 0; // Jump Back
    }
    case WM_KEYUP: // Has A Key Been Released?
    {
    keys[wParam] = FALSE; // If So, Mark It As FALSE
    return 0; // Jump Back
    }
    case WM_SIZE: // Resize The OpenGL Window
    {
    ReSizeGLScene(LOWORD(lParam),HIWORD(lParam)); // LoWord=Width, HiWord=Height
    return 0; // Jump Back
    }
    }
    // Pass All Unhandled Messages To DefWindowProc (so windows can deal with them)
    return DefWindowProc(hWnd,uMsg,wParam,lParam);
    }
    [/code]

    : Thirdly, how do I change the icon of a compiled program. I can create a shortcut and then change it, but what I really would like is for it to compile with a new icon rather than the standard window icon.
    :

    In DevStudio, click the Resources Tab in the Workspace, then expand the Icon folder, then double-click on IDR_MAINFRAME to bring up the icon in the resource editor.

    : Thanx in advance for any help
    :
    : Adam
    :

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion