Transparent Clock sourcecode

Share your advanced PureBasic knowledge/code with the community.
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Transparent Clock sourcecode

Post by netmaestro »

Several months ago I started work on a transparent clock, which I named "VistaClock". Since that time I've been gradually improving the look and function of the clock, and the resources used by it have gone steadily down while performance has gone up. I always intended to release the source code for this project, but as it's been a learning experience for me I didn't feel it was appropriate to do so until I had something pretty solid. Today is the day, after much development, and a few last-minute changes to allow the clock to run successfully under Vista, I consider it "ready for critique". The images included with this release are not my transparent clock graphics, but they will suffice to allow the provided sourcecode to run. Here it is, I hope you enjoy studying it as much as I enjoyed writing it:

http://www.lloydsplace.com/transparentclock.zip

Something I noticed with this project is that the CreateStreamOnHGlobal_( API will work with a block of memory allocated with PB's AllocateMemory() on WinXP, but on Vista it's no dice. You have to use GlobalAlloc and GlobalLock. The clock initially wouldn't run on Vista at all until I found this little detail.
Last edited by netmaestro on Tue Jul 07, 2009 8:25 pm, edited 4 times in total.
BERESHEIT
Clutch

Post by Clutch »

Thanks very much for this. I've been lurking in these forums for several months, and I've always been very impressed with and learned a lot from your many contributions. Keep up the good work! :)
rsts
Addict
Addict
Posts: 2736
Joined: Wed Aug 24, 2005 8:39 am
Location: Southwest OH - USA

Post by rsts »

Thanks for another fine contribution (and lesson) :)

cheers
Pureabc
User
User
Posts: 76
Joined: Mon Jan 16, 2006 1:11 am

Post by Pureabc »

Excellent!!

:D
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4790
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Post by Fangbeast »

Man, that's some sexy bit of code. I wonder if you, srod and sparkie are secretly the 3 wise kings?

:D :D :D
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

Thanks for the kind words, but I really shouldn't be considered in Sparkie's league. He's still a fifty times stronger coder than me.

But 6 months ago he was 60 times stronger... :twisted:
BERESHEIT
Dare
Addict
Addict
Posts: 1965
Joined: Mon May 29, 2006 1:01 am
Location: Outback

Post by Dare »

netmaestro wrote:But 6 months ago he was 60 times stronger... :twisted:
:lol:

Thanks for this, netmaestro.
Dare2 cut down to size
JCV
Enthusiast
Enthusiast
Posts: 580
Joined: Fri Jun 30, 2006 4:30 pm
Location: Philippines

Post by JCV »

Thanks netmaestro. :D
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

I look forward to studying this one netty; thanks. I could do with looking through some gdi+ code; thanks. :)

@fangs: compared to sparks and netty, I'm just a wild hack merchant! Hell, half the code I produce, I don't understand! The other half is not even mine! 8)
I may look like a mule, but I'm not a complete ass.
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

Thank you :!:
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

You're most welcome. It's time to tackle some more gdiplus challenges now. 610 commands, so little time... :shock:
BERESHEIT
User avatar
GeoTrail
Addict
Addict
Posts: 2794
Joined: Fri Feb 13, 2004 12:45 am
Location: Bergen, Norway
Contact:

Post by GeoTrail »

netmaestro, amazing coding there m8.
Opened it up in Vista, hit compile and it runs perfect. It runs more smoothly on Vista then the clock from the sidebar ;) If there was a PB Hall Of Fame, this should have a place there ;)
I Stepped On A Cornflake!!! Now I'm A Cereal Killer!
User avatar
GeoTrail
Addict
Addict
Posts: 2794
Joined: Fri Feb 13, 2004 12:45 am
Location: Bergen, Norway
Contact:

Post by GeoTrail »

Code: Select all

Case 0 To 128
I didn't know we could do that :lol:
Would have saved me alot of time on previous projects ;)
I Stepped On A Cornflake!!! Now I'm A Cereal Killer!
Amundo
Enthusiast
Enthusiast
Posts: 200
Joined: Thu Feb 16, 2006 1:41 am
Location: New Zealand

Post by Amundo »

Very nice, Netmaestro, thanks for sharing your work.
Win10, PB6.x, okayish CPU, onboard video card, fuzzy monitor (or is that my eyesight?)
"When the facts change, I change my mind" - John Maynard Keynes
jear
User
User
Posts: 20
Joined: Sun Dec 28, 2003 12:27 am
Location: Ammerland

Post by jear »

@netmaestro
Thanks for sharing this excellent code.
I wonder that the compiled task didn't remember the settings.

Code: Select all

ExamineDesktops()
has to be done before

Code: Select all

DesktopWidth(0)
is used in line 503
Now it works perfectly!
Post Reply