|
-
Jun 22nd, 2006, 02:40 PM
#1
Thread Starter
C# Aficionado
[RESOLVED] [2005] this.Text = "" but with a Taskbar Title
when I set my form's .Text property to a blank value (so that it doesnt have a titlebar) - how do I also set a value that it should use on the TaskBar button (since having a blank taskbar button is dumb, and good .. is dumb).
Need to re-register ASP.NET?
C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i
(Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)
-
Jun 23rd, 2006, 04:44 AM
#2
Re: [2005] this.Text = "" but with a Taskbar Title
I haven't tried this but just had an idea...
You could try setting your form to not show in the taskbar but also have another invisible form that does display in the taskbar.
You could then load your invisible form first and then open your main form as a dialogue of the invisible form.
That way clicking on the taskbar button will still bring your main form to focus.
Make sense or am i talking nonsense?
-
Jun 23rd, 2006, 04:46 AM
#3
Re: [2005] this.Text = "" but with a Taskbar Title
How does it belong to ASP.NET Forum?
Use [code] source code here[/code] tags when you post source code.
My Articles
-
Jun 23rd, 2006, 05:01 AM
#4
Re: [2005] this.Text = "" but with a Taskbar Title
instead of this.visible = false; use this.Opacity = 0; because if the first form is invisible it doesn't show in the task bar either.
-
Jun 23rd, 2006, 05:03 AM
#5
Re: [2005] this.Text = "" but with a Taskbar Title
 Originally Posted by Shuja Ali
How does it belong to ASP.NET Forum? 
It doesn't but neither me or Lord_rat has the ability to move it to C#.
ahem moderator please....
-
Jun 23rd, 2006, 01:01 PM
#6
Thread Starter
C# Aficionado
Re: [2005] this.Text = "" but with a Taskbar Title
 Originally Posted by Fishcake
I haven't tried this but just had an idea...
You could try setting your form to not show in the taskbar but also have another invisible form that does display in the taskbar.
You could then load your invisible form first and then open your main form as a dialogue of the invisible form.
That way clicking on the taskbar button will still bring your main form to focus.
Make sense or am i talking nonsense?
This is exactly what I may end up resorting to, but it bugs the hell out of me.
Need to re-register ASP.NET?
C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i
(Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)
-
Jun 23rd, 2006, 01:01 PM
#7
Thread Starter
C# Aficionado
Re: [2005] this.Text = "" but with a Taskbar Title
 Originally Posted by Shuja Ali
How does it belong to ASP.NET Forum? 
I was in the wrong forum when I submitted my question. Sorry.
Need to re-register ASP.NET?
C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i
(Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)
-
Jun 23rd, 2006, 01:02 PM
#8
Thread Starter
C# Aficionado
Re: [2005] this.Text = "" but with a Taskbar Title
 Originally Posted by Fishcake
instead of this.visible = false; use this.Opacity = 0; because if the first form is invisible it doesn't show in the task bar either.
Yes I know. But there are other problems with this too. Like when you right click the button and MOVE, you will be moving the hidden form, not the real one.
Stuff like that.
Need to re-register ASP.NET?
C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i
(Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)
-
Jun 23rd, 2006, 01:26 PM
#9
Addicted Member
Re: [2005] this.Text = "" but with a Taskbar Title
Hey Lord Rat, you are using my .NET Lovers Userbar 
Anyway, I am sure that you could look for a tutorial somewhere if your question does not get answered. This is the best site for questions by far:
http://www.syncfusion.com/faq/aspnet/default.aspx
-
Jun 24th, 2006, 11:15 AM
#10
Re: [2005] this.Text = "" but with a Taskbar Title
Consider having no title bar at all?
-
Jun 24th, 2006, 01:43 PM
#11
Re: [2005] this.Text = "" but with a Taskbar Title
this.FormBorderStyle = FormBorderStyle.None;
-
Jun 24th, 2006, 02:51 PM
#12
Re: [2005] this.Text = "" but with a Taskbar Title
Moved
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jun 26th, 2006, 12:32 PM
#13
Thread Starter
C# Aficionado
Re: [2005] this.Text = "" but with a Taskbar Title
 Originally Posted by mendhak
Consider having no title bar at all?
I need a taskbar button still, so I have to have a title, otherwise I end up with a blank taskbar button and that's just as silly as Bolivia!
As for tutorials, none of them ever address this issue.
Need to re-register ASP.NET?
C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i
(Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)
-
Jun 26th, 2006, 12:33 PM
#14
Thread Starter
C# Aficionado
Re: [2005] this.Text = "" but with a Taskbar Title
 Originally Posted by Seraphino
