Hi folks (correct to say so? I learned this in my english lesson in school ),
I have developed a small utility that reads out my outlook calendar appointments and displays it on a four weeks calendar form (I attached a screenshot, does it work?). The form is part of the autostart and so whenever i boot my pc I get informed about my appointments (mainly soccer appointments, by the way). Theform has no boarder and so it looks like it sticks to the desktop, or like it is part of my wallpaper.
Now the problem: when I click on the desktop icon (left at the bottom of the screen, beneath the start button) my form disappears. But I want to have it stick there, whatever do. I know, there are programs which work as i want but I don't know how to code such a behaviour. Can someone help me?
well when you click any icon on desktop you app. would lose the focus hence making it "dissapear" what you would like to do is always have it on top so add the following code to your project and it should stay on top always
VB Code:
'Put following in a module
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
Public Const SWP_NOMOVE = &H2
Public Const SWP_NOSIZE = &H1
Public Const HWND_TOPMOST = -1
Public Const HWND_NOTOPMOST = -2
'Following code is to be on a Form...
'Place this in the Form_load:
SetWindowPos hwnd, HWND_TOPMOST, _
0, 0, 0, 0, SWP_NOMOVE + SWP_NOSIZE
'Place this in the Form_QueryUnload:
SetWindowPos hwnd, HWND_NOTOPMOST, _
0, 0, 0, 0, SWP_NOMOVE + SWP_NOSIZE
I think that should do it good luck!
Born to help others (If I've been helpful then please rate my post. Thanks)
That looks like a nice application. When you are done you could post the code in the UtilityBank. I know I'd be one of the people who'd be interested in it.
i don't think he wants it always on top, it should be 'stuck to the desktop'
the reason it's disappearing must have to do with the way you're hiding the rest of your form.
this can probably be solved, but another option might be to have the program create an .html or even a .bmp file that reflects the wallpaper + the clander.
thanks for your help. In the meantime my little prog got a bit more completed. It now can navigate through the calendar using the buttons at the right (one week or one month back and forth and home to the current week). It now runs well, rather fast and the size of the exe is surprising 60 KB (less than 200 lines of VB code). It prints birthdays colored and important appointments in a definable color (both hard coded at the moment, not configurable).
But there are some problems left. First the "sticky" problem. Since the program window has no frame it cannot be moved to another place on the desktop. That's ok so far. But when I press the desktop icon near to the start button (see 1) it loses focus and disappears. But I want it to have stuck on the desktop, like part of the wallpaper (as dis1411 said, not topmost as ej12n said).
Another problem is that i use the label element of the MS Forms 2.0 Object Library because the standard label does always wrap and not truncate (see 2). And I heared that progs which do not use the standard lib may not be distributed freely.
A third problem is the dotted line at the navigation button (see 3). I dont want to have it anywhere. Furthermore I dont want to allow keyboard use anyway. All my buttons have TabStop = False but the dotted line doesnt disappear.
Hi.. almost after a year i came across this application of urs
infact i am working on building a smiliar one for my desktop too... (darn i am a year late)
do tell us if u have completed and sucessfully executed the application
i am trying to develop this in Vb 2005 express edition..
You can restrict a form's "movablity" either by setting "Movable=False" at desigintime or by subclassing the form and trapping WM_WINDOWPOSCHANGING message.
Here is a code in VB6: