real calculator

i use dev c++ and you know how when you run the program it goes to a black screen and performs the task you want. you also know that when you buy your computer it comes with a calculater and has the buttons you can click and stuff like that..can you do thaat in c++? like can you make it actually look like a real calculator like the one that comes with the computer - thanks
can you do thaat in c++?


Yes.

like can you make it actually look like a real calculator like the one that comes with the computer


Yes.
how?
Same answer as the other thread.
oh graphics?
Well, yes. It's a graphic of a calculator.
Well, yes. It's a graphic of a calculator.
what do you mean
@Moschops I think he knows that. If you already replied here why don't you show him the code. Sorry Moschops man, that really annoyed me...

EDIT: You have also deleted the post i replied you of.
Last edited on
why don't you show him the code.


Okay.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#include <windows.h>
#include "Resource.h"

HINSTANCE hInst;
LRESULT CALLBACK WindProcedure(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);

INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
                   LPSTR lpCmdLine, int nCmdShow)
{
    WNDCLASSEX  WndCls;
    static char szAppName[] = "BitmapIntro";
    MSG         Msg;

	hInst       = hInstance;
    WndCls.cbSize        = sizeof(WndCls);
    WndCls.style         = CS_OWNDC | CS_VREDRAW | CS_HREDRAW;
    WndCls.lpfnWndProc   = WindProcedure;
    WndCls.cbClsExtra    = 0;
    WndCls.cbWndExtra    = 0;
    WndCls.hInstance     = hInst;
    WndCls.hIcon         = LoadIcon(NULL, IDI_APPLICATION);
    WndCls.hCursor       = LoadCursor(NULL, IDC_ARROW);
    WndCls.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
    WndCls.lpszMenuName  = NULL;
    WndCls.lpszClassName = szAppName;
    WndCls.hIconSm       = LoadIcon(hInstance, IDI_APPLICATION);
    RegisterClassEx(&WndCls);

    CreateWindowEx(WS_EX_OVERLAPPEDWINDOW,
                          szAppName,
                          "Bitmaps Fundamentals",
                          WS_OVERLAPPEDWINDOW | WS_VISIBLE,
                          CW_USEDEFAULT,
                          CW_USEDEFAULT,
                          CW_USEDEFAULT,
                          CW_USEDEFAULT,
                          NULL,
                          NULL,
                          hInstance,
                          NULL);

    while( GetMessage(&Msg, NULL, 0, 0) )
    {
        TranslateMessage(&Msg);
        DispatchMessage( &Msg);
    }

    return static_cast<int>(Msg.wParam);
}

LRESULT CALLBACK WindProcedure(HWND hWnd, UINT Msg,
			   WPARAM wParam, LPARAM lParam)
{
    HDC hDC, MemDCExercising;
    PAINTSTRUCT Ps;
    HBITMAP bmpExercising;

    switch(Msg)
    {
	case WM_DESTROY:
	    PostQuitMessage(WM_QUIT);
	    break;
	case WM_PAINT:
	    hDC = BeginPaint(hWnd, &Ps);

	    // Load the bitmap from the resource
	    bmpExercising = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_EXERCISING));
	    // Create a memory device compatible with the above DC variable
	    MemDCExercising = CreateCompatibleDC(hDC);
             // Select the new bitmap
             SelectObject(MemDCExercising, bmpExercising);

	    // Copy the bits from the memory DC into the current dc
	    BitBlt(hDC, 10, 10, 450, 400, MemDCExercising, 0, 0, SRCCOPY);

	    // Restore the old bitmap
	    DeleteDC(MemDCExercising);
	    DeleteObject(bmpExercising);
	    EndPaint(hWnd, &Ps);
	    break;
	default:
	    return DefWindowProc(hWnd, Msg, wParam, lParam);
    }
    return 0;
}



Not very informative, and it will only work on Win32, and relies on him having a resource file with the appropriate contents. It was the best guess I could make about what kind of OS he might be using. I grabbed it from some webpage, and it's as informative here as it was there to someone at Moot's level.

This is why I didn't just "show him the code". Because graphics programming involves so many variables of computer and OS, and relies on so much prior-knowledge, that it's either too complicated to be useful, or it's done using a toolkit that makes the code so simple as to be of zero educational value.
Last edited on
ok thanks for the help
@Moschops And.. you are done, no arguments no nothing... bravo...
Topic archived. No new replies allowed.