Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Floating (or windowless) images in application: sample

0 views
Skip to first unread message

Michel Gallant

unread,
Jan 17, 2002, 4:16:57 PM1/17/02
to
What is the simplest way to display an image without a window
container (like when ICQ starts, a floating animated flower image
is displayed for a few seconds). Are there code samples showing
this? A simple example would be:
Display a bitmap image somewhere on the screen for a fixed amount
of time

There seem to be a lot of references to "windowless" on Google searches,
but I want a very basic code sample (preferable with Win32 API in C, but
C++ is OK too).

Thanks,
- Mitch


Ron Natalie

unread,
Jan 17, 2002, 4:27:13 PM1/17/02
to

Michel Gallant wrote:
>
> What is the simplest way to display an image without a window
> container (like when ICQ starts, a floating animated flower image
> is displayed for a few seconds). Are there code samples showing
> this? A simple example would be:
> Display a bitmap image somewhere on the screen for a fixed amount
> of time

They have windows, they just don't have borders. The words you are
looking for is "Splash Screen". Override the normal window create
and don't set WS_BORDER.

Igor Tandetnik

unread,
Jan 17, 2002, 4:28:02 PM1/17/02
to
ICQ flower splash screen is a window. There is (practically) no way of
displaying anything on the screen without creating a window first. If
you wonder how come this image is not rectangular, see SetWindowRgn
--
With best wishes,
Igor Tandetnik

"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken

"Michel Gallant" <neu...@istar.ca> wrote in message
news:3C473F49...@istar.ca...

Michel Gallant

unread,
Jan 17, 2002, 4:55:07 PM1/17/02
to
Thanks for the "pointer"s. I just working my way through Petzold (5th Edn)
and was curious about this, but I can see the general idea now.
I had been looking at his "Scramble" example where no CreateWindow
was used, but a device context for the entire screen is used (and cut up).

- Mitch

Ron Natalie

unread,
Jan 17, 2002, 5:01:47 PM1/17/02
to

Michel Gallant wrote:
>
> Thanks for the "pointer"s. I just working my way through Petzold (5th Edn)
> and was curious about this, but I can see the general idea now.
> I had been looking at his "Scramble" example where no CreateWindow
> was used, but a device context for the entire screen is used (and cut up).
>

The entire desktop is just another window. He uses GetDesktopWindow to get
at it. However, this is not how people tend to do their splash screens.

Igor Tandetnik

unread,
Jan 17, 2002, 5:51:49 PM1/17/02
to
This way is asking for trouble. If any painting by any application goes
on in the place occupied by your splash (e.g. your splash happens to be
over an IE browser displaying an animated GIF) this painting will occur
over your splash, creating an unsightly mess. The OS clips painting that
happens in separate windows, but drawing directly on the screen bypasses
this mechanism.

--
With best wishes,
Igor Tandetnik

"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken

"Michel Gallant" <neu...@istar.ca> wrote in message

news:3C47483B...@istar.ca...

Quixote

unread,
Jan 17, 2002, 6:17:42 PM1/17/02
to

"Igor Tandetnik" <itand...@whenu.com> wrote in message
news:OmJ7Nm6nBHA.2536@tkmsftngp07...

> This way is asking for trouble. If any painting by any application goes
> on in the place occupied by your splash (e.g. your splash happens to be
> over an IE browser displaying an animated GIF) this painting will occur
> over your splash, creating an unsightly mess. The OS clips painting that
> happens in separate windows, but drawing directly on the screen bypasses
> this mechanism.
> --
> With best wishes,
> Igor Tandetnik

Agreed. My first attempt at a splash screen involved writing on the desktop
window, but it often didn't display correctly. I have since mended my ways.

--
Quixote
1. To reply to email address, remove donald
2. Don't reply to email address (post here instead)

Ron Natalie

unread,
Jan 17, 2002, 6:37:47 PM1/17/02
to

