It is currently Thu May 23, 2013 5:21 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Icon Conundrum
PostPosted: Sat Feb 04, 2012 5:42 am 
Offline
Addict
Addict

Joined: Fri Oct 23, 2009 2:33 am
Posts: 2862
Location: Wales, UK
The main window of my utility app should not have an icon in the Title bar. If you do not specify your own icon for the compiler to use, a system default icon is used in the Title bar. The default icon can be suppressed using an extended window style:
Code:
SetWindowLongPtr_(WindowID(#Win), #GWL_EXSTYLE, GetWindowLongPtr_(WindowID(#Win), #GWL_EXSTYLE) | #WS_EX_DLGMODALFRAME)

That certainly works with the system default icon, but if an icon is specified in the compiler, it still appears on the Title bar, meaning that your own icon cannot be applied to the exe file if you want it omitted from the window title bar............

Anybody have a workaround without resorting to a 'Tool' window?

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


Top
 Profile  
 
 Post subject: Re: Icon Conundrum
PostPosted: Sat Feb 04, 2012 5:51 am 
Offline
Addict
Addict
User avatar

Joined: Wed Dec 23, 2009 10:14 pm
Posts: 1386
Location: Boston, MA
That's why I don't specify an icon in the compiler. :wink:
I keep images in a datasection and set an explicit icon for each window.

_________________
To understand recursion, you must first understand recursion. ~ unknown
I never make stupid mistakes. Only very, very clever ones. ~ John Peel


Top
 Profile  
 
 Post subject: Re: Icon Conundrum
PostPosted: Sat Feb 04, 2012 6:06 am 
Offline
Addict
Addict

Joined: Fri Oct 23, 2009 2:33 am
Posts: 2862
Location: Wales, UK
That's an interesting idea. I assume it still works if an icon is specified for the compiler to use as the exe icon.

......It isn't a solution to my issue though, because I want an icon for the exe, but not for the window.

Edit: Unless there is a 'set icon' type of message (like PB's SetWindowTitle) which would permit the setting of 'no icon'

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


Top
 Profile  
 
 Post subject: Re: Icon Conundrum
PostPosted: Sat Feb 04, 2012 6:47 am 
Offline
Addict
Addict

Joined: Thu Nov 01, 2007 5:37 pm
Posts: 1566
Location: Germany
Simply set the icon to "none" before applying #WS_EX_DLGMODALFRAME, like this:
Code:
Procedure WindowRemoveIcon(WindowNr)
   Protected WindowID = WindowID(WindowNr)

   SetClassLongPtr_(WindowID, #GCL_HICON, 0)
   SetWindowLongPtr_(WindowID, #GWL_EXSTYLE, GetWindowLongPtr_(WindowID, #GWL_EXSTYLE) | #WS_EX_DLGMODALFRAME)
EndProcedure


Top
 Profile  
 
 Post subject: Re: Icon Conundrum
PostPosted: Sat Feb 04, 2012 5:41 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Dec 23, 2009 10:14 pm
Posts: 1386
Location: Boston, MA
Your original idea worked for me(Win7/XP) if you don't specify an icon in the exe.
Then overwrite the icon for additional windows as needed.
Code:
; Set/Change icon.
SendMessage_(WindowHandle), #WM_SETICON, 0, ImageHandle) ; 0=ICON_SMALL, 1=ICON_BIG

; Drop icon.
SetWindowLongPtr_(WindowHandle, #GWL_EXSTYLE, GetWindowLongPtr_(WindowHandle, #GWL_EXSTYLE) | #WS_EX_DLGMODALFRAME)

_________________
To understand recursion, you must first understand recursion. ~ unknown
I never make stupid mistakes. Only very, very clever ones. ~ John Peel


Top
 Profile  
 
 Post subject: Re: Icon Conundrum
PostPosted: Sat Feb 04, 2012 9:26 pm 
Offline
Addict
Addict

Joined: Fri Oct 23, 2009 2:33 am
Posts: 2862
Location: Wales, UK
Sorry guys, you are missing the point. My icon is wanted for the exe, but not wanted for any window. Using #GWL_EXSTYLE will only remove the system icon, not the one (my icon) embedded by the PB compiler. Possibly hacking the exe to replace the icon might work, have not tried that.

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye