Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dialog thumbnail
#1
Hello!

Im tryin to modify your dialog from archive file (dlg_window_thumbnail)
I want to move the mouse from clicked point in thumbnail to that point in the real window.

Im not sure what im doing wrong but my code is not workin 100%.

Could u please clean it up? Thanks alot!



Function dlg_window_thumbnail
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

if(!ShowDialog("dlg_window_thumbnail" &dlg_window_thumbnail 0)) ret

;BEGIN DIALOG
;0 "" 0x90C80A48 0x100 0 0 186 138 "Dialog"
;END DIALOG
;DIALOG EDITOR: "" 0x2030009 "*" "" ""

ret
;messages
sel message
,case WM_INITDIALOG
,int-- w=win("Calc")
,int-- thumbnail; thumbnail=DwmShowThumbnail(hDlg w)

,case WM_SETCURSOR
,if lParam>>16=WM_LBUTTONUP and lParam&0xffff=HTCLIENT
,,POINT p; xm +&p
,,MapWindowPoints  w hDlg +&p 2; DpiScreenToClient(w +&p)
,,mou p.x p.y w 1

,case WM_DESTROY if(thumbnail) DwmUnregisterThumbnail thumbnail
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1

Function DwmShowThumbnail
Code:
Copy      Help
;/
function# hwnd hwnd2

;Shows thumbnail of hwnd2 in hwnd.
;Works on Vista/7+ only.


if(_winnt<6) ret

type DWM_THUMBNAIL_PROPERTIES dwFlags RECT'rcDestination RECT'rcSource !opacity fVisible fSourceClientAreaOnly
def DWM_TNP_RECTDESTINATION 0x00000001
def DWM_TNP_RECTSOURCE 0x00000002
def DWM_TNP_OPACITY 0x00000004
def DWM_TNP_VISIBLE 0x00000008
def DWM_TNP_SOURCECLIENTAREAONLY 0x00000010
dll- dwmapi
,#DwmRegisterThumbnail hwndDestination hwndSource *phThumbnailId
,#DwmUnregisterThumbnail hThumbnailId
,#DwmUpdateThumbnailProperties hThumbnailId DWM_THUMBNAIL_PROPERTIES*ptnProperties

int thumbnail
int hr = DwmRegisterThumbnail(hwnd hwnd2 &thumbnail)
if(hr) ret

RECT r; GetClientRect hwnd &r

DWM_THUMBNAIL_PROPERTIES tp
tp.dwFlags = DWM_TNP_RECTDESTINATION|DWM_TNP_VISIBLE|DWM_TNP_SOURCECLIENTAREAONLY ;;note: if DWM_TNP_SOURCECLIENTAREAONLY flag set, always gets only client regardless of fSourceClientAreaOnly.
tp.fSourceClientAreaOnly = 1
tp.fVisible = 1
tp.opacity = 255
tp.rcDestination = r

hr = DwmUpdateThumbnailProperties(thumbnail &tp)

ret thumbnail


Forum Jump:


Users browsing this thread: 1 Guest(s)