Код (Text): ; 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 db "Static",0 _edit db "Edit",0 _button db "Button",0 _button_text db "Send text from Edit to Static !",0 _edit_text db "It's very easy to work with WS_EX_TRANSPARENT :-)",0 _static_text db " Moveable WS_EX_TRANSPARENT - Static",0 _about db "by kero <geocities.com/xmemor>, v.2006-09-19",0 .data? hInstance HINSTANCE ? hw_static HWND ? hw_edit HWND ? hbrush HBRUSH ? oldwndproc dd ? flag dd ? xhBitmap dd ? tValue SDWORD ? 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 NewWndProc proc hWnd:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM Local ps:PAINTSTRUCT Local hdc:HDC Local mdc:HDC Local xRc:RECT .if uMsg==WM_SETTEXT || uMsg==WM_GETICON invoke CallWindowProc,oldwndproc,hWnd,uMsg,wParam,lParam @@: invoke SetWindowPos,hWnd,0,0,0,0,0,SWP_NOMOVE OR SWP_NOSIZE OR SWP_NOSENDCHANGING OR SWP_FRAMECHANGED OR SWP_NOZORDER .elseif (uMsg==WM_MOVE && flag==0) || (uMsg==WM_WINDOWPOSCHANGING && flag!=0) jmp @b .elseif uMsg == WM_TIMER PrintDec tValue sub tValue,2 .if tValue <= 0 invoke ResumeWin,hWnd mov tValue,255 .else invoke SetWinTransparence,hWnd,tValue .endif .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_LBUTTONDBLCLK xor flag,1 invoke KillTimer, hWnd, 505 .elseif uMsg==WM_LBUTTONDOWN mov tValue,255 invoke SetTimer, hWnd, 505, 100, 0 invoke SetWindowPos,hWnd,0,0,0,0,0,SWP_NOMOVE OR SWP_NOSIZE OR SWP_NOSENDCHANGING OR SWP_FRAMECHANGED OR SWP_NOZORDER invoke DefWindowProc,hWnd,WM_NCLBUTTONDOWN,HTCAPTION,lParam .else invoke CallWindowProc,oldwndproc,hWnd,uMsg,wParam,lParam ret .endif xor eax,eax ret NewWndProc endp WndProc proc hWnd:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM local buf[MAX_PATH+1]:BYTE .if uMsg==WM_DESTROY invoke DeleteObject,hbrush invoke PostQuitMessage,0 .elseif uMsg==WM_CREATE m2m hMain,hWnd invoke CreateWindowEx,NULL,offset _static,\ NULL,WS_CHILD or WS_VISIBLE or \ WS_CLIPSIBLINGS or WS_BORDER or SS_NOTIFY,\ 90,50,100,75,hWnd,2000,hInstance,0 mov hw_static,eax invoke SetWindowLong,hw_static,GWL_WNDPROC,addr NewWndProc mov oldwndproc,eax invoke BitmapFromResource,hInstance,601 mov xhBitmap,eax .elseif uMsg==WM_LBUTTONDOWN invoke DefWindowProc,hWnd,WM_NCLBUTTONDOWN,HTCAPTION,lParam .elseif uMsg==WM_ACTIVATE invoke SetWindowPos,hw_static,HWND_TOP,0,0,0,0,\ SWP_NOMOVE OR SWP_NOSIZE OR SWP_NOSENDCHANGING OR SWP_FRAMECHANGED .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 local hBitmap:HBITMAP 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 invoke BitmapFromResource,hInstance,600 mov hBitmap,eax invoke CreatePatternBrush,eax mov hbrush,eax mov wc.hbrBackground,eax invoke DeleteObject,hBitmap mov wc.lpszMenuName,0 mov wc.lpszClassName,offset _class ; invoke LoadIcon,0,IDI_APPLICATION mov wc.hIcon,0 mov wc.hIconSm,0 invoke LoadCursor,0,IDC_ARROW mov wc.hCursor,eax invoke RegisterClassEx,addr wc invoke CreateWindowEx,WS_EX_TOPMOST or WS_EX_TOOLWINDOW,\ offset _class,offset _static_text,WS_OVERLAPPEDWINDOW or WS_CLIPCHILDREN,\ 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 Код (Text): #include "\masm32\include\resource.h" 600 IMAGE DISCARDABLE "1.jpg" 601 IMAGE DISCARDABLE "7.jpg" hello, all why hasn't the Static been changed into TRANSPARENT style? or how can i achieve the result which the filial window is transparenting from the paternal window? the attachment is exe
dcskm4200 1) ?? This isn't kero's code. kero's code is in attachment. 2) My code is about WS_EX_TRANSPARENT, but in your code i see also WS_EX_LAYERED+SetLayeredWindowAttributes. BTW, the window with WS_EX_LAYERED+WS_EX_TRANSPARENT is absolutely hole for mouse, so - can't be "moveable" 3) Because Static is system's predefined control (= child), read MSDN about layered windows (must be top-level). But! - 4) You can find experimental "partly workable" layered controls here: http://www.wasm.ru/forum/viewtopic.php?id=21495.