News:

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

No Minimize Window

Started by ic2, March 14, 2007, 07:03:05 PM

Previous topic - Next topic

ic2

Hello everybody,

I need to know which API would i call to force any DeskTop Icon from being displayed under my Window.  Something like automatically pushing them out of the way when ever my window get activated and open up at that screen space.  I heard of this kind of API once but had no interest at the time and forgot what it was.  My Window is set at  0,0,64,64 (movable WS_POPUP style)

Also, I need a way to keep this window showing on the desktop at all times.  What API or flag would i use to mark this window as No way to SW_Minimize and No way to SW_Maximize and others but still always available for closing only by a button on the window, the system and any other program?

Thanks in advance

PBrennick

ic2,

When you create the window, omit WS_MINIMIZEBOX and WS_MAXIMIZEBOX. Don't use WS_OVERLAPPEDWINDOW, also.

Paul
The GeneSys Project is available from:
The Repository or My crappy website

ic2

Thanks Pbrennick,   but i don't use neither and  I don't think myself explained properly.  My fault.

On Windows 95 you can right click the Taskbar and click Minimize All Windows.  I need my window to stay on the screen just like the Taskbar and the desktop when this is done.

I'm near sure it can be done .  I just don't know how...

I would like to do it as simple as possible or I would like to know how to block the message if this is what is sent to the window and if the window has options.

Just like the Taskbar and the desktop which are windows too.  They don't get min = max unless this is what someone trying to do.  So there must be something that a standard window program can do too to avoid that command im hoping.

Timbo

Greetings,

Have you tried handling WM_RESIZE?  You can call SetWindowPos from within your handler to stick it in place.

Regards,

Tim

ic2

I threw the book at it...  I tried all the equates and it still did not work.  I learned a lot more by trying and reading about it as i go but it burned me out real good.  I think i set it up right.   Is there others handler that can be used.  Now im thinking PeekMessage.  If this is a possibility, what should i be trying to catch and what would i do with it..

; WM_SIZE............................................

    .elseif wmsg == 5h

                    ;SWP_SHOWWINDOW 40h
PUSH 8h or 2h or 1h ;SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOSIZE
PUSH 64
PUSH 64
PUSH MainWin.top
PUSH MainWin.left
PUSH 0    ; HWND_BOTTOM 1 ; HWND_TOP 0
PUSH hWnd
CALL SetWindowPos


MichaelW

Why do you need to do this? It's not a good idea to force anything like this on a user. Any program that did this on my system would only run once.
eschew obfuscation

ic2

Hello MichaelW,  In short, I have a client with few hundred office computers and he need this on all of his machine to do a few special things designed only for his business.

All of his computers are set to the default Auto Arrange with only four columns of Icon on it.  So I must design this panel it in a way where no icons ever get hidden behind it.  All icons would only shift downward just like the system is design to do when using Auto Arrange.

I'm just days away from finishing and thought i would easily figure a way to do it because i seen it on computers many time before .  I would appreciate all the help i can get to compete the design in the best way possible.  I did a good job so far and don't want to mess thing up with some phony routine that I can dream up that may eat up all the memory the day after payday.  That's why i asking.  I don't know it all but they think i do... but they know for a fact that i always supply near best for their need
..:)

MichaelW

I think what you are trying to do is going to be difficult. If you cannot place your window where there are no icons, then you will need to move icons, and to do this you must first find the icons. If the icons were in child windows on the desktop then this might not be too difficult, but this does not seem to be the case. Under Windows 2000 the class name for the desktop appears to be "SysListView32", so I'm guessing that the icons are managed by a list-view control, but I have no idea how you could get/identify the handle for this control. The GetParent function, when called for the desktop window, returns zero, probably indicating that the desktop window is a top-level window. On my system, searching 4 levels down from the desktop window using the app below, there are ~1000 windows, but I doubt that any of them have anything to do with the desktop icons.

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
    include \masm32\include\masm32rt.inc
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
    .data
      hFile dd 0
    .code
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

; --------------------------------------------------------------
; Here the same callback function is used for EnumWindows and
; EnumChildWindows, for multiple levels. The value in lParam is
; used to specify the level, and it starts out at 0 for the
; top-level window.
; --------------------------------------------------------------

