Pelles C forum

C language => Pocket PC and Smartphone questions => Topic started by: ml1969 on July 08, 2009, 07:11:43 pm

Title: How to show PNG Images with no window?????
Post by: ml1969 on July 08, 2009, 07:11:43 pm
Hello,

I have learnd alot... but there ist still a question / problem....

I want to show an image-file, perhaps a png file with transparency.

I am able to show a bitmapfile, which is include in a window
Code: [Select]
hbit = SHLoadDIBitmap(hStr);

HWND hWnd;


hWnd = CreateWindow(L"imgClass", L"Dialog",  WS_VISIBLE | SS_BITMAP,  0,  0,  50, 50,  NULL, NULL, hInstance, NULL);

HWND imgCtrl = CreateWindow( _T("STATIC"), NULL, SS_CENTERIMAGE | SS_BITMAP | WS_CHILD | WS_VISIBLE, 0, 0 , 50, 50, hWnd, NULL, NULL, NULL);

SendMessage(imgCtrl,STM_SETIMAGE, (WPARAM)IMAGE_BITMAP,(LPARAM)hbit);
.....

So is it possible to show a png-file on the screen with no window(form)? Cause the background of the window is grey and not transparent?

Michael

Title: Re: How to show PNG Images with no window?????
Post by: Stefan Pendl on July 08, 2009, 07:14:27 pm
JohnF has an example of using GDI+ to load and display images at his site.
Title: Re: How to show PNG Images with no window?????
Post by: ml1969 on July 08, 2009, 07:43:51 pm
Hello,

you mean that http://www.johnfindlay.plus.com/pellesc/GdiPlus/GdiPlus.html

Will this work on an PNA?  WinCe 4 ?

Ok I look there thanks
Title: Re: How to show PNG Images with no window?????
Post by: Romashka on July 10, 2009, 06:01:39 pm
Another possibility is to make a shaped window (if you don't need it to be semitransparent).
See the following URL for an algorithm for making a region from a bitmap:
http://www.vbaccelerator.com/codelib/winstyle/bmpwinsh.htm

You can also use layered windows but I am not sure if they are supported on WinCE (and they are not supported on Windows 9x/NT too).
Title: Re: How to show PNG Images with no window?????
Post by: Kaljj on September 21, 2009, 12:41:18 pm
Hello Michael,

I thing it not a great problem, if you only want to show the picture.
At first load the sample for a fullscreen from PelleC - homepage.
After then load the picture from the file with SHLoadImageFile
It's work with gif,jpg,png,ico and bmp
So you get a handle to a bitmap and show it with StretchBlt.

Kaljj

Title: Re: How to show PNG Images with no window?????
Post by: ml1969 on September 22, 2009, 05:55:20 am
Hello,


(I´m also from germany  :D )

The fullscreen-sample requires the aygshell, which is NOT represented on an PNA (wince 5)
This is a problem I meet sometimes, this makes some problems much difficult.


Michael
Title: Re: How to show PNG Images with no window?????
Post by: Kaljj on March 10, 2010, 08:08:15 pm
Hello Michael,

have you found a way to show the PNG.
i have read in the last time about the GAPI.
Look at the MSDN there show you a example to
write direct to the screen-memory

I hope i'm not to late  ;D

good luck
Kaljj