The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: hfheatherfox07 on May 17, 2012, 07:47:09 PM

Title: Create a Flat window with Create WindowEX
Post by: hfheatherfox07 on May 17, 2012, 07:47:09 PM
Is it possible to do ...I tried and I can not get it .... what is the command?

Thank you  :dazzled:
Title: Re: Create a Flat window with Create WindowEX
Post by: qWord on May 17, 2012, 07:51:21 PM
What do you mean with a Flat window? No frame?
Title: Re: Create a Flat window with Create WindowEX
Post by: hfheatherfox07 on May 17, 2012, 07:53:23 PM
No buttons nothing .... I use ResEd So there a flat means flat

if you can view rsrc.rc with ResEd than it is like the dialog here http://www.masm32.com/board/index.php?action=dlattach;topic=18854.0;id=10784


that is what I need it for
Title: Re: Create a Flat window with Create WindowEX
Post by: qWord on May 17, 2012, 08:11:29 PM
well, WS_VISIBLE+WS_POPUP creates a monochrome rectangle on the desktop ... this what I would call flat  :lol

EDIT: corrected...
Title: Re: Create a Flat window with Create WindowEX
Post by: hfheatherfox07 on May 17, 2012, 08:15:36 PM
thank you ....
how do I break the child .... if you look at that example in the link..... the minute I add the WS_CHILD it takes the same characteristics as the parent window ....

Is there another way?
Title: Re: Create a Flat window with Create WindowEX
Post by: qWord on May 17, 2012, 08:35:34 PM
sorry my fault: it mean WS_VISIBLE+WS_POPUP
Title: Re: Create a Flat window with Create WindowEX
Post by: hfheatherfox07 on May 17, 2012, 08:40:17 PM
Thank I will try this ...So something like :

INVOKE CreateWindowEx,  WS_EX_TRANSPARENT , \
   OFFSET szClassName, NULL, WWS_VISIBLE+WS_POPUP, 0, 0, 280, 175,NULL,NULL,_hInstance,NULL
push eax
invoke ShowWindow, eax,SW_SHOW ;SW_SHOWDEFAULT
pop eax
ret
Title: Re: Create a Flat window with Create WindowEX
Post by: qWord on May 17, 2012, 08:48:19 PM
yes ... but pleas replace the '+' with 'or'  :wink
Title: Re: Create a Flat window with Create WindowEX
Post by: dedndave on May 17, 2012, 08:50:04 PM
if you do not want a child window to inherit properties of the parent,
use the WS_EX_NOINHERITLAYOUT extended style flag in the parent window

if you want to create a child window, use WS_CLIPCHILDREN in the parent
and WS_CHILD in the child (and possibly WS_CLIPSIBLINGS)

so - in the child window, use WS_CHILD or WS_VISIBLE
and assign a unique control ID number in the hMenu parameter of CreateWindowEx

of course, you need a window class of some sort - probably register your own

the child will have no borders or caption
if you want to be able to see it - lol - use a different background color than you use in the client of the parent
Title: Re: Create a Flat window with Create WindowEX
Post by: hfheatherfox07 on May 17, 2012, 08:59:31 PM
Thank you I will try both these things tonight ......
Title: Re: Create a Flat window with Create WindowEX
Post by: hfheatherfox07 on May 18, 2012, 11:49:11 PM
Quote from: qWord on May 17, 2012, 08:35:34 PM
sorry my fault: it mean WS_VISIBLE+WS_POPUP

Thanks qWord, :U

here is an example if anybody wants to do that too
Title: Re: Create a Flat window with Create WindowEX
Post by: hfheatherfox07 on May 18, 2012, 11:50:18 PM
Quote from: dedndave on May 17, 2012, 08:50:04 PM
if you do not want a child window to inherit properties of the parent,
use the WS_EX_NOINHERITLAYOUT extended style flag in the parent window

if you want to create a child window, use WS_CLIPCHILDREN in the parent
and WS_CHILD in the child (and possibly WS_CLIPSIBLINGS)

so - in the child window, use WS_CHILD or WS_VISIBLE
and assign a unique control ID number in the hMenu parameter of CreateWindowEx

of course, you need a window class of some sort - probably register your own

the child will have no borders or caption
if you want to be able to see it - lol - use a different background color than you use in the client of the parent

Ok I have no Idea how to do what you are saying to....
Here is a blank canvas ...can you please show me ?
Title: Re: Create a Flat window with Create WindowEX
Post by: dedndave on May 19, 2012, 01:28:17 AM
i just modified an old project   :P
Edit menu - Add Button
you can even move them around, if you don't go too fast - lol
in the CreateWin function, i removed the WS_THICKFRAME style flag so they do not have sizing borders
Title: Re: Create a Flat window with Create WindowEX
Post by: RHL on May 19, 2012, 02:51:30 AM
nice code dave  :bg I like it
Title: Re: Create a Flat window with Create WindowEX
Post by: hfheatherfox07 on May 19, 2012, 03:00:10 AM
OK but were do you put the WS_EX_NOINHERITLAYOUT ? I still do not get were to put that .....?
Title: Re: Create a Flat window with Create WindowEX
Post by: dedndave on May 19, 2012, 03:17:08 AM
well - that is an extended window style flag that applies to the parent window
you can tell it is an extended flag because of the WS_EX prefix

http://msdn.microsoft.com/en-us/library/windows/desktop/ms632680%28v=vs.85%29.aspx

HWND WINAPI CreateWindowEx(
  __in      DWORD dwExStyle,
  __in_opt  LPCTSTR lpClassName,
  __in_opt  LPCTSTR lpWindowName,
  __in      DWORD dwStyle,
  __in      int x,
  __in      int y,
  __in      int nWidth,
  __in      int nHeight,
  __in_opt  HWND hWndParent,
  __in_opt  HMENU hMenu,
  __in_opt  HINSTANCE hInstance,
  __in_opt  LPVOID lpParam
);

so - the extended style is the first parameter
here is a list with descriptions...
http://msdn.microsoft.com/en-us/library/windows/desktop/ff700543%28v=vs.85%29.aspx
(this link may be found on the page in the first link in the dwExStyle description)

WS_EX_NOINHERITLAYOUT
0x00100000L
The window does not pass its window layout to its child windows.

which more or less implies that it is an extended flag for a parent window   :P

i have never had to use this flag
but - i remember seeing it when i read the documentation   :bg
Title: Re: Create a Flat window with Create WindowEX
Post by: dedndave on May 19, 2012, 03:25:03 AM
Quote from: RHL on May 19, 2012, 02:51:30 AM
nice code dave  :bg I like it

thanks   :P
but - don't use that code as an example
we were playing around - trying different things   :bg
Title: Re: Create a Flat window with Create WindowEX
Post by: hfheatherfox07 on May 19, 2012, 03:27:23 AM
That is were I thought It went ...so in my example

WinMain proc hInst:HINSTANCE,hPrevInst:HINSTANCE,CmdLine:LPSTR,CmdShow:DWORD

LOCAL wc:WNDCLASSEX ; create local variables on stack
LOCAL msg:MSG
LOCAL hwnd:HWND

mov wc.cbSize,SIZEOF WNDCLASSEX ; fill values in members of wc
mov wc.style, WS_EX_NOINHERITLAYOUT   <----------------------------------------------------
mov wc.lpfnWndProc, OFFSET WndProc
mov wc.cbClsExtra,NULL
mov wc.cbWndExtra,NULL
push hInstance
pop wc.hInstance
mov wc.hbrBackground,COLOR_BTNFACE+1 ; COLOR_WINDOW + 9
mov wc.lpszMenuName,NULL
mov wc.lpszClassName,OFFSET ClassName
invoke LoadIcon,NULL,IDI_APPLICATION
mov wc.hIcon,eax
mov wc.hIconSm,eax
invoke LoadCursor,NULL,IDC_ARROW
mov wc.hCursor,eax

invoke RegisterClassEx, addr wc ; register our window class

invoke CreateWindowEx,NULL,ADDR ClassName,ADDR AppName,WS_OVERLAPPEDWINDOW and not WS_MAXIMIZEBOX ,CW_USEDEFAULT,
CW_USEDEFAULT,300,175,NULL,NULL,hInstance,NULL ; Create the window
mov hwnd,eax

invoke ShowWindow, hwnd,SW_SHOWNORMAL ; display our window
invoke UpdateWindow, hwnd

.WHILE TRUE ; The MessageLoop
invoke GetMessage, ADDR msg,NULL,0,0
.BREAK .IF (!eax)
invoke TranslateMessage, ADDR msg
invoke DispatchMessage, ADDR msg
.ENDW


mov eax,msg.wParam
ret
WinMain endp

WndProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM



I tried that but it did not work ......

Do I need to define it in the Constant too ? like with WS_EX_LAYERED


.const
WS_EX_NOINHERITLAYOUT   equ 00100000Lh
Title: Re: Create a Flat window with Create WindowEX
Post by: dedndave on May 19, 2012, 03:31:36 AM
no
that is a WNDCLASSEX structure member for registering a window class
i.e., that is for class style flags, which begin with CS_
http://msdn.microsoft.com/en-us/library/windows/desktop/ms633577%28v=vs.85%29.aspx
http://msdn.microsoft.com/en-us/library/windows/desktop/ff729176%28v=vs.85%29.aspx

extended style flags go here...
invoke CreateWindowEx,NULL,ADDR ClassName,ADDR AppName,WS_OVERLAPPEDWINDOW and not WS_MAXIMIZEBOX ,CW_USEDEFAULT,CW_USEDEFAULT,300,175,NULL,NULL,hInstance,NULL