Igor Tandetnik wrote:
>
> This way is asking for trouble. If any painting by any application goes
> on in the place occupied by your splash (e.g. your splash happens to be
> over an IE browser displaying an animated GIF) this painting will occur
> over your splash, creating an unsightly mess. The OS clips painting that
> happens in separate windows, but drawing directly on the screen bypasses
> this mechanism.

Actually it's even worse than that. There's no way to "unpaint" the stuff
if he does it this way. With a window you just destroy the window and the
stuff underneath gets notified it needs to be repainted.

The Rack

unread,
Jan 17, 2002, 6:47:35 PM1/17/02
to
Igor Tandetnik wrote:

>ICQ flower splash screen is a window. There is (practically) no way of
>displaying anything on the screen without creating a window first.

Well, you could use DirectDraw... and blit directly to the
"DirectDrawSurface" area of the screen. You may want to look into
selective blitting and alpha blending.


Chad

Ron Natalie

unread,
Jan 17, 2002, 7:13:55 PM1/17/02
to

You could, but you don't really want to.
How are you going to erase it?

The Rack

unread,
Jan 17, 2002, 7:36:49 PM1/17/02
to
Ron Natalie wrote:

You can save the contents below the window to a DirectDrawSurface, and
replace them.. but, yes (I know) the contents may change. The easiest
way is your way.


Chad

Igor Tandetnik

unread,
Jan 18, 2002, 9:38:15 AM1/18/02
to
"Ron Natalie" <r...@sensor.com> wrote in message
news:3C47604B...@sensor.com...

Well, I could save the current image on the screen before painting my
splash, and then put the saved copy back on. Which again breaks nicely
if anything has changed in the underlying windows since the snapshot was
taken.

Michel Gallant

unread,
Jan 18, 2002, 10:28:43 AM1/18/02
to
Igor Tandetnik wrote:

I guess these comments explain why Petzold says " .. the SCRAMBLE program ...
is very rude and I probably shouldn't be showing it to you" ;-)

Thanks for all the interesting comments and perspectives.
- Mitch Gallant
http://home.istar.ca/~neutron/java.html


The Rack

unread,
Jan 18, 2002, 7:11:46 PM1/18/02
to
Igor Tandetnik wrote:

>Well, I could save the current image on the screen before painting my
>splash, and then put the saved copy back on. Which again breaks nicely
>if anything has changed in the underlying windows since the snapshot was
>taken.

Why not just take the snapshot, and use it as the background in your
frameless window? That makes it "look" like it's just a floating
image, but it's just a regular, rectangular window. When it's
destroyed, the desktop is repainted as per usual.

HTH


Chad

Igor Tandetnik

unread,
Jan 21, 2002, 10:20:23 AM1/21/02
to
"The Rack" <chadderackD...@earthlinkSONUTRITIOUS.net> wrote in
message news:3c48b958...@news.earthlink.net...

Please kindly read the whole thread before buttin in. That's pretty much
what everybody suggests, but the OP wonders whether it is possible to
paint splash screen direcly onto the desktop without creating a window
(see "windowless" in the subject?), and we are trying to convince
him/her that's a bad idea.

Michel Gallant

unread,
Jan 21, 2002, 10:29:45 AM1/21/02
to
As the OP, when I said "windowless", I really meant (with no surrounding window
visible). Sorry for the confusion. That is why I mentioned the ICQ initial startup
"splashscreen" image (a transparent animated flower, with transparent background,
and no *visible* window.
Being a fairly new C/C++ programmer (from Java) I could still use a nice simple
C (preferably) or C++ complete code snippet :-)

- Mitch

The Rack

unread,
Jan 22, 2002, 4:56:30 PM1/22/02
to
Igor Tandetnik wrote:

>> Why not just take the snapshot, and use it as the background in your
>> frameless window? That makes it "look" like it's just a floating
>> image, but it's just a regular, rectangular window. When it's
>> destroyed, the desktop is repainted as per usual.
>
>Please kindly read the whole thread before buttin in.

Sorry. Just trying to offer help. If I'm getting help, I should be
offering it too.


Chad

0 new messages