EnumWindowsProc proc hWnd:DWORD,lParam:DWORD
    LOCAL buffer[128]:BYTE

    invoke GetClassName,hWnd,ADDR buffer,127
    SWITCH lParam
      CASE 0       
        fnc crt_fprintf,hFile,"%X\t%s\n",hWnd,ADDR buffer
        invoke EnumChildWindows,hWnd,ADDR EnumWindowsProc,1
      CASE 1
        fnc crt_fprintf,hFile,"\t%X\t%s\n",hWnd,ADDR buffer
        invoke EnumChildWindows,hWnd,ADDR EnumWindowsProc,2
      CASE 2
        fnc crt_fprintf,hFile,"\t\t%X\t%s\n",hWnd,ADDR buffer
        invoke EnumChildWindows,hWnd,ADDR EnumWindowsProc,3
      CASE 3
        fnc crt_fprintf,hFile,"\t\t\t%X\t%s\n",hWnd,ADDR buffer
        invoke EnumChildWindows,hWnd,ADDR EnumWindowsProc,4
      CASE 4
        fnc crt_fprintf,hFile,"\t\t\t\t%X\t%s\n",hWnd,ADDR buffer
    ENDSW   
    return TRUE      ; continue enumeration

EnumWindowsProc endp
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
start:
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
    mov hFile, rv(crt_fopen,"enumeration.txt","w")
   
    invoke EnumDesktopWindows,NULL,ADDR EnumWindowsProc,0

    invoke crt_fclose,hFile

    inkey "Press any key to exit..."
    exit
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
end start
eschew obfuscation

PBrennick

The attached program written by Jim Giordano is not exactly what you are looking for but it shows you how to build the ListView loaded with the Icons. You can them move them around any way you want. It should help you.

Paul


[attachment deleted by admin]
The GeneSys Project is available from:
The Repository or My crappy website

ic2

I remember a program written as an example for someone in ASM that used said you must use VirtualAllocEx to claim desktop space for temporary usage, I'm sure i  had the example but did not have the need OS at the time to experiment with it. 

Anyway this is only my 3rd job though a great recommendation.  I wanted to be super impressive but I'll come up with something else fancy. Glad i did not promise them rose garden. Thanks for the tools guys, i might get lucky. 

ic2

WoW... Pbrennick    I spoke too soon. I Just tried the example without even looking at the code.  It's exactly what is needed to get the job done right.  Where in this world would people get help like this.   

Thank You both Very Much

MichaelW

After doing a little research the list-view of interest is in the enumeration returned by the code I posted, at the end of the file:

10050  Progman

    10056  SHELLDLL_DefView
      10058  SysListView32

    10058  SysListView32


The handle in this case is 10058. I noticed the "Progman", but failed to make the obvious connection.

There is some VB code available that does what you seem to be describing. Try doing a search for "VirtualAllocEx" and  "desktop".

eschew obfuscation

sinsi

Here is some code I wrote after reading a topic on changing the desktop's listview style. I can't find the topic, but
the file DesktopStyle.asm.orig is someone's original code from this board...maybe this will remind someone:
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
; DesktopStyle
; Switching the desktop's icon presentation
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

I just extended it to saving/restoring an icon layout and making it small icon view hee hee.


[attachment deleted by admin]
Light travels faster than sound, that's why some people seem bright until you hear them.

ic2

That's cool sinsi.  Can't wait to play with all of this and do thing for my own machine.

I'm just coming out of what seem to be a 24 hour drunk style sleep since i last replied. No alcohol involved.  I feel soooo  relieved.

So VirtualAllocEx  is the key . ..   I dream-thought everything through and realize claiming desktop space through VirtualAllocEx is most professional for business applications...  but now, it would be even more difficult because i would have to claim space in not one column but two columns to be replaced with my 64x64 panel, leaving all icons under it to continue to flow properly with the rest of the desktop.  By mid-night, I will be  searching "VirtualAllocEx" and "desktop" to learn how to do it.

Humm... Now that i think about it, It *should* be automatic no matter many columns is step upon.  It's only space that a OS should see as "not there".

I already got a MASK in mind using the example Pbrennick has shared.  I'm going to use ideas from it for my ultimate back-up plan that will buy me more time if need.  I'm working on that right now, just-in-case.  Latter on when i get it right using VirtualAllocEx, I'll just replace it ...  Timing could have never been better.

Jimg

If you have any questions about my code, you can ask here or in the original thread http://www.masm32.com/board/index.php?topic=2704.0