The code can be applied to dialogs too. As you noticed, dialog procedures and toolbar hook procedures are very similar.
Function dialog_all_desktops:
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
str controls = "3"
str e3
if(!ShowDialog("dialog_all_desktops" &dialog_all_desktops &controls)) ret
;BEGIN DIALOG
;0 "" 0x10C80A44 0x100 0 0 223 135 "Form"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 Edit 0x54030080 0x200 6 8 96 14 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2010703 "*" ""
ret
;messages
WindowOnAllDesktops hDlg message wParam lParam ;;this is all you need to insert
sel message
,case WM_INITDIALOG DT_Init(hDlg lParam); ret 1
,case WM_DESTROY DT_DeleteData(hDlg)
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK DT_Ok hDlg
,case IDCANCEL DT_Cancel hDlg
ret 1
Function WindowOnAllDesktops:
;/
function hWnd message wParam lParam
;Makes a window (eg dialog or toolbar) visible on all virtual desktops.
;Call this function from a window procedure (eg dialog procedure or toolbar
;hook procedure), on every message.
;EXAMPLE
;WindowOnAllDesktops hDlg message wParam lParam
;sel message
,;;...
type WINDOWPOS hWnd hWndInsertAfter x y cx cy flags
dll user32 #IntersectRect RECT*lpDestRect RECT*lpSrc1Rect RECT*lpSrc2Rect
sel message
,case WM_WINDOWPOSCHANGING
,if(!GetProp(hWnd "closing"))
,,WINDOWPOS* wp=+lParam
,,if(wp.flags&SWP_HIDEWINDOW) wp.flags~SWP_HIDEWINDOW
,case WM_MOVE
,RECT rtb rsc r; int x y
,rsc.right=ScreenWidth; rsc.bottom=ScreenHeight
,GetWindowRect hWnd &rtb
,if(IntersectRect(&r &rsc &rtb)) SetProp hWnd "pos" (rtb.left&0xffff)|(rtb.top<<16)
,else
,,x=GetProp(hWnd "pos")
,,y=x>>16; x&0xffff
,,if(x&0x8000) x|0xffff0000
,,if(y&0x8000) y|0xffff0000
,,mov x y hWnd
,
,case WM_CLOSE
,;g1
,SetProp(hWnd "closing" 1)
,
,case WM_COMMAND sel(wParam) case [IDOK,IDCANCEL] goto g1
,