News:

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

Control vs. window

Started by Sergiu FUNIERU, February 19, 2010, 11:42:00 PM

Previous topic - Next topic

Sergiu FUNIERU

The smallest asm program displays a control. The next smallest asm program displays a window.

1. A control is not an window? A control displays a rectangle on the screen and it reacts to user input. What's different?

2. Does a control have a loop message queue? If yes, how do I access it?

BlackVortex

The smallest asm program doesn't display anything. The next smallest program writes in the console. Then comes the GUI stuff   :toothy

Sergiu FUNIERU

You're right.

I realize now that "Hello World" kind of program actually displays something. I completely forgot about the program with no interface whatsoever.

jj2007

This is about the smallest app that does display something.

include \masm32\include\masm32rt.inc

.code
start: inkey "Masm32 is great"
exit
end start


And there is a little trap: You need to tell the linker explicitly that this is a console app, not a windows app. Some IDEs (such as my own RichMasm) autodetect if it's a console app, but if you assemble "by hand" using a simple text editor and a batch file, make sure that /SUBSYSTEM:Console appears in the linker's command line.
Every now and then people forget this, and wonder why a) they don't see anything, and b) when they try again, the assembler complains with a cryptic "access denied" message ;-)

Sergiu FUNIERU

I'm afraid I still don't know the answers to my original questions (1 and 2).

jj2007

Quote from: Sergiu FUNIERU on February 20, 2010, 01:23:52 AM
I'm afraid I still don't know the answers to my original questions (1 and 2).

Quote:
A control is a special window that typically enables the user to perform a simple function and sends messages to this effect to its owner window. For example, a pushbutton control has one simple function, namely that the user can click on it; when that happens, the pushbutton sends a WM_COMMAND message to the window (typically a dialog) that owns it.

If you like it more complex, look here, or google for defdlgproc defwindowproc

qWord

1: a control is also a window: a child window. child windows can also exist without a parent (the desktop is then the parent), but that not what they are made for. Normal windows have a empty client rect and some default behaviour - that's all. In contrast to this controls are 'ready to use'. Also child controls exist only as long as the parent does. Menus are also not possible for childes. ...
2: no - the message loop is placed in your program/thread.
FPU in a trice: SmplMath
It's that simple!