Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
File Change Triggers...
#9
A complex question which is probably to time consuming to implement, but here goes...
It's a sort of follow up question from topic: https://www.quickmacros.com/forum/showth...p?tid=6501

QUESTION:
Is it possible to track the file changes in relation to a QM control?
In other words, I have shdocvw control which points to a folder, I want to track the changes the shdocvw control makes.
(Not in relation to the folder the shdocvw points, but the changes the shdocvw control makes when running)

I have used the trigger $f 0x449 "C:\" from the above mentioned topic and tracked the changes to the folder:

C:\Users\r0n\AppData\Local\Microsoft\Windows\AppCache
C:\Users\r0n\AppData\LocalLow\Microsoft\CryptnetUrlCache\MetaData
C:\Users\r0n\AppData\LocalLow\Microsoft\CryptnetUrlCache\Content
C:\Users\r0n\AppData\Local\Microsoft\Internet Explorer
C:\Users\r0n\AppData\Local\Microsoft\Windows\INetCache\IE

I was hoping the above example in this thread could be applied (constrained) to an control (shdocvw):

Function dlg_shell_notifications_shdoc
Code:
Copy      Help
#compile "__CFileChangeMonitor"
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog" "4"
;10 ActiveX 0x54030000 0x0 5 20 150 104 "SHDocVw.WebBrowser"
;END DIALOG
;DIALOG EDITOR: "" 0x2040A00 "*" "" "" ""

str controls = "10"
str ax10SHD
ax10SHD="$personal$"
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,CFileChangeMonitor- t_fcm ;;declare one thread variable for each folder you will monitor
,if(!t_fcm.Register(hDlg "$personal$")) ;;monitor My Documents folder
,,mes "failed to set file change notifications" "" "!"
,
,case WM_DESTROY
,t_fcm.Unregister
,case WM_COMMAND goto messages2
,
,case WM_USER+145
,;wParam is SHNOTIFYSTRUCT containing pidl of the file or folder (depending on event). If renamed, also contains the new pidl.
,;lParam probably is wEventId of SHChangeNotify (documented in MSDN library)
,SHNOTIFYSTRUCT& n=+wParam
,str s1 s2
,if(n.dwItem1) PidlToStr +n.dwItem1 &s1
,if(n.dwItem2) PidlToStr +n.dwItem2 &s2
,out "0x%08X %s %s" lParam s1 s2
,
,;notes:
,;SHChangeNotifyRegister documentation says that sometimes multiple messages are combined into 1.
,;Also, sometimes more than 1 notification may be sent for the same event.
,;Sometimes notifications may be not sent. Eg if an app forgets to call SHChangeNotify after it makes a change, and OS does not call it too. Especially in older OS.
,;I don't know, are dwItem1 and dwItem2 always pidls. Maybe sometimes they can be paths or friendly names, like when calling SHChangeNotify with SHCNF_PATH etc.
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1

Again if to complex/time consuming, I understand.
I can always continue to use the alternative cleanup solution from the original topic.

(The reason for this method is to be "100%" sure I am cleaning up traces of changes the control makes.)


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)