Can someone Help me?

This is a discussion on Can someone Help me? within the Windows Programming forums, part of the Platform Specific Boards category; hai,someone is good in programming. i have one question that i cracked my head.i really don't know how to do ...

  1. #1
    Mitchell
    Guest

    Can someone Help me?

    hai,someone is good in programming.
    i have one question that i cracked my head.i really don't know how to do it.can someone pls lead me to it?it will be very appreciated if u can help me.

    here is the question!
    write a pro to display a bitmap in the client area and provide a menu with the options:

    1.normal size
    2.double size
    3.half size.
    i hope u can give me solution as soon as u can coz i have to finish it up soon.Arigatou! This is my first time i am around in here.

  2. #2
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    look into StretchBlt() .This copies and can compress/enlarge a bitmap.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  3. #3
    Mitchell
    Guest

    Is there a way?

    moshi,stonedcoder

    yes,how to look in the stretchbit?would u tell me this one?i am new in here. would it make it into double size and half size of the bitmap size?looking forward...............urs response.

  4. #4
    Mitchell
    Guest

    Unhappy HELP!

    anyone who can help me with that question,pls?i need to finish it as soon by the day after tomolo?can u pls give me some code for that question?i really don't know how to do it? thax....really need the help for once in here.

  5. #5
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    Multiple posting/thread bumping is against the rules, please don't do it.

    If you want help with your code, post it, and tell us where it is broken.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  6. #6
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,138
    www.msdn.microsoft.com

    The StretchBlt function copies a bitmap from a source rectangle into a destination rectangle, stretching or compressing the bitmap to fit the dimensions of the destination rectangle, if necessary. The system stretches or compresses the bitmap according to the stretching mode currently set in the destination device context.

    BOOL StretchBlt(
    HDC hdcDest, // handle to destination device context
    int nXOriginDest, // x-coordinate of upper-left corner of dest. rectangle
    int nYOriginDest, // y-coordinate of upper-left corner of dest. rectangle
    int nWidthDest, // width of destination rectangle
    int nHeightDest, // height of destination rectangle
    HDC hdcSrc, // handle to source device context
    int nXOriginSrc, // x-coordinate of upper-left corner of source rectangle
    int nYOriginSrc, // y-coordinate of upper-left corner of source rectangle
    int nWidthSrc, // width of source rectangle
    int nHeightSrc, // height of source rectangle
    DWORD dwRop // raster operation code
    );



    If you need more help, show us what you've got so far.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  7. #7
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,855
    Look at GetObject() and BITMAP structure.

    In these two are the secret / answer.
    The rest is simple math and StretchBlt().
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  8. #8
    Mitchell
    Guest

    Unhappy is this the way?

    write a pro to display a bitmap in the client area and provide a menu with the options:

    1.normal size
    2.double size
    3.half size.


    i have written a program.i have error in it.i don't whether it's correct or not.is there anyone can correct it for me and see whether it meets the requirement of the question? thaxx......

    #include<afxwin.h>
    #include"resource.h"



    class MyWindowublic CFrameWnd
    {
    public:
    void OnLButtonDown(UINT flags,CPoint Point1);

    DECLARE_MESSAGE_MAP()
    };
    BEGIN_MESSAGE_MAP(MyWindow,CFrameWnd)
    ON_WM_LBUTTONDOWN()
    END_MESSAGE_MAP()

    void OnBitmap::OnLButtonDown(UINT flags,CPoint Point1)
    {
    CBitmap bmp;
    BITMAP bm;
    CClientDC d(this);
    CDC memdc;
    bmp.LoadBitmap(IDB_BITMAP1);
    bmp.GetObject(sizeof(BITMAP),&bm);
    memdc.CreateCompatibleDC(&d);
    memdc.SelectObject(&bmp);
    d.BitBIt(0,0,bm.bmWidth,bm.bmheight,&memdc,0,0,SRC COPY);

    };
    BOOL StretchBlt( 0,0,bm.bmwidth,*2,&memdc,0,0,SRCCOPY
    HDC hdcDest,
    int nXOriginDest,
    int nYOriginDest,
    int nWidthDest,
    int nHeightDest,
    HDC hdcSrc,
    int nXOriginSrc,
    int nYOriginSrc,
    int nWidthSrc,
    int nHeightSrc,
    DWORD dwRop
    );
    class MyAppublic CWinApp
    {
    public:
    BOOL InitInstance();
    BOOL ExitInstance();
    };
    BOOL MyApp::InitInstance()
    {
    ::MessageBox(0,"Sample Window","InitInstance",MB_OK|MB_ICONASTERISK);
    MyWindow *MyWindowObject;
    MyWindowObject=new MyWindow;
    m_pMainWnd=MyWindowObject;
    MyWindowObject->ShowWindow(SW_SHOWMAXIMIZED);
    hCursor=LoadCursor(MAKEINTRESOURCE(IDC_CURSOR1));
    return TRUE;

    }
    BOOL MyApp::ExitInstance()
    {
    ::MessageBox(0,"Sample Window","ExitInstance",MB_OK|MB_ICONHAND);
    return TRUE;
    }

    MyApp ApplicationObject;

    hope someone there can fixed this out for me. Urgent!

  9. #9
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,138
    For starters and without even looking at the errors:

    >provide a menu with the options

    I don't see any menu in your code.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  10. #10
    Registered User
    Join Date
    Dec 2001
    Posts
    18

    URGENT!

    #include<afxwin.h>
    #include"resource.h"



    class MyWindow:ublic CFrameWnd
    {
    protected:
    CMenu *m_MyMenu;
    public:
    void OnLButtonDown(UINT flags,CPoint Point1);
    MyWindow();
    DECLARE_MESSAGE_MAP()

    };
    BEGIN_MESSAGE_MAP(MyWindow,CFrameWnd)
    ON_WM_LBUTTONDOWN()
    END_MESSAGE_MAP()

    void OnBitmap::OnLButtonDown(UINT flags,CPoint Point1)
    {
    CBitmap bmp;
    BITMAP bm;
    CClientDC d(this);
    CDC memdc;
    bmp.LoadBitmap(IDB_BITMAP1);
    bmp.GetObject(sizeof(BITMAP),&bm);
    memdc.CreateCompatibleDC(&d);
    memdc.SelectObject(&bmp);
    d.BitBIt(0,0,bm.bmWidth,bm.bmheight,&memdc,0,0,SRC COPY);

    };
    BOOL StretchBlt( 0,0,bm.bmwidth,bm.bmheight*2,&memdc,0,0,SRCCOPY

    HDC hdcDest,
    int nXOriginDest,
    int nYOriginDest,
    int nWidthDest,
    int nHeightDest,
    HDC hdcSrc,
    int nXOriginSrc,
    int nYOriginSrc,
    int nWidthSrc,
    int nHeightSrc,
    DWORD dwRop
    );
    class MyAppublic CWinApp
    {
    public:
    BOOL InitInstance();
    BOOL ExitInstance();
    };
    BOOL MyApp::InitInstance()
    {
    ::MessageBox(0,"Sample Window","InitInstance",MB_OK|MB_ICONASTERISK);
    MyWindow *MyWindowObject;
    MyWindowObject=new MyWindow;
    m_pMainWnd=MyWindowObject;
    MyWindowObject->ShowWindow(SW_SHOWMAXIMIZED);
    hCursor=LoadCursor(MAKEINTRESOURCE(IDC_CURSOR1));

    return TRUE;

    }
    BOOL MyApp::ExitInstance()
    {
    ::MessageBox(0,"Sample Window","ExitInstance",MB_OK|MB_ICONHAND);
    return TRUE;
    }

    MyApp ApplicationObject;

    so,tell me what is wrong? plss...it's urgent!!!

  11. #11
    Registered User
    Join Date
    Dec 2001
    Posts
    18

    some moderator plss!!!!!

    hello,i really need a help in here. why no ones correct the coding for me? i really need to finish it by tomolo............ can someone plss help me? (( urgent plsss

  12. #12
    zen
    zen is offline
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Posts
    1,007
    When using MFC StretchBlit() is a member of CDC, so you want to remove the global function (I'm not sure what it's doing there anyway). Then replace the d.BitBlt() call with d.StretchBlt().
    zen

  13. #13
    Mitchel
    Guest

    Unhappy Hello Zen!!

    i am not so sure of that. can u pls....show me where is it broken or where is it wrong? maybe i have a suggestion...would u pls...
    write the whole coding in there? i just wanna someone to fix it up for me. i really need it tomolo morning..... it's so urgent......
    help help help plssssssssssss.................. ((

  14. #14
    zen
    zen is offline
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Posts
    1,007
    What exactly don't you understand?
    zen

  15. #15
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,138
    >why no ones correct the coding for me?
    >i just wanna someone to fix it up for me.

    This board is a board of volunteers. So if noone stepped up to help you, noone was motivated to do so. Some people already pointed out where you have to look for help. Stop with the Bitmap for a moment. Can you finish the rest of your assignment ? Do you have a specific question ? We aren't here to do homework for you. We will help you to learn C/C++ and we will help you to learn learning. The StretchBlt function will do what you want. Can you implement in pseudocode what you want your functions to do ?
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21