also - this is NOT good   :bg
WS_OVERLAPPEDWINDOW and not WS_MAXIMIZEBOX
Title: Re: Create a Flat window with Create WindowEX
Post by: hfheatherfox07 on May 19, 2012, 03:35:27 AM
Feel free to dispense another doh!!
:bg
Title: Re: Create a Flat window with Create WindowEX
Post by: dedndave on May 19, 2012, 03:37:01 AM
Heather,
if you have a lot of style flags, do something like this...
StyleFlags = WS_OVERLAPPEDWINDOW or WS_VISIBLE or WS_CLIPCHILDREN
;or WS_HSCROLL or WS_VSCROLL (to add scroll bars to frame window)

   INVOKE  CreateWindowEx,edi,offset szFrameClass,offset szFrameTitle,StyleFlags,
           CW_USEDEFAULT,SW_SHOWNORMAL,MainWidth,MainHeight,edi,edi,ebx,edi


"=" is similar to EQU, except that the symbol may be assigned a different value later in the source
i sometimes use the name "StyleFlags" several times in a source

nah - i wasn't gonna DOH ya, today - lol
Title: Re: Create a Flat window with Create WindowEX
Post by: hfheatherfox07 on May 19, 2012, 03:38:45 AM
I did not even now that was possible  .... I like that  :U
Title: Re: Create a Flat window with Create WindowEX
Post by: jj2007 on May 19, 2012, 07:19:26 AM
Quote from: dedndave on May 19, 2012, 03:37:01 AM
"=" is similar to EQU, except that the symbol may be assigned a different value later in the source

Short example:

include \masm32\include\masm32rt.inc ; CONSOLE ASSEMBLY PLEASE!

int1 equ 123
; int1 equ 456 reassigning numeric values with equ is NOT allowed
int2 = 123
int2 = 456 ; OK with = sign

.code
start:
hw equ <"Hello World">  ; strings can be redefined any time
% print hw, 13, 10 ; needs expansion operator % to work directly
hw equ "Hello Dave" ; the brackets are not needed
% print hw, 13, 10
exit

end start
Title: Re: Create a Flat window with Create WindowEX
Post by: dedndave on May 19, 2012, 08:28:27 AM
yes - when you assign a string with EQU, the assembler actually makes it a TEXTEQU, which can be reassigned
i like to use them when i make my own stack frames   :P

_ModeControl  TEXTEQU <[EBP+36]> ;signed/unsigned mode control
_OutBufSize   TEXTEQU <[EBP+32]> ;output buffer size in bytes
_OutBufBase   TEXTEQU <[EBP+28]> ;output buffer base address
_InpValSize   TEXTEQU <[EBP+24]> ;input value size in bytes
_InpValBase   TEXTEQU <[EBP+20]> ;input value base address

;                      [EBP+16]   PROC return address
;                      [EBP+12]   saved ESI contents
;                      [EBP+8]    saved EDI contents
;                      [EBP+4]    saved EBX contents
;                      [EBP]      saved EBP contents

_SignXorMask  TEXTEQU <[EBP-4]>  ;sign XOR mask
_OutLastDword TEXTEQU <[EBP-8]>  ;address of last dword in output buffer
;
;
;
        mov     ecx,_InpValBase  ;mov ecx,[ebp+20]


if i like, i can use the same names in the next routine - probably with different strings
Title: Re: Create a Flat window with Create WindowEX
Post by: jj2007 on May 19, 2012, 08:50:21 AM
Quote from: dedndave on May 19, 2012, 08:28:27 AM
when you assign a string with EQU, the assembler actually makes it a TEXTEQU

Where did you get that, programmer's guide? Just curious - the lst file doesn't show any textequ  ::)
Title: Re: Create a Flat window with Create WindowEX
Post by: dedndave on May 19, 2012, 02:36:19 PM
it just makes sense, is all
EQU is a fixed value - in older versions of MASM, it always resolved to a 16-bit numeric constant
then, they added the TEXTEQU functionality to use strings, and to be "re-usable"
other than the 4 letters, i don't think there is any difference between EQU with a text operand and TEXTEQU
Title: Re: Create a Flat window with Create WindowEX
Post by: P1 on May 22, 2012, 04:02:18 AM
Quote from: dedndave on May 19, 2012, 02:36:19 PMit just makes sense, is all
EQU is a fixed value - in older versions of MASM, it always resolved to a 16-bit numeric constant
then, they added the TEXTEQU functionality to use strings, and to be "re-usable"
other than the 4 letters, i don't think there is any difference between EQU with a text operand and TEXTEQU
One can be re-assigned and the other can not, is my understanding.

Regards,  P1   :8)
Title: Re: Create a Flat window with Create WindowEX
Post by: jj2007 on May 22, 2012, 06:27:14 AM
Quote from: P1 on May 22, 2012, 04:02:18 AM
One can be re-assigned and the other can not, is my understanding.

=, equ and textequ can be re-assigned
What can not be re-assigned is an integer defined with equ or textequ.