Hi all,I have some intermediate knowledge on c++ but I have a few questions about windows programming.

int WINAPI  WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, INT nCmdShow) {....
}

now here I don't understand the word "WINAPI" in c++ I have never seen such tning.. what does it mean? obviously it is not a "type"

or
or this line:

ZeroMemory(&wcx,sizeof(WNDCLASSEX));

what is this "&wcx" thing? is the "&"- the "address of" operator? like in c++

and one more question.. I red that classes in win programming is not the same as classes in c++ .. I'm totally confused .. It appears that i'm learning absolutely new programming language,and I didn't find any book or site where it is explained in such a way so I can understand it :(

Yep, you are right. It is entirely new.

The most significant help will be to keep in mind that Windows was written in C, not C++.

WINAPI is a #define for the stdcall calling convention modifier. By explicitly defining the function as using the stdcall calling convention, you are free to use any other you wish in your program and still be able to call the windows API functions without any problems.

The & is indeed the "address-of" operator. Win API functions don't take pass-by-reference arguments; only pointer and value.

A window class is a set of properties for one or more windows, like background brush, mouse cursor, does it have a drop shadow, what buttons are displayed on the titlebar, or even if it has a titlebar, etc. Here the term "class" is used in its generic sense, not in the C++ sense.

Hope this helps.

thank you for your help,but I must admit it is still very difficult to me..all of books and references begin with this" you should already be familiar with c/c+=" well I'm quite familliar but it is still too dificult.. can you direct me to some site or book on win programming that is really for begginers and not for advanced c++ programmers?and not

However, I have another question:

sampleClass.style = CS_DBLCLKS | CS_OWNDC |
                                        CS_HREDRAW | CS_VREDRAW;

here I see a bitwise operator | , now as I know it compares bits and applyes logical OR to them, but I don't understand what exactly is it doing here?

The or operator is combining those items. For example lets assume
#deifne CS_DBLCLKS 0x01
#define CS_OWNDC 0x02
#define CS_HRDRAW 0x04

So when they are or'ed you get 0x01 + 0x02 + 0x04 = 0x07

Here is a good beginning tutorial in win32 api programming.

It is a common idiom. Each bit represents one flag. The flags are named (like CS_DBLCLKS == permit the window to receive double-click events). Simply OR together the ones you want.

Hope this helps.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.