Solved

How to output a string of characters on top of the wallpaper

Posted on 2006-06-29
7
444 Views
Last Modified: 2013-12-03
I'm using a VC++ 6 application that can display bitmap files as wallpapers. Now I want to output a string of letters on top of that bitmap, i.e., different strings for different bitmaps. Please any expert can give any suggestion?
Btw that string can be assigned different fonts and/or color and must have a transparrent background as not to affect the bitmap itself.
0
Comment
Question by:Volga
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 2

Expert Comment

by:seet82
ID: 17015315
when u say wallpaper, you are refering to the application wallpaper right?

one way to do it is using GDI calls to draw the string after you have drawn the bitmap

i'm currently posting outside and has no access to my MSDN and can't post examples...if u wish, i could do that when i reach hom
0
 
LVL 22

Expert Comment

by:mahesh1402
ID: 17015968
Following article with src will help you :

'Rendering text on top of a bitmap'
http://www.codeproject.com/gdi/BitmapTest.asp

-MAHESH
0
 
LVL 11

Expert Comment

by:Jase-Coder
ID: 17016050
you can get a handle to the desktop window using GetWindowDC() and then you can call TextOut()


HDC dc = GetWindowDC(GetDesktopWindow());

TextOut(hdc, 0, 0, "Jason", 6);

BUT..... this text will dispear when the desktopwindow repaints itself so you need to know when the desktop will repaint itself andthen recall the above code.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 39

Expert Comment

by:itsmeandnobodyelse
ID: 17016458
You could add bitmap button to your main form, make it as big as the form and assign the wallpaper as bitmap. The button needs to be first in tab order. Any other control can be made transparent by property thus appearing properly above the wallpaper.

If you need jpeg or png you might turn the *button* to an owner-draw button Then you need to supply a callback function DrawItem which does all drawing itself. You could move all code that paints the wallpaper now to the DrawItem function. Moreover, the function is suitable to do any additional drawing, e. g. drawing coloured text to anywhere using the current device context (GDI).

Regards, Alex

0
 

Author Comment

by:Volga
ID: 17018760
Thanx for al your help. However I still could not make it to work. Now let's forget about wallpapers for now and get back to a simple question:
How do I output a line of text on any deskop?
I have a hard time writing some routine, so a real example will be very helpful.
0
 
LVL 22

Accepted Solution

by:
mahesh1402 earned 100 total points
ID: 17019261
>>How do I output a line of text on any deskop?

You can do one of 2 things:

1. Get the DC of the desktop. You can then draw on that.
CClientDC dcDesktop(CWnd::GetDesktopWindow());
dcDesktop.TextOut(...);

OR

2. Get the DC of the display device.
CDC dc;
dc.CreateDC("DISPLAY", NULL, NULL, NULL);
dcDesktop.TextOut(...);
dc.DeleteDC();

-MAHESH
0
 

Author Comment

by:Volga
ID: 17022320
Thanx again for the advice from the experts. All are good suggestions but Mahesh gave me a code that really worked in my application.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question