Still on the Areo skin project I realized that the middle of the window should be opaque .... Here: http://www.masm32.com/board/index.php?action=dlattach;topic=18686.0;id=10651
basically I do not want the whole window transparent ...
I used CreateRectRgn and CombineRgn ..they work .... but the whole window becomes transparent why?
I commented out "INVOKE SetWindowRgn,hWnd,hr,1" other wise It cuts a hole but the purpose of that there was to test whether the regions are being created
"INVOKE SetWindowRgn,hWnd,hr0,1" reverses the region desired ....
I have used the handle of that region to invoke the transparent proc "invoke TranspWindow,hr0,TRANSPARENT_VALUE"
but still no go .....
why? ::)
Also I included 3 ways to do a transparent widow
that should be easy to fix
use a different color, like violet, for the pixels that you do want to be transparent
(or some other color that isn't used elsewhere in the image)
i think GdiTransparentBlt is the function to use :U
http://msdn.microsoft.com/en-us/library/dd373586%28v=vs.85%29.aspx
I tried that with a bunch of colors and that did not work for me ..... Do you mean I am going to that color on the window? cause I want to have that the same color
but why doesn't the reverse region work?
here is an example using TransparentBlt
use GdiTransparentBlt, instead
same function - but you do not have to include msimg32.inc and includelib msimg32.lib
http://www.masm32.com/board/index.php?topic=18800.msg159197#msg159197
As usual, you supplie N examples, thus people must guess which one shows the problem...
I am confused I just want to make one part of my window not transparent but I do not want it violet LOL ....
I prefer to get my way going some how with create region and subtract that form the main widow and only make that main widow transparent
if it's transparent, the violet won't show :bg
don't make me use the homer icon twice in one day - lol
maybe you want to create a mask and do it that way
the thread i posted also has an example for that
not sure if this is the code you are using, but is has the problem, that the coordinates a not proper maped to screen coordinates
invoke CreateRectRgn,40,60,170,155 ; <= client coord.
mov hr0,eax
invoke GetWindowRect,hWnd,addr rc
mov eax,rc.right
mov ecx,rc.bottom
sub eax,rc.left
sub ecx,rc.top
invoke CreateRectRgn,0,0,eax,ecx ; <== (0|0) = left top corner of the screen
mov hr,eax
invoke CombineRgn,hr,hr,hr0,RGN_XOR
Wops .... how do I fix that? the one is the smaller region with in the window
The magic functions are ClientToScreen() and ScreenToClient() :U
Quote from: qWord on May 13, 2012, 08:13:02 PM
The magic functions are ClientToScreen() and ScreenToClient() :U
I don't understand that.......
but good catch on the invoke GetWindowRect,hWnd,addr rc ...
that is why I am getting left top corner of the screen
Could I just use invoke GetClientRect,hWnd,addr rc
that should return the Client rect in my window ..right ?
Quote from: qWord on May 13, 2012, 08:13:02 PM
The magic functions are ClientToScreen() and ScreenToClient() :U
by the way I searched those words and came up with this http://www.masm32.com/board/index.php?topic=17383.0
Love your example there NICE! :U
I was looking for something like that way back
here's one i am working on...
BaldurIIMap.zip (http://dedndave.x10hosting.com/BaldurIIMap.zip)
when i started working on it, qWord's example you linked was one of the programs i looked at :P
That is from the multiwin example ( that format of win in win)
Back to your problem:
invoke GetWindowRect,hWnd,ADDR WndRect
mov hWndRgn,rv(CreateRectRgn,WndRect.left,WndRect.top,WndRect.right,WndRect.bottom)
; client -> screen
m2m WndRect.right,WndRect.left
m2m WndRect.bottom,WndRect.top
add WndRect.left,40
add WndRect.top,60
add WndRect.right,170
add WndRect.bottom,170
mov hHoleRgn,rv(CreateRectRgn,WndRect.left,WndRect.top,WndRect.right,WndRect.bottom)
invoke CombineRgn,hWndRgn,hWndRgn,hHoleRgn,RGN_XOR
invoke DeleteObject,hHoleRgn
invoke SetWindowRgn,hWnd,hWndRgn,1
Thank you I will give this a try tonight .....
Quote from: dedndave on May 13, 2012, 07:50:48 PM
that should be easy to fix
use a different color, like violet, for the pixels that you do want to be transparent
(or some other color that isn't used elsewhere in the image)
i think GdiTransparentBlt is the function to use :U
http://msdn.microsoft.com/en-us/library/dd373586%28v=vs.85%29.aspx
I wish that worked ...all it does is creates a glass hole any were that color is :(
Quote from: qWord on May 13, 2012, 08:54:40 PM
Back to your problem:
invoke GetWindowRect,hWnd,ADDR WndRect
mov hWndRgn,rv(CreateRectRgn,WndRect.left,WndRect.top,WndRect.right,WndRect.bottom)
; client -> screen
m2m WndRect.right,WndRect.left
m2m WndRect.bottom,WndRect.top
add WndRect.left,40
add WndRect.top,60
add WndRect.right,170
add WndRect.bottom,170
mov hHoleRgn,rv(CreateRectRgn,WndRect.left,WndRect.top,WndRect.right,WndRect.bottom)
invoke CombineRgn,hWndRgn,hWndRgn,hHoleRgn,RGN_XOR
invoke DeleteObject,hHoleRgn
invoke SetWindowRgn,hWnd,hWndRgn,1
That did not work for me the window did not show ... I even tried using a layered window ...
Also I think I am tackling this the whole wrong way ...... lets do a portion of the window transparent like a static ..... I have spent 2 days on this only this dozen of examples and nothing :(
I found this page http://www.wasm.ru/forum/viewtopic.php?pid=229896
no need to register to download attachments ...may be this will give me some ideas
Well I found the Culprit... WS_CHILD ...how can I create a static or window using create WindowEX with out having the child characteristics ????
I found this but I can not get it to work for just a simple static with out a child
http://www.masm32.com/board/index.php?PHPSESSID=46ef2b49016081a619356419651674f0&topic=17569.0
here is the Idea that I had .... I removed WS_EX_Layered in the create windowEX in the opaque.inc so you have to move the window around ....
why do I gain child propertied when I add ws_ex_transparent or WS_EX_Layered
move the window around to see what I mean
#include "\masm32\include\resource.h"
600 IMAGE DISCARDABLE "1.jpg"
601 IMAGE DISCARDABLE "2.jpg"
; Moveable WS_EX_TRANSPARENT-Static
.386
.model flat,stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc
include \masm32\include\gdi32.inc
include \masm32\include\ole32.inc
include \masm32\include\oleaut32.inc
include \masm32\include\Comctl32.inc
include \masm32\include\masm32.inc
include \masm32\include\debug.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\gdi32.lib
includelib \masm32\lib\ole32.lib
includelib \masm32\lib\oleaut32.lib
includelib \masm32\lib\Comctl32.lib
includelib \masm32\lib\masm32.lib
includelib \masm32\lib\debug.lib
include \masm32\macros\macros.asm
.data
_class db "just_parent_window",0
_static_text db " Moveable WS_EX_TRANSPARENT - Static",0
.data?
hInstance HINSTANCE ?
xhBitmap dd ?
hBitmap dd ?
hMain dd ?
.code
SetWinTransparence proc hWin:HWND,ValueTransparence:dword
invoke GetWindowLong,hWin,GWL_EXSTYLE
or eax, WS_EX_LAYERED or WS_EX_TRANSPARENT
invoke SetWindowLong,hWin,GWL_EXSTYLE,eax
invoke SetLayeredWindowAttributes,hWin,0,ValueTransparence,LWA_ALPHA or LMA_COLORKEY
ret
SetWinTransparence endp
ResumeWin proc hWin:HWND
invoke SetWindowLong,hWin,GWL_EXSTYLE,WS_EX_LEFT
invoke InvalidateRect,hWin,NULL,NULL
invoke UpdateWindow,hWin
ret
ResumeWin endp
StaticWndProc proc hWnd:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
Local ps:PAINTSTRUCT
Local hdc:HDC
Local mdc:HDC
Local xRc:RECT
.if uMsg==WM_CREATE
invoke GetWindowLong,hWnd,GWL_EXSTYLE
or eax,WS_EX_LAYERED ;or WS_EX_NOACTIVATE
invoke SetWindowLong,hWnd,GWL_EXSTYLE,eax
invoke SetLayeredWindowAttributes,hWnd,00FFFFFFh,120,LMA_ALPHA or LMA_COLORKEY
invoke InvalidateRect,hWnd,0,FALSE
invoke UpdateWindow,hWnd
;invoke SetWindowPos,hWnd,HWND_TOP,0,0,0,0,SWP_NOMOVE or SWP_NOSIZE
.elseif uMsg == WM_PAINT
invoke BeginPaint, hWnd,addr ps
mov hdc, eax
invoke CreateCompatibleDC, eax
mov mdc, eax
invoke SelectObject, mdc, xhBitmap
invoke GetClientRect,hWnd,addr xRc
invoke BitBlt,hdc,0,0,xRc.right,xRc.bottom,mdc,0,0,SRCCOPY
invoke DeleteDC, mdc
invoke EndPaint, hWnd, addr ps
.elseif uMsg == WM_DESTROY
invoke PostQuitMessage,NULL
.elseif uMsg== WM_NCHITTEST
invoke DefWindowProc,hWnd,uMsg,wParam,lParam
.if eax==HTCLIENT
mov eax,HTCAPTION
.endif
ret
.else
invoke DefWindowProc,hWnd,uMsg,wParam,lParam
ret
.endif
xor eax,eax
ret
StaticWndProc endp
StaticMain proc uses esi hInst:dword
LOCAL wc:WNDCLASSEX
LOCAL msg:MSG
LOCAL hwnd:HWND
mov wc.cbSize,sizeof WNDCLASSEX
mov wc.style,CS_NOCLOSE
mov wc.lpfnWndProc,offset StaticWndProc
mov wc.cbClsExtra,NULL
mov wc.cbWndExtra,NULL
m2m wc.hInstance,hInst
mov wc.hbrBackground,COLOR_WINDOW+1
mov wc.lpszMenuName,NULL
mov wc.lpszClassName,CTXT("GoogleEarth")
invoke LoadIcon,hInst,IDI_APPLICATION
mov wc.hIcon,eax
mov wc.hIconSm,eax
invoke LoadCursor,NULL,IDC_ARROW
mov wc.hCursor,eax
invoke RegisterClassEx,addr wc
invoke CreateWindowEx,NULL,CTXT("GoogleEarth"),CTXT("IMG_Control"),\
WS_POPUP or WS_POPUPWINDOW,90,50,100,75,NULL,NULL,hInst,NULL
mov hwnd,eax
invoke ShowWindow,hwnd,SW_SHOWNORMAL
invoke UpdateWindow,hwnd
.while TRUE
invoke GetMessage,addr msg,0,0,0
.break .if (!eax)
invoke TranslateMessage,addr msg
invoke DispatchMessage,addr msg
.endw
mov eax,msg.wParam
ret
StaticMain endp
WndProc proc hWnd:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
Local ps:PAINTSTRUCT
Local hdc:HDC
Local mdc:HDC
Local xRc:RECT
.if uMsg==WM_DESTROY
invoke PostQuitMessage,0
.elseif uMsg==WM_CREATE
invoke BitmapFromResource,hInstance,600
mov hBitmap,eax
invoke BitmapFromResource,hInstance,601
mov xhBitmap,eax
m2m hMain,hWnd
invoke CreateThread, 0, 0, offset StaticMain, hInstance, 1, 0
invoke CloseHandle,eax
.elseif uMsg == WM_PAINT
invoke BeginPaint, hWnd,addr ps
mov hdc, eax
invoke CreateCompatibleDC, eax
mov mdc, eax
invoke SelectObject, mdc, hBitmap
invoke GetClientRect,hWnd,addr xRc
invoke BitBlt,hdc,0,0,xRc.right,xRc.bottom,mdc,0,0,SRCCOPY
invoke DeleteDC, mdc
invoke EndPaint, hWnd, addr ps
.else
invoke DefWindowProc,hWnd,uMsg,wParam,lParam
ret
.endif
xor eax,eax
ret
WndProc endp
WinMain proc hInst:HINSTANCE,hPrevInst:HINSTANCE,CmdLine:LPSTR,CmdShow:DWORD
local wc:WNDCLASSEX
local msg:MSG
local hwnd:HWND
mov wc.cbSize,sizeof WNDCLASSEX
mov wc.style,CS_DBLCLKS
mov wc.lpfnWndProc,offset WndProc
mov wc.cbClsExtra,0
mov wc.cbWndExtra,0
m2m wc.hInstance,hInst
mov wc.hbrBackground,NULL;eax
mov wc.lpszMenuName,0
mov wc.lpszClassName,offset _class
mov wc.hIcon,0
mov wc.hIconSm,0
invoke LoadCursor,0,IDC_ARROW
mov wc.hCursor,eax
invoke RegisterClassEx,addr wc
invoke CreateWindowEx,NULL,\
offset _class,offset _static_text,WS_OVERLAPPEDWINDOW,\
100,100,300,225,0,0,hInst,0
mov hwnd,eax
invoke ShowWindow,hwnd,SW_SHOWNORMAL
invoke UpdateWindow,hwnd
.while TRUE
invoke GetMessage,addr msg,0,0,0
.break .if (!eax)
invoke TranslateMessage,addr msg
invoke DispatchMessage,addr msg
.endw
mov eax,msg.wParam
ret
WinMain endp
start:
invoke GetModuleHandle,0
mov hInstance,eax
invoke WinMain,eax,0,0,SW_SHOWDEFAULT
invoke ExitProcess,eax
end start
LOL.....
In the mean time I dug this example up ..... I will have have to view it carefully it looks complex .....
Please see the read me to see what each hot button does
USAGE
1) Dialog left double-click: trigger Dialog +/- Caption
2) Dialog right click: trigger Controls +/- Layered
3) Drag Dialog (press left mouse button}
4) Drag Control (press CTRL key + left mouse button)
This has been driving me crazy ...I know it is possible with MASM I have seen it ....
@six_L that was not what I was after ..... It is 2 windows ....Look at your tray bar you see 2 windows .... in order for this to to be a true movable staic it needs to be in the main window and stay there when you move the main window .....
I don't even want it movable .....
That why I disregarded this example when I first linked it 3 posts up .....
How would you make this not movable and as one unit???