Author Topic: Direct X Desktop Clock  (Read 5255 times)

0 Members and 2 Guests are viewing this topic.

Offline GWS

  • Partner Developer
  • Hero Member
  • *****
  • Posts: 1488
Direct X Desktop Clock
« on: April 05, 2016, 07:50:10 AM »
Hi,

After just going back to XP from Win7, about the only thing I miss is the Clock Gadget.
This sits on the screen always showing me how fast time is passing  ;D

So I've made my own.  It's a Direct X program so that I can use sprites for the clock hands.
An alternative would have been to draw the hands using lines, but then, without anti-aliasing, you can sometimes see jagged edges as the hands rotate.  With sprites, it's not so obvious.

You can right-click on the clock to choose between two clock styles.  The context menu also has an exit option.  You can also close the program by left-clicking on the clock to get the focus, and then pressing Esc or Q.

The program's interesting in that it uses a circular window to display the dragable clock.

Best wishes, :D

Graham

[This has been re-worked without using DirectX, which had some problems - see the version below]
« Last Edit: April 08, 2016, 05:57:15 AM by GWS »
Tomorrow may be too late ..

Offline Bill-Bo

  • Full Member
  • ***
  • Posts: 236
Re: Direct X Desktop Clock
« Reply #1 on: April 05, 2016, 04:32:04 PM »
Graham,

I sure like your clock program. I much prefer the clock with the numbers.

Bill

P.S. Been using the clock for awhile. I change screens a lot because I'm all over the internet, or doing different things on my computer. I found that every-once-in-awhile the whole clock will turn blue. If I click on the clock, it will go back to normal.
« Last Edit: April 05, 2016, 06:08:30 PM by Bill-Bo »

Offline GWS

  • Partner Developer
  • Hero Member
  • *****
  • Posts: 1488
Re: Direct X Desktop Clock
« Reply #2 on: April 05, 2016, 06:01:49 PM »
Thanks Bill  ;D

I decided to include two different clockfaces - the typical railway clockface, and a 'minimalist' one.

There are many more styles that could be used, as you will see if you type 'Clock' into Google and select images.  They just need a bit of processing in a graphics program to reduce them to 100px square images suitable for a clock. The circular window then looks at them as if through a circular hole .. :P

I'm always amazed at the applications that can be accomplished with Creative Basic - it may be old, but it's still capable of so many things.

The idea of using shaped Windows emerged 14 years ago on the original Pyxia website - they can in fact be of any size, and any shape. You could have as many as you want, and they can be simple GUI windows - they don't have to be DX windows.  I only used DX here because I wanted to use sprites for the moving clock fingers.

I'm quite pleased with the result ..  ;D

Best wishes, :)

Graham

« Last Edit: April 05, 2016, 06:03:36 PM by GWS »
Tomorrow may be too late ..

Offline GWS

  • Partner Developer
  • Hero Member
  • *****
  • Posts: 1488
Re: Direct X Desktop Clock
« Reply #3 on: April 05, 2016, 06:24:26 PM »
Hi Bill,

I nearly missed your last message ..  :)

I haven't noticed it going blue yet, but occasionally when other windows move behind it, you do see a temporary 'interference'. 

As you say, it usually goes away if you click on the clock to give it the focus. 

Not sure how it could be improved.  I can think of one thing.  GUI and DX don't mix very well.  At the moment I'm using a simple GUI background image for instance.  I could have used a DX map instead - maybe that would have been better.  I could try it.  It would be a simple change to make.

'I'll be back' - as Arnie would say .. ;D

Graham
Tomorrow may be too late ..

Offline GWS

  • Partner Developer
  • Hero Member
  • *****
  • Posts: 1488
Re: Direct X Desktop Clock
« Reply #4 on: April 06, 2016, 12:36:38 AM »
Bill,

I tried using DX maps - but that didn't make any difference. :(

In fact I've not been able to find anything that corrects the effect.

The DX functions work directly to the video card, so it's probably down to how Direct X works.

I'll try a more recent version at some point to see if that has any effect. I'm using DX 9.0C at the moment.

Graham  :)
Tomorrow may be too late ..

Offline Bill-Bo

  • Full Member
  • ***
  • Posts: 236
Re: Direct X Desktop Clock
« Reply #5 on: April 06, 2016, 06:04:53 AM »
That's okay, Graham. It doesn't happen enough to be a problem. I'm still using it.

Good work!

Bill

Offline Andy

  • Hero Member
  • *****
  • Posts: 1310
Re: Direct X Desktop Clock
« Reply #6 on: April 06, 2016, 02:03:53 PM »
Graham,

It is a great idea, would be nice if we could have an IWB version.

Anyone converted it yet?

I will have a look tomorrow.

Andy.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Offline Andy

  • Hero Member
  • *****
  • Posts: 1310
Re: Direct X Desktop Clock
« Reply #7 on: April 08, 2016, 05:50:21 AM »
Graham,

I'm having trouble converting this to IWB.

I've added ENDSUB's to the end of SUB sections, but there are still some errors I don't think I can fix.

Could someone have a look please?

Attached is the amended code (so far) and the output from the compile.

Thanks,
Andy.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Offline GWS

  • Partner Developer
  • Hero Member
  • *****
  • Posts: 1488
Re: Direct X Desktop Clock
« Reply #8 on: April 08, 2016, 06:20:15 AM »
Hi Andy,

Conversion is not a trivial job - it would cause a lot of brain ache ..  ::)

You're maybe not aware of the origins IWB and CB.

CB was an update many years ago from IBasic Standard, and despite my throwing hundreds of dollars at the developer trying to get him to incorporate the new 2D and 3D graphics, it never happened.

The preferred development was IBasic Professional which included the graphics commands you have in IWB today, along with many other 'improvements'.  IWBasic arrived.
 
In the words of the developer, 'there would be no more hand-holding'.  Whereas CB was designed to take the complexity of Windows and hide it from the programmer - the new language became OOP'y and more 'C' like.

I never got on with the more complex language - I preferred the small and simple Creative Basic, finding it much more pleasant to use.

So now, a conversion from CB to IWB will likely result in screens full of 'errors'. :(
The graphics in particular would require getting familiar with a different 2D/3D command set - not to mention many syntax differences.  It's hardly worth the effort - easier to just use the CB version. ;)

Anyway, given the problems mentioned above, I was just about to post a new version - see my next post.
This one should be much easier to convert 'cos there's no Direct X graphics in it ..

Best wishes, :)

Graham

Tomorrow may be too late ..

Offline Andy

  • Hero Member
  • *****
  • Posts: 1310
Re: Direct X Desktop Clock
« Reply #9 on: April 08, 2016, 06:25:18 AM »
Graham,

That's very interesting about the origins of IWB and CB - I didn't know anything about that.

I would love to see you next post, as I think a clock gadget would be a very nice function.

Best wishes - as always,

Andy.
 :)
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Offline GWS

  • Partner Developer
  • Hero Member
  • *****
  • Posts: 1488
Re: Direct X Desktop Clock
« Reply #10 on: April 08, 2016, 06:32:16 AM »
Hi folks,

I'm not happy..  :(

When I thought of this project, it seemed a good idea to use sprites for the clock fingers.
This of course required Direct X.  I never imagined there would be problems with the clockface turning blue, or the clock stopping when some other programs started up. ::)

Although the effects could be corrected by clicking on the clock - which then reverted to normal - it's not very satisfactory.

It seems a small Direct X window does not like co-existing with certain other programs on the same screen.

So I'm admitting defeat for the Direct X version, and I've made a normal window version.
This is unaffected as far as I can tell, by any other software that may start up.

It looks much the same - so you may find this a better version to use ..

All the best, :)

Graham
Tomorrow may be too late ..

Offline Andy

  • Hero Member
  • *****
  • Posts: 1310
Re: Direct X Desktop Clock
« Reply #11 on: April 08, 2016, 06:47:54 AM »
Graham,

I understand the frustration! I've spent nearly 4 months writing my StringMap library, and the hardest part was working with very large numbers represented (passed as) strings.

I had to re-invent the wheel to do so.

I think most of us are just the same, we imagine something, and get frustrated when the end product is not exactly how we wanted it.

Keep your chin up!
Andy.
 :)
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Offline GWS

  • Partner Developer
  • Hero Member
  • *****
  • Posts: 1488
Re: Direct X Desktop Clock
« Reply #12 on: April 08, 2016, 07:02:30 AM »
I'm happy again now - my new clock's up and running  ;D

Some things are hard to do.  I'd like to emulate the Windows Bubbles screen saver - a great bit of programming - but how it's done I've no idea ..  ::)

Graham
Tomorrow may be too late ..

Offline Egil

  • Paid Subscriber
  • Hero Member
  • *****
  • Posts: 896
    • LA2PJ
Re: Direct X Desktop Clock
« Reply #13 on: April 08, 2016, 12:53:42 PM »
Nice clocks Graham!
If my memory serves me right, I have seen quite a few different clocks posted by you before.
The binary clock beeing the most "nerdy" one.   ;D


Support Amateur Radio  -  Have a ham  for dinner!

Offline LarryMc

  • Administrator
  • Hero Member
  • *****
  • Posts: 5929
  • 'All I like is finishing'
Re: Direct X Desktop Clock
« Reply #14 on: April 08, 2016, 02:06:20 PM »
Between CB and IWB some of the 2d/3d commands of the same name have completely different parameters.
A good example is CREATESCREEN.
And then there are a lot of CB commands that don't exist in IWB

Also, some of the warnings you pick up are due to moving from 1.x to 2.x and above of IWB

The bottom line is if you stay away from 2d/3d converting from CB to IWB isn't to hard.
There's even an old program around that will do a good portion of it for you.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Offline GWS

  • Partner Developer
  • Hero Member
  • *****
  • Posts: 1488
Re: Direct X Desktop Clock
« Reply #15 on: April 08, 2016, 04:31:29 PM »
"nerdy",.."Nerdy".. how dare you ?   ;D ;D ;D

Hi Egil, lovely to hear from you.  Hope you are feeling better.  The later years are hard to navigate.

To keep my mind positive, I've purchased an MFJ radio kit - I'm just assembling it - pics attached. It looked like fun to make a regenerative receiver again.  The kit is very good quality, so I hope it works ..  :)

You are right of course - I've played with a few 'clocks' over the years.

But then so has Larry M - even back in 2002 when he was an expert IBasic coder.  What fun these languages have given us ..  ;D

Hope you are well too Larry .

Best wishes, :)

Graham

Tomorrow may be too late ..

Offline LarryMc

  • Administrator
  • Hero Member
  • *****
  • Posts: 5929
  • 'All I like is finishing'
Re: Direct X Desktop Clock
« Reply #16 on: April 08, 2016, 10:28:51 PM »
Graham
Your "kit" reminds me of 40 years ago when HeathKit was going strong and the CB radio craze was at its peak here in the states.  I built HeathKits of O-Scope, Freq Meter, Signal Generator, SWR Meter, Power Supply, Transistor Testor and Tube Testor.  I made a pretty penny repairing 2-way radios and power amps on the side for quite a while until the craze died down and my regular job took up took much time.

I put all that equipment in a storage shed only to have a grand son get it to and trash all the equipment beyond repair.

And it's good to see you a little more active around here Graham.

It's hard to believe it has been14 years since I purchased IBasic Pro and started trying to learn the language.  And I knew NOTHING about the internal workings of windows ( some may say I still don't).  You and others nursed me along until I learned enough to be dangerous and I dare say we've had some fun along the way.

For you Graham, if you hadn't thrown so much good money after bad, and been as supportive as you have been we probably wouldn't have the toys to play with that we have today.  And for that I am grateful my old friend.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Offline Egil

  • Paid Subscriber
  • Hero Member
  • *****
  • Posts: 896
    • LA2PJ
Re: Direct X Desktop Clock
« Reply #17 on: April 09, 2016, 04:06:14 AM »
Looks like you are up for great fun, Graham!

Kit building is almost the only way we can get new members to our radio electronics "brotherhood" these days. Here in Norway it is now impossible to buy parts like transistors, resistors and capacitors, unless you buy them on tape rolls containing several thousands of each.
Therefore I have purchased most of the small parts for my building projects though the years from outlets in England and Germany.
I don't know much about the MFJ-kits, but seems like a nice project.

By the way, Aurel has mentioned a couple of times that he has been experimenting with regenerative receivers on the FM band.

Some years ago, on a trip to Portugal, we visited an observatory with several telescopes, both optical and radio telescopes. When they discovvered that we all were into radio elecronics, we were allowed to se the schematics for their new "pre-amp", they called it a "parametric amplifier". But when studying the schematic, I was very dissapointed, as it turned out to be nothing else than a superegenerative receiver.
Support Amateur Radio  -  Have a ham  for dinner!

Offline GWS

  • Partner Developer
  • Hero Member
  • *****
  • Posts: 1488
Re: Direct X Desktop Clock
« Reply #18 on: April 09, 2016, 12:10:26 PM »
Thanks for your kind comments guys.

It's lovely to see a flicker of interesting discussion on the site again - a bit like the old days. ;D 

That's a great story about the observatory Egil - a high tech Regen ..  :-[  fancy that ..

Best wishes, :)

Graham
Tomorrow may be too late ..

Offline Egil

  • Paid Subscriber
  • Hero Member
  • *****
  • Posts: 896
    • LA2PJ
Re: Direct X Desktop Clock
« Reply #19 on: April 09, 2016, 12:57:05 PM »
Quote
That's a great story about the observatory Egil - a high tech Regen ..  Embarrassed  fancy that ..

I really thought that kind oof devices used more advanced technologies.
The main difference between the parametric amplifier and the superregenerative receiver, was the quench frequency. The parametric amplifier was quenched by an outboard oscillator at a rate at least ten times the receivers operating frequency for low noise operation.

While, as you probably know, the superregenerative receiver is quenched at low frequencies. The detector most often also acts as the quench frequency oscillator. This makes the detector much more sensitive thqan an ordinary diode detector,  at the price of increased noise on audio frequencies.

But the two work pretty much in the same way.

And now I have strayed so far off topic that Larry soon come and slap my fingers.... sorry


73's

Egil


Support Amateur Radio  -  Have a ham  for dinner!

Offline LarryMc

  • Administrator
  • Hero Member
  • *****
  • Posts: 5929
  • 'All I like is finishing'
Re: Direct X Desktop Clock
« Reply #20 on: April 09, 2016, 01:04:33 PM »
And now I have strayed so far off topic that Larry soon come and slap my fingers.... sorry
I believe he's stepped out of the office right now... ;) ::) ;D
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library