Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   C++ (http://www.programmingforums.org/forum15.html)
-   -   Proper noob Q (http://www.programmingforums.org/showthread.php?t=1929)

Ade Jan 21st, 2005 4:51 AM

Proper noob Q
 
OK, I've asked around at my college and none of the teachers seem to know (I can't wait till Uni so the teachers actually know stuff :S).

I'm wondering how to make windows applications using C++. I've read a tutorial on Windows API (http://www.relisoft.com/win32/index.htm) but that quickly was above my head and didn't really explain anything.

I was able to create a windows window and change a few variables such as the title, the background colour and the size, but that's all.

I really wanna get this down for my current project at college which is in like 6 weeks. All I really want to be able to do is put a C++ program into a windows window and make it look nicer than the cmd style black screen. I just want it to be basic text, but formated text on a white background.

So, could anyone recommend what I should be researching? All my research so far has found that it's done in VB, but this project needs to be in C++ and it must be possible as I got that windows using c++. Even better for me would be if someone could point me in the direction of a good book or and online tutorial (but a good one :P)




Thanks guys

Broax Jan 21st, 2005 5:15 AM

Shouldn't this be in the c++ forum?

Anyway, I've never programmed a line in my life, but c++.com seems to be have a nice tutorial on c++ basics... It's the one that I'm using at least... I don't know if its any good for you, but the other members should know that...

Here's just a suggestion, though... :p ;)

Ade Jan 21st, 2005 6:07 AM

I'm already wuite good with C++, it's the windows bit I need to know about, I'll see ifanyone else thinks it should be in the C++ forum.

thanks anyway :)

bl00dninja Jan 21st, 2005 8:05 AM

free book
 
i may be talking out of my ass here because i don't really know much about GUI programming yet, but trolltech, the creators of QT, which is a cross-platform gui development software released their book on QT3 for free as a pdf document on their website below...

http://www.trolltech.com/

i just went to their site and couldn't find it now, but i didn't really look that hard (it used to be on the main page). i'm sure it's still there. i printed it out at work (i'm a lab tech for the army so YOUR tax dollars paid for me to have a free copy of this $50.00 book :-) [toner isn't cheap, and my inkjet printer is slow] i even used the army's hole-punch to punch holes in it. i'm cool.)... anyway, i wanted to buy it and grabbed it up as soon as they released it for free. it'e probably still there and seems to be a great GUI development tool for C++. hope this help man, otherwise kick me in the nuts, (i am an okuden [lower black belt in kijutsu] and can take this without flinching).

am i just missing something, or are the tools for "enhancing" threads just not here yet? code tage, other tags, your-mom tags, super-smileys, crack-cocaine, and hemmhoroid control as well as bowel-obstruction roro-rooters.

Broax Jan 21st, 2005 8:13 AM

If someone kicks me in the nuts I shall say "ouch" for I don't have a belt at anything (or rather, the only belt I've got is holding my pants...).

bl00dninja Jan 21st, 2005 8:30 AM

i have a black belt in kijutsu,

the test was this:

1. get punched in the throat full-force by an 8th degree black belt

2. get punched in the solar plexus full-force by an 8th degree black belt

3. get kicked in the nuts full-force by an 8th degree black belt

i also have a 3rd degree black belt in white-crane shorin-ryu karate, a 3rd degree black belt in kempojutsu, a 1st degree black belt in okinawan toide (which is a form of aikijujutsu), a third degree black belt in kobudo (which is nothing to brag about), a third degree black belt in jujutsu, and a 58th degree black belt in drinking (although i have slacked off...i used to drink a case [24] like it was nothing, now 12 knock me out...i am ashamed). i was big into martial arts for about 12 years or so, now, i like it a lot but don't do it any more. sometimes i am tempted to join a karate or tae kwon doe school for fun, being a white belt is awesome, but i'm just too lazy. haven't done karate in years.

Pizentios Jan 21st, 2005 9:03 AM

yeah i think it's is a c++ question.

Moved.

Infinite Recursion Jan 21st, 2005 9:10 AM

I have a Springfield Armory XD40 (.40 caliber) and a Beretta 9mm. Why waste time beating on someone, when you can just shoot them and go back to writing code?

Anyhow, back on topic... Windows Programming in C++ is a bit complex... but a few tutorials can be found at http://www.functionx.com.

Meanwhile... here is some code to play with (it prints my alias in a diagonal across a newly opened window).

:

#include <windows.h>

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[] = "ExoFont";
    MSG        Msg;

    WndCls.cbSize        = sizeof(WndCls);
    WndCls.style        = CS_OWNDC | CS_VREDRAW | CS_HREDRAW;
    WndCls.lpfnWndProc  = WindProcedure;
    WndCls.cbClsExtra    = 0;
    WndCls.cbWndExtra    = 0;
    WndCls.hInstance    = hInstance;
    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, "Fonts Fundamentals",
                  WS_OVERLAPPEDWINDOW | WS_VISIBLE,
                  CW_USEDEFAULT, CW_USEDEFAULT, 450, 220,
                  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;
    PAINTSTRUCT Ps;
    HFONT            font;

    switch(Msg)
    {
    case WM_PAINT:
        hDC = BeginPaint(hWnd, &Ps);
               
        font = CreateFont(46, 28, 215, 0,
                          FW_NORMAL, FALSE, FALSE, FALSE,
                          ANSI_CHARSET, OUT_DEFAULT_PRECIS,
                        CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
                        DEFAULT_PITCH | FF_ROMAN,
                        "Tahoma");

        SelectObject(hDC, font);
        TextOut(hDC, 20, 128, "Infinite Recursion", 18);
        DeleteObject(font);

        EndPaint(hWnd, &Ps);
        break;
    case WM_DESTROY:
        PostQuitMessage(WM_QUIT);
        break;
    default:
        return DefWindowProc(hWnd, Msg, wParam, lParam);
    }
    return 0;
}


bl00dninja Jan 21st, 2005 9:52 AM

i USED to have:

18" 8-round mossberg pump with a pistol grip (under the couch--loaded--when i lived in durham, NC)

single-shot 12-gauge

.22 semi-auto rifle with scope and 10-round magazine

30-30 lever-action with scope (marlin)

30-06 springfield 1917 bolt-action with six-round capacity (the rifle that sgt. [whatever the guy who wanted out based on a consciencious objector discharge] had when he captured like 40 germans single-handedly...i loved that rifle as my favorite and i pawned it (and all the others) when i moved to KY in 2000...i'm an ass.

.44 magnum ruger blackhawk with a 7 and a 1/2 " barrel (fuck dirty harry). (the blackhawks are single action, the redhawks are double action. i always wanted a redhawk but i was only 19 so i could only get "shady sales" but that bastard blew out a ball of flame like any one of you would cream about.)

i want to "get into" guns again but now i have a wife and kid on the way.

women just drain our testosterone into the toilet. but i tell you guys, i'm happier than ever, even with a crazy pregnant woman screaming at me. guys talk about balls, but it takes "REAL BALLS" to deal with this shit. soon there will be a little bl00dninja, and that's all good...

Broax Jan 21st, 2005 10:03 AM

I have a fencing sword........

*sigh* :(


All times are GMT -5. The time now is 11:15 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC