Click here to Skip to main content
11,639,305 members (67,690 online)
Click here to Skip to main content

On Screen Displays, OSDs

, 23 Nov 2002 CPOL 164.3K 4.4K 88
Rate this:
Please Sign up or sign in to vote.
Discusses OSDs and shows you how to implement one under Win32

Sample Image - Forecast.jpg

Foreword

On Screen Displays, (A.K.A OSD) are some kind of cool features that I saw in Sony televisions many years ago for the first time. Today, I am going to show you how to implement an OSD as a standalone executable Win32 application, that reports live weather information according to an online resource.

What’s an OSD?

OSD is actually some kind of information given to the user when a certain event occurs. For example, when a user decides to manipulate the volume of her TV, a text appears at the bottom (or top) of the screen presenting the percentage of the voice’s power already settled on TV. It also displays the channel number already selected by the user at the top rid-side of the screen, usually in green color and for a period of two seconds. That’s what OSD is all about.

Considerations

To start developing a neat thing, please keep in mind that an OSD is not supposed to interfere with user’s actions in any kind of form. For example, what should happen when a text is presented on screen and user tries to open up her Windows Explorer?

Well, here are three things we have to keep in mind while developing an OSD:

  1. The window has to be always the top most window, or else, the text might be hidden at the back of a newly-opened window. This feature is given to our OSD window using the WS_EX_TOPMOST style.
  2. The visual transparency of the text that happens to be presented on screen is the second thing you’ve to consider when developing an OSD. This is given to our window using the WS_EX_TRANSPARENT style. This way, the user could see what is going on behind the text, too.
  3. The user should be able to select a window and/or icon behind the text, using her mouse or any kind of pointing devices she may have. This is supposed to be the most effective feature of an OSD which is given to our window using the WS_EX_LAYERED style (Thanks to Microsoft that ships this cool feature with its Win2K).

Give me a sample!

The sample I’m going to bring you here is supposed to show you the current temperature of a given zip code in the country, every x minutes. The information is obtained from a web service provided by Unisys Company. The idea is that the temperature will be settled on CRT for a given period of time. To catch this period from the user I considered the command line as a channel between the application and the end-user.

Here’s the syntax of the program:

Forecast.exe /u10 /d2 /z95123

Where /u represents the update interval (in minutes) between every show, /d represents the duration for which the text will be settled on screen (in seconds), and /z represents a zip code within US.

Therefore, the above-mentioned command line means that you want Forecast to show you the weather information of San Jose city of California which will be updated every 10 minutes and will be presented on screen for a period of 2 seconds. I also tried to represent an icon in the tray bar so that the user could easily manage how to exit the program.

The final word

The program is written straight forward so that you could easily follow the source code to understand what is going on. The example I brought you here (Forecast) might be useless since there is possibly no one who monitors the temperature of a given zip code, 24 hours a day, 7 days a week. And therefore, the information already revealed in this article was only supposed to show you how to develop an OSD under Win32 platform. You can manipulate the program to give you other information as you wish. Good luck!

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Mehdi Mousavi
Architect
United States United States
Mehdi Mousavi is a professional computer programmer. He has written many programs using C, C++, MFC, Win32, COM, DCOM, JavaScript, ASP, HTML, DHTML, SQL, C# and MC++.

You may also be interested in...

Comments and Discussions

 
GeneralMy vote of 1 Pin
_Nomad_12-Feb-10 14:14
member_Nomad_12-Feb-10 14:14 
QuestionThis Code for C# or delphi ? Pin
ikarus79-Dec-05 9:23
memberikarus79-Dec-05 9:23 
GeneralOSD in full screen games Pin
POD87@inbox.ru16-Sep-05 1:17
memberPOD87@inbox.ru16-Sep-05 1:17 
Generalhandsome Pin
HuangShansong28-Jun-05 23:09
memberHuangShansong28-Jun-05 23:09 
Generalhave a problem error on XP sp2 Pin
iuzadd13-Dec-04 20:54
memberiuzadd13-Dec-04 20:54 
QuestionHow to obtain the same result in a MFC project? Pin
Nico772-Oct-04 3:59
memberNico772-Oct-04 3:59 
Generalosd window will interfere DirectX window. Pin
lcp_true9-Oct-03 17:38
memberlcp_true9-Oct-03 17:38 
GeneralGot clean compile and link, but program won't run. Pin
WREY17-Sep-03 18:31
memberWREY17-Sep-03 18:31 
GeneralRe: Got clean compile and link, but program won't run. Pin
Mehdi Mousavi26-Sep-03 0:58
memberMehdi Mousavi26-Sep-03 0:58 
GeneralUsing Windows Xp Pro and SDK Platform, but... Pin
sdavis294-May-03 10:28
membersdavis294-May-03 10:28 
GeneralRe: Using Windows Xp Pro and SDK Platform, but... Pin
Yohi18-Oct-03 4:47
memberYohi18-Oct-03 4:47 
GeneralModify to display computername and username Pin
robmail24-Apr-03 11:11
memberrobmail24-Apr-03 11:11 
GeneralRe: Modify to display computername and username Pin
robmail26-Apr-03 14:44
memberrobmail26-Apr-03 14:44 
GeneralRe: Modify to display computername and username Pin
robmail26-Apr-03 15:07
memberrobmail26-Apr-03 15:07 
GeneralGenerating a bitmap with text. Pin
jjordan7-Apr-03 18:06
memberjjordan7-Apr-03 18:06 
GeneralLOWERMOST Vs. TOPMOST Pin
iluvclubs3-Feb-03 10:23
memberiluvclubs3-Feb-03 10:23 
General.NET Pin
William Bartholomew26-Nov-02 10:38
memberWilliam Bartholomew26-Nov-02 10:38 
GeneralScreensaver Issues Pin
Kevin Cotter26-Nov-02 4:04
memberKevin Cotter26-Nov-02 4:04 
GeneralRe: Screensaver Issues Pin
John Bates26-Nov-02 14:02
memberJohn Bates26-Nov-02 14:02 
GeneralNot erasing the background properly?! Pin
DWOO23-Nov-02 17:56
memberDWOO23-Nov-02 17:56 
GeneralRe: Not erasing the background properly?! Pin
Mehdi Mousavi24-Nov-02 15:08
memberMehdi Mousavi24-Nov-02 15:08 
GeneralRe: Not erasing the background properly?! Pin
DWOO25-Nov-02 3:08
memberDWOO25-Nov-02 3:08 
GeneralRe: Not erasing the background properly?! Pin
wheregone16-Mar-03 22:05
memberwheregone16-Mar-03 22:05 
GeneralRe: Not erasing the background properly?! Pin
thunderace6-Sep-03 7:56
memberthunderace6-Sep-03 7:56 
Questionhow about a NT version!! Pin
Agnihothra19-Nov-02 16:47
memberAgnihothra19-Nov-02 16:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150728.1 | Last Updated 24 Nov 2002
Article Copyright 2002 by Mehdi Mousavi
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid