Solved

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

Posted on 2006-06-29
7
436 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
Technology Partners: 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

Independent Software Vendors: 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!

Question has a verified solution.

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

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
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…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

733 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