I am using a dialog box as main for my gui and I want it transparent so I can load an image and that image basically be the window.  Below is the basic dlg template I am using.
.386
.model flat, stdcall  ;32 bit memory model
option casemap :none  ;case sensitive

include hhhh.inc

.code

start:

invoke GetModuleHandle,NULL
mov hInstance,eax

    invoke InitCommonControls
invoke DialogBoxParam,hInstance,IDD_DIALOG1,NULL,addr DlgProc,NULL
invoke ExitProcess,0

;########################################################################

DlgProc proc hWin:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM

mov eax,uMsg
.if eax==WM_INITDIALOG

.elseif eax==WM_COMMAND
.if wParam==1001
invoke EndDialog,hWin,0
.endif
.elseif eax ==WM_KEYDOWN
.if wParam==VK_F6
invoke EndDialog,hWin,0
.endif
.elseif eax==WM_CLOSE
invoke EndDialog,hWin,0
.else
mov eax,FALSE
ret
.endif
mov eax,TRUE
ret

DlgProc endp

end start

Posted on 2009-03-28 22:24:10 by antihaxer
Look up "window skinning" - this can be done using 'window regions' - see CreateRectRgn and CombineRgn api.
Basically you write a function which rasterizes an input bmp into rectangular regions of visible pixels, combine those regions into one representing the whole app window, then have the winmain draw that region (PaintRgn).

Posted on 2009-03-29 04:37:19 by Homer
http://www.flipcode.com/archives/Win32_Window_Skinning.shtml
^_^ Thanks.
Posted on 2009-03-29 18:43:15 by antihaxer
happy to help :)

Theres another way to do this (using a 'manifest') for xp+ but you don't get as much control :)
Posted on 2009-03-29 23:56:47 by Homer
Hi antihaxer
If you are looking after window skinning, you will find a complete MASM/ObjAsm32 example in the OA32 package.
Look in the prokects directory for a folder called Skin.

Regards,

Biterider
Posted on 2009-03-30 00:43:42 by Biterider
I was confused a little bit about how in that tutorial that guy went about scanning the image for transparent pixels and then removing them from the Region.  What confused me was the whole converting to 24 bit.  Why can I not simply load any image and just scan it?
Posted on 2009-03-30 14:46:59 by antihaxer
You can - you just have to watch the pixel resolution of the input image (eg 24 bpp, 32bpp etc) and Stride of the input image (padding on the end of horizontal lines)
Posted on 2009-03-30 16:50:44 by Homer
Alright, that makes sense.  Is there any way to convert every image to a certain resolution or make sure I don't fuck up when scanning the pixels?  I guess I will just need to research how images work more.  http://www.wotsit.org/ ftw :-)
Posted on 2009-03-31 00:09:57 by antihaxer
Well mostly we're talking about Pixel Format - how many bits per pixel? You can get that from the BMP header, assuming its a BMP input image.
Posted on 2009-03-31 00:52:07 by Homer
That makes sense to me now.  For the highest resolution one pixel would be 8x8x8=24 bits right?  One for each r g b.  So if there was say 72 bits would the first seconds and third set of 24 bits be identical?
Posted on 2009-03-31 08:20:18 by antihaxer
Theres lots of different pixel formats, although I'm not aware of any 72 bit per pixel formats.

The most common are ARGB32 (4 channels, 8 bits per channel), RGB24 (3 channels, 8 bits per channel) and GREYSCALE (one channel, 8 bits). Less common are the 16 bit encodings such as '565'. There are others, how many you decide to support is up to you.
Most often, you'll be working with RGB and ARGB (or RGBA) formats, where you read 3 or 4 bytes per pixel (respectively).
For transparencies, you have two choices: either use a 'color key' (a special pixel color which you've reserved to mean 'transparent') or use a pixel format that has an ALPHA channel.
Unfortunately, not a lot of paint programs support this pixel format, which is sad.


Posted on 2009-04-01 00:54:14 by Homer
Alright, thanks.  I got photoshop. ^_^
Posted on 2009-04-01 02:59:27 by antihaxer