Been a while since I came here... I know that no one remembers me, so forget it
For one of my projects, I want to create a little program that would somewhat work like the Companion in Office 2000. In order to do that, I'll need to know a few things. I'm sure that some of these are pretty easy, but others will be painful, I'm afraid...
1- How do a make a form so it always stays on top of the others?
2- How can I drag a form to any location of the screen just by dragging it (not using the title bar)?
3- How can I make a form "transparent", so only the picture itself shows?
That's it for now... I'll probably come back for more later. Any help would be much appreciated
- Dr. Cossack
Interordi.com: Internet tools, programming, games, and more!
Originally posted by Dr. Cossack Been a while since I came here... I know that no one remembers me, so forget it
For one of my projects, I want to create a little program that would somewhat work like the Companion in Office 2000. In order to do that, I'll need to know a few things. I'm sure that some of these are pretty easy, but others will be painful, I'm afraid...
1- How do a make a form so it always stays on top of the others?
2- How can I drag a form to any location of the screen just by dragging it (not using the title bar)?
3- How can I make a form "transparent", so only the picture itself shows?
That's it for now... I'll probably come back for more later. Any help would be much appreciated
If you e-mail me, ill send you info on how to do the first two, and an OCX to do the third one (that I wrote). Its at work or id just give it to you now, but if you e-mail me ill mail it back to you and post it here as well.
I assume that you are talking about the Office Assistant (the little annoying guy who wants to know if you are writing a letter).
That was done using MS Agent, if Im not mistaken. Take a look through your components list, and you should find MS Agent Control. Add that to a project, and find a tutorial on it somewhere on the web. It is amazingly easy to use, you should have something up and running before you know it.
Heres how to make the form drag by clicking on it. (this is also an option in the OCX)
Declare Function ReleaseCapture Lib "user32" () As Long
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Const WM_NCLBUTTONDOWN = &HA1
Const HTCAPTION = 2
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
ReleaseCapture
SendMessage Me.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&
End Sub
and the OCX is attached, either set the AutoShape property to True, or call the refresh shape method to set the shape of your form. It will be set to the shape of the picture. All pixels that match the Top Left pixel in the picture will be set to transparent. The borderstyle of the form needs to be 0 - None, or it wont work right, this will be available in a future version. Any questions please feel free to e-mail me.
Zaei: Yes, I was referring to the "Office Assistant". I made the little mistake because I translated directly the French name for it... Also, I won't use the MS Agent, because I want to program my own program, so I can bring it to do exactly what I want.
rickm: Already replied to you by e-mail
Thanks for the input all, I was able to do some good progress. Yet, I have more questions...
4- How can I make it so the program shows in the system tray instead of the main taskbar area?
5- I already know how to use the menu command and pop-up menues, but how do I do to create the menu that will appear when clicking on the said icon on the system tray?
Thanks again
- Dr. Cossack
Interordi.com: Internet tools, programming, games, and more!
I think the API call for the system tray is ShellNotifyIcon. You will want to find some tutorial about it somewhere. You will be able to associate a menu with the icon when you set the icon up in the tray, If i remmeber correctly.
Originally posted by Zaei I think the API call for the system tray is ShellNotifyIcon. You will want to find some tutorial about it somewhere. You will be able to associate a menu with the icon when you set the icon up in the tray, If i remmeber correctly.
Z.
I found a nice tutorital today, and I got it to work within 5 minutes. Thanks
- Dr. Cossack
Interordi.com: Internet tools, programming, games, and more!