News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Transpernet Region

Started by hfheatherfox07, May 13, 2012, 07:40:40 PM

Previous topic - Next topic

qWord

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
FPU in a trice: SmplMath
It's that simple!

hfheatherfox07

Thank you I will give this a try tonight .....

hfheatherfox07

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  :(

hfheatherfox07

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  :(

hfheatherfox07

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

hfheatherfox07

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

six_L

#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
regards

hfheatherfox07

#22
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)

hfheatherfox07

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???