News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Windows messages

Started by Starter, February 24, 2007, 10:47:25 PM

Previous topic - Next topic

Starter

Hello to everyone!

As my name says I am a starter in assembly programing. I started to read Iczelion s tutorials on assembly
language programming. I like it very much.So i came to Tutorial 4:"Painting with Text ".But I can t understand
many things. For instance:
"Why do I have to prototype functions and what that means to assembler ?",

"What are messages from Windows and where they are hold ?" ,

"If my program gets message WM_DESTROY from Windows  is that mean that I pressed the x button on upper
right corner on the Window ? ",

" Is it Windows the one that sends to me the message WM_PAINT and if Windows sens to me that message what
I do to make windows to send me that message i.e. do I press something on window or what ?" ,

"What is the client area?" .

And that is just for begining.

I have  a lot of questions. I hardly understand anything? If there are someone to explain me anything.


Thank you very much.

zooba

Quote from: Starter on February 24, 2007, 10:47:25 PM
"Why do I have to prototype functions and what that means to assembler ?",

MASM is a single-pass assembler, which means if it finds a call to a function and doesn't know about the function it won't keep going and then come back to it when it finds the function; it will simply give an error. By prototyping a function, you're telling the assembler that the function exists and what it's parameters are. This way, the assembler knows what to do when it finds a call to the function, even if the function is written later in the file.

Languages like Java, VB and C# are two-pass (possibly more) compilers: the first pass is going through looking for functions and automatically generating prototypes so that the second pass already knows about all the available functions.

Quote from: Starter on February 24, 2007, 10:47:25 PM
"What are messages from Windows and where they are hold ?" ,

Windows communicates with programs by sending messages to them. These messages include when the user clicks on your window, when your window needs to repaint part or all of itself, and when a key is pressed or a character is typed. The data held in a message depends on the message itself, so you first need to test to see what message it is and then treat the data according to the documentation. MSDN or the Platform SDK has a full reference of Window messages.

Quote from: Starter on February 24, 2007, 10:47:25 PM
"If my program gets message WM_DESTROY from Windows  is that mean that I pressed the x button on upper
right corner on the Window ? ",

Technically no, though you will get WM_DESTROY when the Close button is clicked. What WM_DESTROY means is that DestroyWindow has been called on your Window. When the Close button is clicked, WM_CLOSE is sent to your program. The usual response to WM_CLOSE is to call PostQuitMessage, which will break out of your message loop which will lead to a DestroyWindow call.

Quote from: Starter on February 24, 2007, 10:47:25 PM
" Is it Windows the one that sends to me the message WM_PAINT and if Windows sens to me that message what
I do to make windows to send me that message i.e. do I press something on window or what ?" ,

Yes, Windows (actually, the window manager) is the only process that sends WM_PAINT and is the only one that ever should send WM_PAINT. Look up InvalidateWindowRect.

Quote from: Starter on February 24, 2007, 10:47:25 PM
"What is the client area?" .

Your window not including the border, the title bar, the control box (top left corner), and the minimise, maximise and close buttons. Basically, the area that you use for your window is the client area. The rest is handled by the OS.

Quote from: Starter on February 24, 2007, 10:47:25 PM
And that is just for begining.

Keep'em coming :bg

Cheers,

Zooba :U

Starter

Thank you my freind for answer.  :U