|
-
Jun 25th, 2001, 08:15 PM
#1
Thread Starter
Member
Form Caption
I am trying to make a form be maximized with no title bar, no min/max buttons, and no control box. Basically just the form covering the entire screen. I also want the form to show up on the taskbar with an icon and the name of the program. That way when you alt+tab you can choose the program.
The problem is that if I try to give the form a caption then the title bar appears. If I don't give it a caption, then the taskbar shows a blank button.
How can I make this work?
I am open to any suggestions, even API if necessary...
Thanks
-
Jun 25th, 2001, 08:19 PM
#2
Addicted Member
make the form bordersytle none
-
Jun 25th, 2001, 08:22 PM
#3
Addicted Member
and also make the show in taskbar property set to ture
-
Jun 25th, 2001, 08:51 PM
#4
_______
<?>
Code:
'Show the icon of a titleless form in taskbar tray
Private Declare Function SetWindowLong Lib "user32" _
Alias "SetWindowLongA" (ByVal hwnd As Long, _
ByVal nIndex As Long, ByVal dwNewLong As Long) _
As Long
Private Const GWL_STYLE = (-16)
Private Const WS_SYSMENU = &H80000
'<<<<<< Form load >>>>>>
Private Sub Form_Load()
Call SetWindowLong(Me.hwnd, GWL_STYLE, WS_SYSMENU)
End Sub
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Jul 1st, 2001, 07:09 PM
#5
Thread Starter
Member
Thanks,
This seems to work, but it gives my form a control menu, which has the move and close choices enabled. I cannot have a control menu available on this form. Could this have something to do with the WS_SYSMENU constant? What should I change this to, so that I won't have a system menu??
Also, what does the GWL_STYLE constant do?
Thanks again
-
Jul 10th, 2001, 07:54 PM
#6
Thread Starter
Member
-
Jul 10th, 2001, 08:17 PM
#7
Hyperactive Member
If you mean the menu that pops up when you right click the title bar or a minimized app, then set the forms Control Box property to False.
I believe the WS_SYSMENU controls whether an application that is reudced to an icon has a System Menu or not.
-
Jul 10th, 2001, 09:02 PM
#8
Addicted Member
THE EASIEST WAY....
in the properties menu, set the controlbox to false, and set the borderstyle to none. Then, to make it cover the WHOLE screen, including the tasbar, insert this code:
Code:
Private Sub form_load()
form1.height=screen.height
form1.width=screen.width
end sub
I believe thats all you need. I cant help with having a captoin in the taskbar button without a title bar, sorry.
Gray FOX: "Only a fool, trusts his life to a Weapon!"
Bart Simpson: "Bart no like! Baaad medicene!"
www.sling.to/dementia-freaks <<<---Goto my site!
http://pub80.ezboard.com/bdementiafreaksforum <<<---Goto my forum!
Thats it!
-
Jul 19th, 2001, 10:11 PM
#9
Thread Starter
Member
I get the form to fill the screen by setting the form to maximize. I get rid of all of the title bar stuff, and the form displays fine, but when I look at the taskbar the button is blank. It seems that you have to have a caption on the form to have something other than a blank button on the taskbar. The problem is that if I put a caption on the form, it will show the title bar. How can I force the titlebar on the form to stay hidden?
Thanks for any help...
-
Jul 19th, 2001, 10:52 PM
#10
Frenzied Member
here you have got what you want.
But you need to make a way to exit the program.
and you need to compile it, it want work good in Debug.
-
Jul 23rd, 2001, 10:05 PM
#11
Thread Starter
Member
Thanks. I'll check it out and give it a try.
-
Jul 23rd, 2001, 10:10 PM
#12
Frenzied Member
Is it working for you?
Please Post.
-
Jul 29th, 2001, 04:26 PM
#13
Thread Starter
Member
Sorry, but this doesn't really do anything that I need. The button on the taskbar does have the caption on it, but there is no icon for the program. Also, the form has a caption on it. This is what I have been trying to get rid of.
Thanks for trying to help me.
-
Jul 29th, 2001, 04:56 PM
#14
Frenzied Member
I realy dont know what you are talking about. Are you talking of the sample i posted. if yes check out this Exe its a compiled version of that code.
-
Jul 29th, 2001, 05:03 PM
#15
Addicted Member
OK, try this. It will show the form's caption in the task bar only...and as for the icon, dunno...
Set the following form properties:
BorderStyle - 0
Caption - "Hello World"
ShowInTaskbar - True
And that's it!
-
Jul 29th, 2001, 05:09 PM
#16
Frenzied Member
The same thing that i posted.
-
Jul 29th, 2001, 05:56 PM
#17
Addicted Member
Where? In attachment?
FOOBAR posted the same thing also...
Last edited by Arcom; Jul 29th, 2001 at 06:00 PM.
-
Jul 29th, 2001, 08:08 PM
#18
Thread Starter
Member
I have done all of this, and I still can't get the icons to work properly. When I press ALT+Tab and get the task manager, the icon for my program is the windows logo. Also, the task bar button for the form has no icon.
I don't know if it makes a difference, but this form is not the main form for my program. I hide the main from when I show this form, and I want this form to be full screen and act like it is now the main form. This means it should have a button with an icon, and show the proper icon on the task menu.
Any ideas on how to do this?
Thanks.
-
Jul 29th, 2001, 10:01 PM
#19
The solution to your problem should be simple enough. Set up the form to be maximized (Set the WindowState property to vbMaximized) and put this code in:
VB Code:
'These are the API declarations
'Put this in the area above the rest of the form code (the General Declarations area)
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Const GWL_STYLE = (-16)
Private Const WS_BORDER = &H800000
Private Const WS_MAXIMIZEBOX = &H10000
Private Const WS_MINIMIZEBOX = &H20000
Private Const WS_DLGFRAME = &H400000
Private Const WS_THICKFRAME = &H40000
Private Const SWP_FRAMECHANGED = &H20
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOSIZE = &H1
Private Const SWP_NOZORDER = &H4
'This is the code to take out the border
'You probably want it in Form_Load
Dim lStyle As Long
lStyle = GetWindowLong(Me.hwnd, GWL_STYLE)
lStyle = lStyle And Not (WS_BORDER Or WS_DLGFRAME Or WS_MAXIMIZEBOX Or WS_MINIMIZEBOX Or WS_THICKFRAME)
Call SetWindowLong(Me.hwnd, GWL_STYLE, lStyle)
SetWindowPos Me.hwnd, 0, 0, 0, 0, 0, SWP_FRAMECHANGED Or SWP_NOMOVE Or SWP_NOSIZE Or SWP_NOZORDER
The form will be maximized with no border so it takes the whole screen. When you look at the taskbar, the form will still have an icon and caption.
-
Jul 29th, 2001, 10:08 PM
#20
Hyperactive Member
u cant get a icon when u hit ctrl+alt+del but there must be some how to get it.... defualt is that windows icon
-
Jul 29th, 2001, 10:42 PM
#21
New Member
ji
He isnt talking about the CTRL-ALT-DEL menu, he means the Alt-Tab Task Manager
-
Jul 29th, 2001, 11:06 PM
#22
Oh..
oops
I'll see what I can do, then..
-
Jul 29th, 2001, 11:10 PM
#23
Yeah, the icon does show in the Alt-Tab window. The program has to be running from an exe. You won't see the icon in the Alt-Tab window when you run the program from within the VB IDE. But if you compile it to an exe and run that, you see the icon just fine.
-
Jul 29th, 2001, 11:12 PM
#24
Hyperactive Member
oh ok, yea i meant alt+tab
-
Jul 29th, 2001, 11:37 PM
#25
Frenzied Member
Yes Tygur that Api does the job.
-
Jul 31st, 2001, 06:38 PM
#26
Thread Starter
Member
Thank you Tygur.
Now I may be getting a little picky here, but the form I am using this code on is not the main form for my program. When I bring up this form I hide the main form to prevent someone from Alt+Tabbing to the main form and messing around. I can't show the form modal, because I also show a small form with some other information. The user must be able to work with either form so it can't be modal.
I guess I should state the problem before I go into detail, but for those of you still reading. When I use this code, the taskbar button doesn't have an icon. The icon shows up fine in the Alt+Tab thingy, but not on the taskbar. Is this possible to do or should I quit being so technical?
I want the second form to appear to be the main form while the main form is hidden.
Any ideas?
-
Jul 31st, 2001, 07:20 PM
#27
Fanatic Member
i had to make one of those for a "lock computer", cuz my little bro jumps for the comp when i leave it for a sec.
In form properties, set the border style to normal, then double click on the title bar. it'll maximize the form. then set the border style to none. so it'll start up maximized (when you close VB then open the project again, it won't be maximized in the design view, but at runtime it will be)
then to set the icon, click on the form and in the properties, choose your icon
the in form_load(), put:
have it show up in the taskbar, and ur done.
hope it helps,
nabeel
Visit www.fragblast.com
Gaming, forums, and a online RPG/Battle system
(__Flagg) DOT NET? is this a Hindi Dating service?
-
Jul 31st, 2001, 07:41 PM
#28
Thread Starter
Member
Sorry, but that would give me the same problem I was having before with the title in the button, but no title bar.
I think I need to use Tygur's API code, but there must be a switch to turn the icon on in the button.
Thanks for trying to help me.
-
Jul 31st, 2001, 08:19 PM
#29
So the icon's not showing up in the taskbar button?
Make sure ControlBox is True
Also make sure the borderstyle is not None, Fixed Toolwindow, or Resizable Toolwindow.
If the icon still isn't showing, let me know and I'll see what else could be preventing it.
The form setup you're explaining confuses me, but if you want to show a form and have it always stay on top of another form while you can still use the other form, this works:
Form2.Show , Form1
-
Jul 31st, 2001, 09:18 PM
#30
Fanatic Member
it's
VB Code:
me.icon.render(me.hdc,something....)
im figuring that out
to get a form to stay on top
in module:
VB Code:
Const SWP_NOMOVE = 2
Const SWP_NOSIZE = 1
Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE
Const HWND_TOPMOST = -1
Const HWND_NOTOPMOST = -2
Public Declare Function BringWindowToTop Lib "user32" (ByVal hwnd As Long) As Long
Public Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Public Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, _
ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Declare Function GetCurrentProcessId Lib "kernel32" () As Long
Public Function SetTopMostWindow(hwnd As Long, Topmost As Boolean) As Long
If (Topmost) Then
SetTopMostWindow = SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS)
Else
SetTopMostWindow = SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, FLAGS)
SetTopMostWindow = False
End If
End Function
then to call it
VB Code:
'on top:
SetTopMostWindow Me.hwnd, True
'not on top
SetTopMostWindow Me.hwnd, False
hope it helps
-Nabeel
Visit www.fragblast.com
Gaming, forums, and a online RPG/Battle system
(__Flagg) DOT NET? is this a Hindi Dating service?
-
Aug 1st, 2001, 07:14 PM
#31
Thread Starter
Member
Tygur,
I changed the controlbox and border on my form, and now the icon shows up, but if I hit ALT+SPACEBAR when my form is visible, I get a control menu with Move (disabled) and close. If I have controlbox False then the icon disappears.
This would probably work, because there is no sign that there would be a control menu. The user would just have to guess and hit the ALT+SPACE.
Any ideas on this one?
-
Aug 1st, 2001, 08:46 PM
#32
so you don't want the control menu?
why not?
-
Aug 4th, 2001, 05:37 PM
#33
Thread Starter
Member
I just think it looks kind of wierd for a control menu to pop up out of the top of the window when you hit ALT+SPACE. I suppose the ideal way for it to be would be to have the control menu only display off of the taskbar, and not from the window at all, but I don't think that is possible. I think I should be able to work with things the way they are now. Atleast there are no visible signs of the menu, and now all of the icons work properly.
Thanks to all of you who helped me out with this problem.
-
Nov 4th, 2001, 10:01 AM
#34
Fanatic Member
did you try via API?
VB Code:
Private Declare Function SetWindowText Lib "user32" _
Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long
dim cap as string
cap = "the new caption"
SetWindowText Me.hwnd, cap
Visit www.fragblast.com
Gaming, forums, and a online RPG/Battle system
(__Flagg) DOT NET? is this a Hindi Dating service?
-
Nov 4th, 2001, 11:01 AM
#35
Frenzied Member
CONTROL OFF NET
hay, i found this control on the internet which literally puts an icon in the tray/takes it out with a simple setting. check it out
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
|