News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

M.S needs some proofreaders :-)

Started by Magnum, December 12, 2012, 10:11:25 AM

Previous topic - Next topic

Magnum

I think that M.S. needs someone to proofread stuff.

I have some code and wan't to know what this windows style does.

invoke CreateWindowEx,NULL,ADDR ClassName,ADDR AppName,WS_OVERLAPPEDWINDOW or WS_VISIBLE,

WS_VISIBLE
Creates a window that is initially visible.

O.k, the window can be seen for some amount of time and then what?  :dazzled:

1. OEM license flashes
2. you fill in your own interpretations
3. You find an "Easter Egg"
Take care,
                   Andy

Ubuntu-mate-18.04-desktop-amd64

http://www.goodnewsnetwork.org

qWord

MREAL macros - when you need floating point arithmetic while assembling!

dedndave

it's only visible if you ShowWindow after you create it, though
invoke CreateWindowEx.....
mov hWin,eax
invoke ShowWindow,eax,SW_NORMAL
invoke UpdateWindow,hWin

well - there is a trick you can use to avoid that   :P
read carefully the MSDN documentation for CreateWindowEx - x position and y position

CommonTater

Quote from: dedndave on December 12, 2012, 01:23:06 PM
it's only visible if you ShowWindow after you create it, though
invoke CreateWindowEx.....
mov hWin,eax
invoke ShowWindow,eax,SW_NORMAL
invoke UpdateWindow,hWin

well - there is a trick you can use to avoid that   :P
read carefully the MSDN documentation for CreateWindowEx - x position and y position

Nope... a window with WS_VISIBLE does not need ShowWindow() and it remains visible until destroyed.
That's why WS_VISIBLE is used in almost every Child window and control.

dedndave

i guess i got that idea in my head from Iczelion's tutorials

CommonTater

Quote from: dedndave on December 12, 2012, 02:35:05 PM
i guess i got that idea in my head from Iczelion's tutorials

A common practice is to create the application's main window without WS_VISIBLE, load all the controls and even the data into the window, resize it and then pop it on the screen with ShowWindow ...  If you use the WM_CREATE event for your top level (main) window you get the same effect with WS_VISIBLE since all the startup stuff is done in the WM_CREATE event before the window is made visible by the OS.

The main use for ShowWindow is for programs with system tray icons.  There you can create your tray icon, which sits near the clock, and toggle the main window between SW_HIDE and SW_SHOW states when the tray icon is clicked.

For the CW_USEDEFAULT trick in CreateWindowEx... I suppose it has it's uses but given that my window coordinates are stored in the registry at shutdown and restored during startup, I've never had occasion to play with it. (I like getting my windows back, exactly where I left them.)



dedndave

i don't think you have to mess with all that
it doesn't get drawn until WM_CREATE is complete - as well as a WM_SIZE

ShowWindow has 2 purposes, really
one is the show state - minimized, normal, maximized
the other is visible or hidden
these aren't the same thing - actually not all that related - lol

i have written code like you are talking about
where you store the window position and restore it
for most programs, i want to allow for multiple instances
if that's the case, restoring the position doesn't work so well (size is ok)
most of my main windows - i use CW_USEDEFAULT for the X and SW_SHOWNORMAL for Y

CommonTater

Quote from: dedndave on December 13, 2012, 12:10:37 AM
i have written code like you are talking about
where you store the window position and restore it
for most programs, i want to allow for multiple instances
if that's the case, restoring the position doesn't work so well (size is ok)
most of my main windows - i use CW_USEDEFAULT for the X and SW_SHOWNORMAL for Y

Perhaps it's the stuff we are writing... Rather than allow multiple instances, in most of my projects I use Mutex objects to detect the second instance and send WM_COPYDATA to the running copy so it can open new files into a single instance.  Of course it doesn't always make sense to do this, but for some reason it usually does in the code I write  8) 

dedndave

i do have one project - my current "big" project
it accesses data from a special USB device
for that program, i use a mutex and single instance
i don't want more than one app accessing the device

it depends on the app, of course

TouEnMasm


As always , the answer is in the windows help files.
Quote

WS_OVERLAPPEDWINDOW
Creates an overlapped window with the WS_OVERLAPPED, WS_CAPTION, WS_SYSMENU, WS_THICKFRAME, WS_MINIMIZEBOX, and WS_MAXIMIZEBOX styles. Same as the WS_TILEDWINDOW style

WS_VISIBLE
Creates a window that is initially visible.
This style can be turned on and off by using ShowWindow or SetWindowPos


Fa is a musical note to play with CL

Magnum

Well, 'initially visible' may be real clear to you but not to me.

See my first post.

Andy
Take care,
                   Andy

Ubuntu-mate-18.04-desktop-amd64

http://www.goodnewsnetwork.org

jj2007

Quote from: CommonTater on December 12, 2012, 11:50:01 PM(I like getting my windows back, exactly where I left them.)

Hey, Tater, we can agree on something :t

I'd go one step further: I like getting my editor window back, exactly where I left it, with the cursor in line 345 column 12 ;)

And that should work at home and in office - which is easier to achieve with ini files, since you cannot put the registry into the archive with your sources.

QuoteWS_VISIBLE
Creates a window that is initially visible.

O.k, the window can be seen for some amount of time and then what?

I fully agree with Andy that this is lousy English. What they mean is "visible from the beginning" or "visible without any extra steps".


CommonTater

Quote from: jj2007 on December 13, 2012, 03:53:02 AM
I fully agree with Andy that this is lousy English. What they mean is "visible from the beginning" or "visible without any extra steps".

The word they probably wanted was "immediately"....


qWord

Quote from: jj2007 on December 13, 2012, 03:53:02 AM
QuoteWS_VISIBLE
Creates a window that is initially visible.

O.k, the window can be seen for some amount of time and then what?

I fully agree with Andy that this is lousy English. What they mean is "visible from the beginning" or "visible without any extra steps".
lousy? Becasue you don't know what "initially" means?
Sorry, but such statments are ridiculous.
MREAL macros - when you need floating point arithmetic while assembling!

CommonTater

Quote from: jj2007 on December 13, 2012, 03:53:02 AM
And that should work at home and in office - which is easier to achieve with ini files, since you cannot put the registry into the archive with your sources.

I take your point but I haven't played with .ini files in years ... don't plan to either  :(