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
Solved

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

Posted on 2006-06-29
7
431 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
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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

840 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