|
-
Aug 5th, 2002, 05:30 AM
#1
Thread Starter
Addicted Member
Windows Messages
Which Windows Message gets raised when you change the icon of an existing File Type?
Can you also tell me which Windows Message get raised when a file is deleted, renamed or moved?
Thanks in advance
-
Aug 5th, 2002, 10:02 AM
#2
Frenzied Member
Windows messages provide I/O and control over any window (control)
There are no messages for file deletion. In other words, the OS doesn't send a message, put it in the message queue for the file system that says ' delete file.dat'.
The same for changing an icon - other than WM_PAINT to refresh a window (if a user requests a repaint).
When an app makes a request of the kernel it does whatever (file delete, etc) without using messaging. It may cause subsequent messages to be sent, like WM_QUIT. You can see this when you have Windows Explorer open. Delete a file using another app, and the change WILL NOT show up in windows Explorer unless you go into VIEW>REFRESH.
The reason messages exist is because EVERYTHING on your screen is a window. The OS needs a reliable way to talk to each one as the user requests it.
-
Aug 5th, 2002, 10:09 AM
#3
Thread Starter
Addicted Member
If you have 2 instances of the Windows Explorer open, and you delete, move or rename a file the other instance updates. The 2 Windows Explorer instances must talk to each other for this to happen. Is there any way of detecting this?
-
Aug 5th, 2002, 10:20 AM
#4
Frenzied Member
Um.
They are actually the 'same' app. They are a single instance of a COM server, residing in the same place in memory, shred by two separate processes.
Okay. I think I get what you want - it isn't a message it's a series of api's, FindFirstChangeNotification and company. See if this doesn't do what you want:
Code:
Private Const FILE_NOTIFY_CHANGE_ATTRIBUTES = &H4
Private Const FILE_NOTIFY_CHANGE_DIR_NAME = &H2
Private Const FILE_NOTIFY_CHANGE_FILE_NAME = &H1
Private Const FILE_NOTIFY_CHANGE_SIZE = &H8
Private Const FILE_NOTIFY_CHANGE_LAST_WRITE = &H10
Private Const FILE_NOTIFY_CHANGE_SECURITY = &H100
Private Const FILE_NOTIFY_CHANGE_ALL = &H4 Or &H2 Or &H1 Or &H8 Or &H10 Or &H100
Private Declare Function FindFirstChangeNotification Lib "kernel32" Alias "FindFirstChangeNotificationA" (ByVal lpPathName As String, ByVal bWatchSubtree As Long, ByVal dwNotifyFilter As Long) As Long
Private Declare Function FindCloseChangeNotification Lib "kernel32" (ByVal hChangeHandle As Long) As Long
Private Declare Function FindNextChangeNotification Lib "kernel32" (ByVal hChangeHandle As Long) As Long
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
Private Declare Function ResetEvent Lib "kernel32" (ByVal hEvent As Long) As Long
Private Sub Form_Load()
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail: [email protected]
Dim Ret As Long
'Set the notification hook
Ret = FindFirstChangeNotification("C:\", &HFFFFFFFF, FILE_NOTIFY_CHANGE_ALL)
'Wait until the event is triggered
WaitForSingleObject Ret, &HFFFFFFFF
MsgBox "Event Triggered for the first time"
'Reactivate our hook
FindNextChangeNotification Ret
'Wait until the event is triggered
WaitForSingleObject Ret, &HFFFFFFFF
MsgBox "Event Triggered for the second time"
'Remove our hook
FindCloseChangeNotification Ret
End Sub
-
Aug 5th, 2002, 10:23 AM
#5
Thread Starter
Addicted Member
Cheers Jim
I'll have a play around with that.
-
Aug 5th, 2002, 03:13 PM
#6
Software Eng.
But keep in mind, there's not always a window message for everything (e.g. there's no message sent when a file is deleted, created etc.).
-
Aug 5th, 2002, 10:14 PM
#7
Frenzied Member
The problem with WaitForSingleObject is that it locks your thread. Your app won't respond to anything until kernel32 releases it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|