News:

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

Windows, Dialogs, Modal and modeless goods and bads

Started by zemtex, July 25, 2011, 01:17:05 AM

Previous topic - Next topic

zemtex



This is just a few basic characteristics of the different methods to create windows. I couldn't find such a list by searching the forum. Thought it might be useful to have just in case someone need a quick reference. Discuss good and bads about the different methods if you wish. It's not always too easy to deside what window type one should go for in terms of size, bloat, speed etc. I did not include the versions to create windows without "Param", because there was not enough room for it.
I have been puzzling with lego bricks all my life. I know how to do this. When Peter, at age 6 is competing with me, I find it extremely neccessary to show him that I can puzzle bricks better than him, because he is so damn talented that all that is called rational has gone haywire.

dedndave

you can make it preformatted text with "teletype"
but, the user's default size gets used - you may want to force something reasonable, like 10 or 12 pt
or, just use the code tags   :bg

i am trying to figure out what "x" and "v" mean   :P  (xp/vista ?)
a "key" would be handy

zemtex

I removed the V and X and replaced it with Yes or No.
I have been puzzling with lego bricks all my life. I know how to do this. When Peter, at age 6 is competing with me, I find it extremely neccessary to show him that I can puzzle bricks better than him, because he is so damn talented that all that is called rational has gone haywire.

dedndave

i think CreateWindowEx can create any type of window
the other functions all end up using it

zemtex

#4
If anything is wrong now, let me know I will change it  :P

Btw, how do you remove the titlebar icon of the window, what style should I use when using CreateWindowEx? I know how to make it work with dialog windows, but not with normal user created windows.
I have been puzzling with lego bricks all my life. I know how to do this. When Peter, at age 6 is competing with me, I find it extremely neccessary to show him that I can puzzle bricks better than him, because he is so damn talented that all that is called rational has gone haywire.

hutch--

zemtex,

Dave is basically right here, CreateWindowEx() is the method that the OS uses to create a window in the system. There are a couple of techniques that create simplified windows which are basically what dialogs are that pre-package a number of things like keyboard control but the OS uses CreateWindowEx() to provide that capacity.

As far as adding or subtracting things like title bars and the button at the top of the window, you have both the extended styles and normal styles associated with CreateWindowEx() that give you all of these adjustments. You ORR them together in the normal manner to combine styles to give you the one you require.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

MichaelW

What is the basis for the "Auto Tab to next control" rating? This would appear to be a message loop issue, not a window creation issue. And what about the "Bloats your code" and "Fast to create" ratings, what are you measuring?
eschew obfuscation

Twister

These functions can not bloat your code. There is no way. By the looks of this, you may have been misinformed what "bloat" means.

jcfuller

Quote from: Horton on July 25, 2011, 11:12:09 AM
These functions can not bloat your code. There is no way. By the looks of this, you may have been misinformed what "bloat" means.
If you use embedded dialog resources as opposed to native CreateWindowEx() I believe your exe will be larger??

James

zemtex

Quote from: jcfuller on July 25, 2011, 03:12:27 PM
Quote from: Horton on July 25, 2011, 11:12:09 AM
These functions can not bloat your code. There is no way. By the looks of this, you may have been misinformed what "bloat" means.
If you use embedded dialog resources as opposed to native CreateWindowEx() I believe your exe will be larger??

James


Yes, in many cases you need to register the window, fill in information about it, some need a message loop which adds more bloat to your program, some of them have system internal message parsers.

Some of the functions need memory templates, you need to initialize quite alot, there is not just the memory template that needs initialization. The functions itself does not bloat your code, but it is the added code needed to make it all work that bloats your program.
I have been puzzling with lego bricks all my life. I know how to do this. When Peter, at age 6 is competing with me, I find it extremely neccessary to show him that I can puzzle bricks better than him, because he is so damn talented that all that is called rational has gone haywire.

zemtex

Quote from: MichaelW on July 25, 2011, 04:37:32 AM
What is the basis for the "Auto Tab to next control" rating? This would appear to be a message loop issue, not a window creation issue. And what about the "Bloats your code" and "Fast to create" ratings, what are you measuring?

Auto Tab means that the system has internal parsing for TAB between dialog controls. Otherwise you would write your own parser for TAB. It is a message loop issue in CreateWindowEx for example, but it is not in DialogBoxParam where it is handled internally.

Bloats your code is a measure of all the extra code and data needed to make it all work based on which type of window you want to create. It is not just the function to create the window, but what is needed in total, like Register window, wndclassex structure, message loop, keyboard parsing. etc. I would like to mention that it is also the function itself, some of them are larger than others.

Fast to create is how quickly you can code it.  :P
I have been puzzling with lego bricks all my life. I know how to do this. When Peter, at age 6 is competing with me, I find it extremely neccessary to show him that I can puzzle bricks better than him, because he is so damn talented that all that is called rational has gone haywire.

Gunner

All controls created with createwindow can be tabbed to without writing your own handler!  Create the control with ws_tab, and in the message loop you add isdialogmessage or something before translate message
~Rob (Gunner)
- IE Zone Editor
- Gunners File Type Editor
http://www.gunnerinc.com

zemtex

Quote from: Gunner on July 25, 2011, 03:58:40 PM
All controls created with createwindow can be tabbed to without writing your own handler!  Create the control with ws_tab, and in the message loop you add isdialogmessage or something before translate message

Yes but like you said yourself you have to add it, it's not by default. That is what the "Auto" tab line is measuring. Whether you have it automatically by default or if you have to code it yourself in the message loop or somewhere else.
I have been puzzling with lego bricks all my life. I know how to do this. When Peter, at age 6 is competing with me, I find it extremely neccessary to show him that I can puzzle bricks better than him, because he is so damn talented that all that is called rational has gone haywire.

qWord

Why should CreateWindowEx bloats my code? - There is nothing needless on this function - or what did you mean with bloats your code?
FPU in a trice: SmplMath
It's that simple!

zemtex

Quote from: qWord on July 25, 2011, 04:15:48 PM
Why should CreateWindowEx bloats my code? - There is nothing needless on this function - or what did you mean with bloats your code?

Maybe I didn't make myself well understood. "bloats your code" doesn't necessarily add that much of a bloat, it is just a relative term to all the other methods. It adds somewhat more or less code and data into your executable than the rest of the methods in the list. It doesn't mean it adds exceptional bloat. It is merely a relative term and I used it for its associative value. I could have written "Will produce relatively larger executable".
I have been puzzling with lego bricks all my life. I know how to do this. When Peter, at age 6 is competing with me, I find it extremely neccessary to show him that I can puzzle bricks better than him, because he is so damn talented that all that is called rational has gone haywire.