Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Howto "hook" a CabinetWClass (MyDoc)
#1
How can I "Hook" a cabinetWclas (windows explorer folder) with a thick red border around it?
What I want is, when the user check's a checkbox, the "MyDocuments" folder get's opened to the right of the dialogbox.
It also get's a thick red border around it rendered so that it gives the user a visual cue that certain actions will always be executed on the red-bordered folder. (In the dialog code I provided, the grey button executes code. That code should get the data from the "Hooked" folder which has the red border around it).

When the checkbox is checked:
- Check if the folder mydoc is opened and visible to the right of the dialogbox
- render thick red border around it
- If folder mydoc get's closed/minimized, immediatly reopen it (or reactivate it). And render thick red border around it
- If the button is clicked (the button with the label: "Get folder path and content") it will execute the commands attached to it on the folder
with red border around (The hooked folder, MyDocuments on the right of the dialogbox).
- If checkbox get's unchecked, then red border dissapears and the folder MyDocuments get's "released"



I have prepared an example template, the "HOOK" code get's initialized at the following block comment:
Code:
Copy      Help
;; ---------------------------------------------
;; *** CODE THAT HOOKS CabinetWClass: MyDoc" ***
;; ----------------------------------------------


Function hook_cabinet_example
Code:
Copy      Help
;Dialog_Editor

str controls = "1002"
str c1002Hoo

if(!ShowDialog("" &sub.DlgProc &controls)) ret

;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 263 114 "Hook cabinet example"
;1002 Button 0x54012003 0x0 79 31 108 9 "Hook CabinetWClass: MyDoc"
;1001 Static 0x54000000 0x0 83 6 98 18 "Check = Hook[]Uncheck = Unhook (release)"
;1003 Button 0x54032000 0x0 79 50 108 15 "Get folder path and content"
;1101 Static 0x54020000 0x4 112 4 48 13 "Page1"
;1201 Static 0x54020000 0x4 112 4 48 13 "Page2"
;1 Button 0x54030001 0x4 133 97 48 14 "OK"
;2 Button 0x54030000 0x4 188 97 48 14 "Cancel"
;4 Button 0x54032000 0x4 242 97 18 14 "?"
;5 Static 0x54000010 0x20004 1 89 800 1 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2040105 "*" "0" "" ""

#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,,DT_Page hDlg 0
,,EnableWindow id(1003 hDlg) 0


,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam

,
,case 1002 ;; CHECKBOX
,,int chk=but(1002 hDlg)
,,if(chk=0)
,,,EnableWindow id(1003 hDlg) 0
,,else
,,,EnableWindow id(1003 hDlg) 1
,,,
,,,;; -------------------------------------
,,,;; CODE THAT HOOKS CabinetWClass: MyDoc"
,,,;; -------------------------------------


,case 1003 ;; BUTTON    
,,;; Output path
,,GetFolderWindowPath _s
,,out "PATH:"
,,out _s
,,out "================"
,,
,,;; Output "CabinetWClass" items
,,ARRAY(str) a
,,out "ITEMS:"
,,if GetFolderWindowItems(a win("" "CabinetWClass") 0)
,,,out a
,
,
,case IDOK
,case IDCANCEL
ret 1
#2
Macro Macro2344
Code:
Copy      Help
int w=win("" "CabinetWClass")
RECT r; GetWindowRect w &r
__OnScreenRect osr.SetStyle(0xff)
osr.Show(1 r)
2
osr.Show(2)
#3
Thank you!


Forum Jump:


Users browsing this thread: 1 Guest(s)