hi,
i don't want my program to be on "TopMost" but i also don't want it to minimize. Never.
even if i disable the minimize feature, the program can still be minimized by clicking on the "show desktop" icon or pressing Windows Key+M. I'd like to prevent that. Can someone tell me a possible way to do it
btw, the "show desktop" button doesn't trigger the 'resize' or 'changesize' event in the form.
Thanks,
i don't want my program to be on "TopMost" but i also don't want it to minimize. Never.
even if i disable the minimize feature, the program can still be minimized by clicking on the "show desktop" icon or pressing Windows Key+M. I'd like to prevent that. Can someone tell me a possible way to do it
btw, the "show desktop" button doesn't trigger the 'resize' or 'changesize' event in the form.
Thanks,

how do i prevent "show desktop" or "windows key+m" from minimizing my program?
gifa
I don't think that code is going to help you get the behavior you're looking for. But if you're interested, the Delphi code translates to:
uint GW_OWNER = 4;
int GWL_STYLE = -16;
int GWL_EXSTYLE = -20;
[System.Runtime.InteropServices.DllImport("user32.dll")]
static extern long SetWindowLong(IntPtr hWnd, int index, long longValue);
[System.Runtime.InteropServices.DllImport("user32.dll")]
static extern IntPtr GetWindow(IntPtr hWnd, uint cmd);
private void Form1_Shown(object sender, EventArgs e)
{
this.MinimizeBox = false;
SetWindowLong(GetWindow(this.Handle, GW_OWNER), GWL_STYLE, 0);
SetWindowLong(GetWindow(this.Handle, GW_OWNER), GWL_EXSTYLE, 0);
}
derekyeong
ScaryJerry
thanks,
Bela Istok
You can stop the minimize event with this....but WinKey m...will always minimize it.
Looks like the only way is the way Gorm posted....trap the m key.
SachinG
LV_DP
there is a program called DeskLook. that program also needs to be on the desktop all the time, the way it got around this problem is by actually drawing itself on the wallpaper. weird solution.
i appreciate your advice on the newsgroups and the other comments.
thanks.
msafi
Trev Hunter
the purpose of the program is to be a semi-transparent textbox always sitting on my desktop. it will be the place where i can type notes and things to do and have them always in front of me.
raxe
This is compromising the experience of Windows, you know.
You could do this by implementing < XML:NAMESPACE PREFIX = MSHelp NS = "http://msdn.microsoft.com/mshelp" />
You might have experienced that Internet Explorer suddenly takes focus after it has loaded a page. This is very annoying to me. I would not implement that kind of functionality myself.
As mentioned by Vijaye Raji, handling minimize is insufficient since the z-order of the desktop will be changed so that the desktop is in front of your window.
If this was not the case, the Delphi source would look promissing.
I am pretty sure the only way to do this properly is to write a (most likely system-wide) keyboard hook.
These are generally bad, since they are changes to how the OS works and requires some nasty priveleges (at least they should).
Also, it is not in the domain of .NET programming. If you really want to do it, ask in eg. newsgroup microsoft.public.win32.programmer.kernel.
If you go for it...
You must write a little dll [in C/WINAPI, please] which exports a function you hook into the keyboard chain. This function could filter out the m-key when the windows-key is pressed. If you do this the wrong way, you can for instance loose the m-key (not only for your program) or the entire keyboard.
Hope this is to any help
Gorm Braarvig.
jayson.gm.ds2.ci.ftsp
DeanT
AJAX HAL
Set Form1 Properties in the object inspector to
Border Icons biMinimize = False
formstyle = stay on top
procedure TForm1.FormShow(Sender: TObject);
begin
setwindowlong(getwindow(self.Handle,GW_OWNER),GWL_STYLE,0);
setwindowlong(getwindow(self.Handle,GW_OWNER),GWL_EXSTYLE,0);
self.OnShow:=nil;
end;