Hey Lord Rat, you are using my .NET Lovers Userbar 
Are you saying you created it yourself? If so, good job.
I also am using a couple I made myself in the rotation - DDO Player (which I need to remove as I no longer am) and Proud Father (which I never will remove)
Need to re-register ASP.NET?
C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i
(Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)
-
Jun 26th, 2006, 12:38 PM
#15
Re: [2005] this.Text = "" but with a Taskbar Title
I'm sure you could keep the title of the window blank but use an API to change the text in the taskbar button.
-
Jun 26th, 2006, 12:49 PM
#16
Thread Starter
C# Aficionado
Re: [2005] this.Text = "" but with a Taskbar Title
That could be a possibility. Hrm.
Need to re-register ASP.NET?
C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i
(Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)
-
Jun 26th, 2006, 12:55 PM
#17
Re: [2005] this.Text = "" but with a Taskbar Title
Why don't you just have no title bar like mendhak and I suggested? You still have a taskbar button with a title, just no actual title or window border.
otherwise, could you elaborate on the effect you are after?
-
Jun 26th, 2006, 12:56 PM
#18
Thread Starter
C# Aficionado
Re: [2005] this.Text = "" but with a Taskbar Title
Perhaps I missed something. Having no titlebar is exactly what I am after, but in order to do it I have had to set the .Text to "" which also blanks out the Taskbar Button.
Are you suggesting there is a method of having no titlebar without setting the .Text to ""?
Need to re-register ASP.NET?
C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i
(Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)
-
Jun 26th, 2006, 12:58 PM
#19
Re: [2005] this.Text = "" but with a Taskbar Title
Yes, what I posted in #11
-
Jun 26th, 2006, 01:03 PM
#20
Lively Member
Re: [2005] this.Text = "" but with a Taskbar Title
here's an article i stumbled upon (written in c#):
http://www.codeproject.com/csharp/taskbarsorter.asp
which i'm sure you could adapt to your needs. search through the buttons until you find the window handle that matches yours. then send a TB_SETBUTTONINFO to the taskbar to modify the text. seems a little brute-forced, but it would probably work. good luck
-
Jun 26th, 2006, 01:05 PM
#21
Thread Starter
C# Aficionado
Re: [2005] this.Text = "" but with a Taskbar Title
Well, you are right, that did allow me to have a taskbar button with a title, but is there a way to get a border back on my form now? (heh)
The fact that it is borderless is now umm, ugly. (Sorry to be such a pain, but I am very heavily interested in customer experience with every program I write and I WANT IT MY WAY!) =)
Need to re-register ASP.NET?
C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i
(Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)
-
Jun 26th, 2006, 01:07 PM
#22
Thread Starter
C# Aficionado
Re: [2005] this.Text = "" but with a Taskbar Title
 Originally Posted by zildjohn01
here's an article i stumbled upon (written in c#):
http://www.codeproject.com/csharp/taskbarsorter.asp
which i'm sure you could adapt to your needs. search through the buttons until you find the window handle that matches yours. then send a TB_SETBUTTONINFO to the taskbar to modify the text. seems a little brute-forced, but it would probably work. good luck
Wow, looks interesting. And complex. I'll see what I can do with that.
Need to re-register ASP.NET?
C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i
(Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)
-
Jun 28th, 2006, 04:07 PM
#23
Thread Starter
C# Aficionado
Re: [2005] this.Text = "" but with a Taskbar Title
Well, after now spending three days working with this, it is above me and I must submit to my inferior knowledge.
The farthest I got was that I could find all the buttons on the taskbar. I could process a bunch of messages, to do fun stuff like enable/disable any of them, hide them, etc.
I could also GET the text of the button because a built in API exists for that. But there is no API to simply set it (what the hell were they thinking!)
But to process anything requiring that I change the button text itself, I have to use a TB_BUTTONINFO structure. Using it crashes Explorer (joy) unless I try to use it in Unicode mode (TB_BUTTONINFOW) in which case I just get bad data or if I am truly lucky, I start trying to read and write protected memory (yuck).
So, I am finally giving up. I will revisit this later with some other form of solution, when I am not so exhausted from spending three days trying to get text on a button.
Finally, MS shortcutted the button itself. I found out that you can assign the text of a button through the string pool. They point the button itself and the form title to the same stringpool ID. Thanks Microsoft...
Need to re-register ASP.NET?
C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i
(Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)
-
Jun 28th, 2006, 05:41 PM
#24
Thread Starter
C# Aficionado
Re: [2005] this.Text = "" but with a Taskbar Title
Sometimes, the answer is staring you in the face. When I was doing all of my API stuff, I didnt think to modify the FORM through the API, I was modifying the TASKBAR BUTTON!!
Code is slightly ugly due to how windows handles redrawing forms, but it works:
Code:
#region Window Title Functions
[DllImport("user32", EntryPoint = "GetWindowLong")]
public static extern int GetWindowLong(IntPtr hwnd, Int16 nIndex);
[DllImport("user32", EntryPoint = "SetWindowLong")]
public static extern int SetWindowLong(IntPtr hwnd, Int16 nIndex, int nValue);
[System.Runtime.InteropServices.DllImport("user32.dll")]
static extern bool SendMessage(IntPtr hWnd, Int32 msg, Int32 wParam, Int32 lParam);
private const Int16 GWL_STYLE = (-16);
private const int WS_CAPTIONBORDERLESS = ~0xC00000;
private const int WS_CAPTION3DBORDER = ~0x800000;
private const int WS_CAPTIONSINGLEBORDER = ~0x400000;
private const int WM_REDRAW = 0x000B;
private const int WM_REPAINT = 0xF;
#endregion
private void UpdateStyle()
{
int iHeight = this.Height;
IntPtr hWindow = this.Handle;
int iStyle = GetWindowLong(hWindow, GWL_STYLE);
iStyle = iStyle & WS_CAPTION3DBORDER;
SetWindowLong(hWindow, GWL_STYLE, iStyle);
this.Width = 334;
SendMessage(hWindow, WM_REDRAW, 0, 0);
this.Height = iHeight + 10;
this.Refresh();
this.Height = iHeight;
SendMessage(hWindow, WM_REDRAW, 1, 0);
this.Refresh();
this.Height = iHeight;
}
Last edited by Lord_Rat; Jun 28th, 2006 at 05:46 PM.
Need to re-register ASP.NET?
C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i
(Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)
-
Jun 28th, 2006, 05:44 PM
#25
Thread Starter
C# Aficionado
Re: [RESOLVED] [2005] this.Text = "" but with a Taskbar Title
(Set the .Text property to whatever you want the taskbar button to show and modify all controlboxes accordingly as well (disable minimize if you dont want to be able to minimize from task bar, or maximize, etc))
Need to re-register ASP.NET?
C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i
(Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|