Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Widgets - General questions or Mixed problems » Change window style
Change window style [message #37523] Sun, 14 October 2012 18:43 Go to next message
Mircode is currently offline  Mircode
Messages: 17
Registered: September 2012
Promising Member
Hi there!

I want my mainwindow to have no button in the taskbar and only appear with a little trayicon. Furthermore, there should be no maximize or close button, only minimize.

I am working on windows and I tried to work with GetWindowLongPtr and SetWindowLongPtr, GWL_STYLE and GWL_EXSTYLE, WS_MINIMIZEBOX and WS_EX_TOOLWINDOW.

At the end of the constructor of my main class I wrote:

LONG_PTR ws;
ws=GetWindowLongPtr(KeyBuddy2::GetHWND(),GWL_STYLE);
ws = ws | WS_MINIMIZEBOX;	
SetWindowLongPtr(KeyBuddy2::GetHWND(),GWL_STYLE,ws);


I also tried different style attributes, nothing had any effect.

What seems to be the problem here?

Thanks in advance,
Mirko
Re: Change window style [message #37526 is a reply to message #37523] Sun, 14 October 2012 21:55 Go to previous messageGo to next message
Mircode is currently offline  Mircode
Messages: 17
Registered: September 2012
Promising Member
Now I found the method

ToolWindow();

Sadly, it does not allow the window to have a minimize button. But I can live with the fact that [X] minimizes my window to tray.

I did it using:
WhenClose=THISBACK(Hide);

To actually close the program, I have a right-click menu in the tray icon with an exit option.

First I tried
bar.Add(t_("Exit"), THISBACK(Close));

nothing happened. Then I created an own method, which called close:
bar.Add(t_("Exit"), THISBACK(closeProgram));
with
void closeProgram(){Close();}
being a method of my main window. Nothing happened. Then I tried Break() instead of Close(). Now it works. I dont know why close doesnt. (Close also does not minimize the window, so the problem is not that I changed the WhenClose thingy).
Re: Change window style [message #37535 is a reply to message #37523] Mon, 15 October 2012 07:03 Go to previous message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

Hi Mirko,

What about using Ctrl::Frameless() ? IIRC it should make your window borderless - no title bar, no min/max/close buttons. Then you can create the minimize button yourself as a regular Button that will minimize/close/hide the window as you need.

Best regards,
Honza
Previous Topic: Simulate a button click
Next Topic: ColumnList callback
Goto Forum:
  


Current Time: Fri Mar 29 09:19:18 CET 2024

Total time taken to generate the page: 0.01704 seconds