Solved

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

Posted on 2006-06-29
7
401 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 39

Expert Comment

by:itsmeandnobodyelse
Comment Utility
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
Comment Utility
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
Comment Utility
>>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
Comment Utility
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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
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…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now