UNIX Socket FAQ

A forum for questions and answers about network programming on Linux and all other Unix-like systems

You are not logged in.

#1 2007-11-29 05:06 PM

Elite12
Member
Registered: 2007-11-29
Posts: 4

Re: Win app

Hi,
I want to learn Win app,but i do not known where to learn the meaning of these strange words when i open the project.
I learnt C.

Offline

#2 2007-11-29 06:11 PM

i3839
Oddministrator
From: Amsterdam
Registered: 2003-06-07
Posts: 2,239

Re: Win app

What the hell are you talking about?

Offline

#3 2007-11-29 06:18 PM

Elite12
Member
Registered: 2007-11-29
Posts: 4

Re: Win app

When I get into Dev-C++
and go to File,new,project  and choose Win application with c++,
and he write me this,

#include <windows.h>

/*  Declare Windows procedure  */
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);

/*  Make the class name into a global variable  */
char szClassName[ ] = "WindowsApp";

int WINAPI WinMain (HINSTANCE hThisInstance,
                    HINSTANCE hPrevInstance,
                    LPSTR lpszArgument,
                    int nFunsterStil)

{
    HWND hwnd;               /* This is the handle for our window */
    MSG messages;            /* Here messages to the application are saved */
    WNDCLASSEX wincl;        /* Data structure for the windowclass */

    /* The Window structure */
    wincl.hInstance = hThisInstance;
    wincl.lpszClassName = szClassName;
    wincl.lpfnWndProc = WindowProcedure;      /* This function is called by windows */
    wincl.style = CS_DBLCLKS;                 /* Catch double-clicks */
    wincl.cbSize = sizeof (WNDCLASSEX);

    /* Use default icon and mouse-pointer */
    wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
    wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
    wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
    wincl.lpszMenuName = NULL;                 /* No menu */
    wincl.cbClsExtra = 0;                      /* No extra bytes after the window class */
    wincl.cbWndExtra = 0;                      /* structure or the window instance */
    /* Use Windows's default color as the background of the window */
    wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;

    /* Register the window class, and if it fails quit the program */
    if (!RegisterClassEx (&wincl))
        return 0;

    /* The class is registered, let's create the program*/
    hwnd = CreateWindowEx (
           0,                   /* Extended possibilites for variation */
           szClassName,         /* Classname */
           "Windows App",       /* Title Text */
           WS_OVERLAPPEDWINDOW, /* default window */
           CW_USEDEFAULT,       /* Windows decides the position */
           CW_USEDEFAULT,       /* where the window ends up on the screen */
           544,                 /* The programs width */
           375,                 /* and height in pixels */
           HWND_DESKTOP,        /* The window is a child-window to desktop */
           NULL,                /* No menu */
           hThisInstance,       /* Program Instance handler */
           NULL                 /* No Window Creation data */
           );

    /* Make the window visible on the screen */
    ShowWindow (hwnd, nFunsterStil);

    /* Run the message loop. It will run until GetMessage() returns 0 */
    while (GetMessage (&messages, NULL, 0, 0))
    {
        /* Translate virtual-key messages into character messages */
        TranslateMessage(&messages);
        /* Send message to WindowProcedure */
        DispatchMessage(&messages);
    }

    /* The program return-value is 0 - The value that PostQuitMessage() gave */
    return messages.wParam;
}


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

LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch (message)                  /* handle the messages */
    {
        case WM_DESTROY:
            PostQuitMessage (0);       /* send a WM_QUIT to the message queue */
            break;
        default:                      /* for messages that we don't deal with */
            return DefWindowProc (hwnd, message, wParam, lParam);
    }

    return 0;
}

Offline

#4 2007-11-29 06:31 PM

i3839
Oddministrator
From: Amsterdam
Registered: 2003-06-07
Posts: 2,239

Re: Win app

If you have questions about C++, ask us, and maybe we can help.

If you want to know more about the Dev-C++ software, ask them, not us.

If you want to know how to write Microsoft Windows applications, you're on the
wrong forum. Small chance that anyone here knows much about it, this
being a UNIX forum and all that.

But wherever you're going to ask for help, it really helps if you have a specific
problem that you can describe so that people have an idea what you want to
know. If you ask a generic and vague question, people will probably just point to
the documentation, as there's not much else to say. It really helps if you ask a
question instead of giving hints to what you want to know too.

As for that chunk of code, it's just typical Win app code. I don't recommend
writing Win apps, much better to use something else, even C# probably. Or 
better, just use some cross-platform GUI toolkit and keep your code portable
(also within MSWindows versions).

And next time, when dumping a big chunk of code, use the CODE tags.

Offline

#5 2007-11-29 06:53 PM

Elite12
Member
Registered: 2007-11-29
Posts: 4

Re: Win app

When i ask the meaning of these words i thought on connection between Win app and the words,how words reflect on win app.
And i want  you to point some literature about that. If you wrote  anything else is worthless.

Offline

#6 2007-11-29 08:20 PM

i3839
Oddministrator
From: Amsterdam
Registered: 2003-06-07
Posts: 2,239

Re: Win app

Those "words" (I assume you mean "code") are a basic Win app program as is
generated by Dev-C++ as a starting stub, or whatever. As for what they mean,
just read them, it's juct C which you claim to know.

...

Did that? And it's still an incomprehensible meaningless mess? Right?

Now reread my previous message, especially the part about not writing native
Win app programs. Link those two together and you should know why I said that.

...

If you still want to get a detailed explantion of how the code works and what it
does, then read the rest of my previous message. Don't skip the part about
WHERE you should ask those and HOW you should ask for help.

Repeat the above procedure until you get it.

Now, if you still insist that my message is worthless, have a nice day and see you
in hell.

(And there we'll meet again, and you'll say: "yes, you were right, writing Win apps 
directly wasn't a good idea after all.")

Offline

#7 2007-11-29 08:23 PM

jfriesne
Administrator
From: California
Registered: 2005-07-06
Posts: 348
Website

Re: Win app

I agree with i3839, if you want Windows-specific information you'd be better off asking on a Windows-specific forum.  Or you could just enter the keywords you are confused by into Google and see what comes up.

I also highly recommend learning a cross-platform toolkit such as Qt instead of Win32.  You'll find it much easier to work with (the Windows C API is a big mess these days, as evidenced by the confusing complexity of the "simple framework" your IDE presented you with!), and when you're done writing your application you'll be also able to run it on Mac, Linux, Unix, etc, not just Windows.

-Jeremy

Offline

#8 2007-11-30 01:15 PM

Elite12
Member
Registered: 2007-11-29
Posts: 4

Re: Win app

Sorry but you are not helping me,and most usefull thing will be if you can write me the way how to add addres of my port to variable.

Offline

#9 2007-11-30 02:47 PM

biologz
Administrator
From: Puking on the pavement
Registered: 2005-11-02
Posts: 396

Re: Win app

Elite12, are you god????


gethostbyintuition() is still a dream of mine

                                                 -- quoted from bash

Offline

#10 2007-11-30 03:58 PM

RobSeace
Administrator
From: Boston, MA
Registered: 2002-06-12
Posts: 3,839
Website

Re: Win app

Offline

#11 2009-09-22 05:57 PM

asd3274ds
Guest

Re: Win app

Board footer

Powered by FluxBB