Notify twice

Hi,
I use SHCNE_CREATE | SHCNE_MKDIR with a particular folder to be notify if a
file or a foler is created in it.

It works well for a new folder but for a new file, Explorer notifies me
twice.

For each notification
    LPARAM is SHCNE_CREATE.
    WPARAM is the pidl corresponding to the new file created.

To make it works well, I have to use a BOOL and check if I already treated
that notification!
Thanks!

--
Normand


0
NoEmail9920 (149)
7/10/2004 4:23:53 PM
vc.mfc 33608 articles. 0 followers. Follow

9 Replies
1027 Views

Similar Articles

[PageSpeed] 39

Hi Normand,

I have build a sample program and tested it on my side, is works as 
expected in my Windows 2000 system--notify once per new file:

if( (m_hNotify = SHChangeNotifyRegister( GetSafeHwnd(), 
	SHCNF_ACCEPT_INTERRUPTS | SHCNF_ACCEPT_NON_INTERRUPTS, 
	SHCNE_MKDIR | SHCNE_CREATE, //SHCNE_RENAMEFOLDER, 
	WM_SHELLNOTIFY, 
	1,
	&stPIDL)) == NULL) {
       AfxMessageBox("Change Register Failed");
}

Is there anything in my register code snippet different from yours?


Thanks!

Best regards,

Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------

0
v-garych (605)
7/13/2004 5:56:21 AM
Hi Gary,
Since I don't have access directly to SHChangeNotifyRegister and some
constants, see how I do it:
(The version of Shell32.dll is 6.0.2600.115)

typedef struct {
  LPITEMIDLIST  pidlPath;
  BOOL           bWatchSubtree;
} NOTIFYREGISTER;

LINK_INB_DIVERS HANDLE NotifierChangementAssociation2(HWND hWnd, UINT
iCommande, DWORD dwVersionWin, LPITEMIDLIST pidl)
{
 if(dwVersionWin != VER_PLATFORM_WIN32_NT)
  return NULL;
 HANDLE hSHChangeNotifyRegister = NULL;
 HMODULE hm = LoadLibrary("SHELL32.dll");
 if(hm)
 {
   SHCHANGENOTIFYREGISTER SHChangeNotifyRegister =
(SHCHANGENOTIFYREGISTER)GetProcAddress(hm, MAKEINTRESOURCE(2));
   if(SHChangeNotifyRegister)
   {
    NOTIFYREGISTER *lpItems = (NOTIFYREGISTER
*)malloc(sizeof(NOTIFYREGISTER));
    lpItems[0].pidlPath = pidl;
    lpItems[0].bWatchSubtree = FALSE;
    hSHChangeNotifyRegister = (HANDLE)SHChangeNotifyRegister(hWnd, 0x0003,
     SHCNE_CREATE | SHCNE_MKDIR, iCommande, 1, lpItems);
    free(lpItems);
   }
  FreeLibrary(hm);
}
 return hSHChangeNotifyRegister;
}

""Gary Chang"" <v-garych@online.microsoft.com> a �crit dans le message de
news: E3a5m4JaEHA.3208@cpmsftngxa06.phx.gbl...
> Hi Normand,
>
> I have build a sample program and tested it on my side, is works as
> expected in my Windows 2000 system--notify once per new file:
>
> if( (m_hNotify = SHChangeNotifyRegister( GetSafeHwnd(),
> SHCNF_ACCEPT_INTERRUPTS | SHCNF_ACCEPT_NON_INTERRUPTS,
> SHCNE_MKDIR | SHCNE_CREATE, //SHCNE_RENAMEFOLDER,
> WM_SHELLNOTIFY,
> 1,
> &stPIDL)) == NULL) {
>        AfxMessageBox("Change Register Failed");
> }
>
> Is there anything in my register code snippet different from yours?
>
>
> Thanks!
>
> Best regards,
>
> Gary Chang
> Microsoft Online Partner Support
>
> Get Secure! - www.microsoft.com/security
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> --------------------
>


0
NoEmail9920 (149)
7/13/2004 12:55:59 PM
Hi Normand,

Thanks for your quickly reply!
...
m_hShell32 = LoadLibrary("SHELL32.DLL");
pfSHChangeNotifyRegister SHChangeNotifyRegister;

SHChangeNotifyRegister = 
(pfSHChangeNotifyRegister)GetProcAddress((HINSTANCE)m_hShell32, 
MAKEINTRESOURCE(2));

LPPIDLSTRUCT stPIDL;
LPITEMIDLIST ppidl;

if(SHGetSpecialFolderLocation(GetSafeHwnd(),CSIDL_PERSONAL, &ppidl) != 
NOERROR) {
    AfxMessageBox("GetSpecialFolder problem");
}

stPIDL.pidlPath = ppidl;
stPIDL.bWatchSubtree = TRUE;

if( (m_hNotify = SHChangeNotifyRegister( GetSafeHwnd(), 
    SHCNF_ACCEPT_INTERRUPTS | SHCNF_ACCEPT_NON_INTERRUPTS, //0x0003
    SHCNE_MKDIR | SHCNE_CREATE, //SHCNE_RENAMEFOLDER, 
    WM_SHELLNOTIFY, 
    1,
    &stPIDL)) == NULL) 
{
     AfxMessageBox("Change Register Failed");
}
...

The above is my exactly test code, it appears just as the same as yours, 
maybe you can upload a small self-contained project(zipped) to us if 
possible, so that we can perform further research to find out where is the 
problem...


Thanks for your understanding!

Best regards,

Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------

0
v-garych (605)
7/14/2004 3:30:34 AM
Hi Gary,
Tell me where I can send the zip file.

> maybe you can upload a small self-contained project(zipped) to us if
> possible, so that we can perform further research to find out where is the
> problem...
>
>
> Thanks for your understanding!
>
> Best regards,
>
> Gary Chang
> Microsoft Online Partner Support
>
> Get Secure! - www.microsoft.com/security
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> --------------------
>


0
NoEmail9920 (149)
7/14/2004 4:50:48 AM
Hi Normand,

Just remove the "online." of my email address alias...


Thanks!

Best regards,

Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------

0
v-garych (605)
7/14/2004 8:34:20 AM
Hi Normand,

I have got your sample project and test it right now, it is fine. 
Since you have deregisterd the Shell Notification in the OnRefresh notify 
handler, the program will only notify you once per a file created(and it  
indeed does.)

So I  move these deregistering code to the OnOK handler function and test 
the program again, it works as the same as the previous(unmodified time). 
When I run it and click the New button on the dialog, select an Item in the 
coming popup NewMenu, then one line of the log info about the new file I 
just created will appear in the listbox. This behavior is as well and as 
expected.

So what's the behavior of the program on your side, insert twice with the 
modified code?
And what's your OS platform?


Thanks!

Best regards,

Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------

0
v-garych (605)
7/15/2004 8:15:57 AM
Hi Gary,
In my side, only one file is created when I choose a file from the popup
menu shown after pressing the New button (same thing for a new folder and
for a shortcut.)
But my function OnRefreshNotify is called twice and exactly the same is
given (I mean both PIDL's refer to the same file).  In my list box, the same
name is inserted twice.
If  I create a new folder, only one notification is sent to my application.
I see from Spy that I received 2 messages IDC_REFRESH for a file and only
one for a folder or a short cut.
This is what I get in the log (I create a text file and a folder without
leaving the application):
For a file:
<00820> 000E019C S ..WM_UNINITMENUPOPUP
<00821> 000E019C R ..WM_UNINITMENUPOPUP
<00822> 000E019C S ..WM_MENUSELECT uItem:0 fuFlags:FFFF (menu was closed)
hmenu:00000000
<00823> 000E019C R ..WM_MENUSELECT
<00824> 000E019C S ..WM_EXITMENULOOP fIsTrackPopupMenu:True
<00825> 000E019C R ..WM_EXITMENULOOP
<00826> 000E019C S ..message:0x03E9 [Unknown] wParam:0015A8C4
lParam:00000002
<00827> 000E019C S ....message:0x03E9 [Unknown] wParam:00160F4C
lParam:00000002
<00828> 000E019C R ....message:0x03E9 [Unknown] lResult:00000001
<00829> 000E019C R ..message:0x03E9 [Unknown] lResult:00000001
<00830> 000E019C R WM_COMMAND
For a folder:
<01336> 000E019C S ..WM_MENUSELECT uItem:0 fuFlags:FFFF (menu was closed)
hmenu:00000000
<01337> 000E019C R ..WM_MENUSELECT
<01338> 000E019C S ..WM_EXITMENULOOP fIsTrackPopupMenu:True
<01339> 000E019C R ..WM_EXITMENULOOP
<01340> 000E019C S .WM_NCHITTEST xPos:390 yPos:310
<01341> 000E019C R .WM_NCHITTEST nHittest:HTCLIENT
<01342> 000E019C S ..message:0x03E9 [Unknown] wParam:0015A8AC
lParam:00000008
<01343> 000E019C R ..message:0x03E9 [Unknown] lResult:00000001
<01344> 000E019C R WM_COMMAND

My OS is:
Windows XP
�dition familiale (Home edition)
Version 2002

Now I tried it on that OS and both files and folders give me 2
notifications(!):
Windows 98
2nd Edition
4.10.2222A

Finally someone else tried it and it works like you, only one notification
for any creation:
Windows Millenium Edition
4.90.3000

Sorry for that long repost.
Thanks!

""Gary Chang"" <v-garych@online.microsoft.com> a �crit dans le message de
news: 3nYo8PkaEHA.3208@cpmsftngxa06.phx.gbl...
> Hi Normand,
>
> I have got your sample project and test it right now, it is fine.
> Since you have deregisterd the Shell Notification in the OnRefresh notify
> handler, the program will only notify you once per a file created(and it
> indeed does.)
>
> So I  move these deregistering code to the OnOK handler function and test
> the program again, it works as the same as the previous(unmodified time).
> When I run it and click the New button on the dialog, select an Item in
the
> coming popup NewMenu, then one line of the log info about the new file I
> just created will appear in the listbox. This behavior is as well and as
> expected.
>
> So what's the behavior of the program on your side, insert twice with the
> modified code?
> And what's your OS platform?
>
>
> Thanks!
>
> Best regards,
>
> Gary Chang
> Microsoft Online Partner Support
>
> Get Secure! - www.microsoft.com/security
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> --------------------
>


0
NoEmail9920 (149)
7/15/2004 8:04:08 PM
Hi Normand,

I can repro this behavior on the platforms of Window 98, Windows XP Pro and 
Home, also it occur in Windows 2003 server...

Now I am consulting this issue with the product team members, and will 
reply when I get any results. 


Thanks for your understanding!

Best regards,

Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------

0
v-garych (605)
7/16/2004 7:35:40 AM
Hi Normand,

We have contacted our internal person on this inconsistent behavior. 
However, we didn't get any response so far. We will post here as soon as we 
get any update. We will notify you through email if you have registered a 
MSDN no spam email alias.

By the way, if you are still monitoring it, could you please drop a note to 
let us know it? Thanks very much.

Best regards,
Yanhong Huang
Microsoft Community Support

Get Secure! �C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
-http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.as
p&SD=msdn 

This posting is provided "AS IS" with no warranties, and confers no rights.

0
yhhuang (111)
7/20/2004 3:07:26 AM
Reply:

Similar Artilces:

Notify
Hi, my pc is running winxp & outlook 2003. Recently notify sound has no effect (no sound when mail received) even I enable this feature. Of course the speaker is on since other sound effect is alright. Furthermore the little notify envelope is only shown inside the hidden tool bar (at right bottom corner). So I do not know if I have new e-mail until open the inbox or expand the hidden tool bar. Thank you for assistance. Does the sound play from Control Panel-> Sounds and Audio Devices? For the envelope; set the Notification Area options to always show that icon. For more info...

plot lines "plot" twice upon clicking worksheet tab containing the XY chart
When I click the tab for the worksheet containing an already-created chart, the chart is blank; the XY series then plot, disappear, and then plot again. Can anyone tell me what settings should be changed so that the already-plotted series simply appear, and do not "re-plot" themselves? Thank you for any help. Larry Mehl ...

Notify me of replies
I've just discovered the "Notify me of replies" option in the upper right hand corner of the thread detail window, but I keep getting a "Notification failed. Please try later." message. Has anyone used this succesfully? -- Bud Cool, Accounting System Manager HDA, Inc. Hazelwood, MO GP 9.0, SP2 Hmm..despite getting the message, I received notification of a reply this morning - so I guess it works?! -- Bud Cool, Accounting System Manager HDA, Inc. Hazelwood, MO GP 9.0, SP2 "Bud" wrote: > I've just discovered the "Notify me of replies&q...

InitializeTransaction Hook Firing Twice
Hi, The InitializeTransaction Hook fires twice after a transaction is posted. Is this normal? Is there any transaction or session property I can check to see which of the two events I should react to? Is there any way of displaying the Customer Selection dialog from within a hook event? It's normal in that it happens every time, although I don't think it is an intended behavior. There are some other hooks that will fire more often that you would expect as well - RefreshDisplay seems almost random. You could use one of the custom variables on the session object to set a flag ...

Notify twice
Hi, I use SHCNE_CREATE | SHCNE_MKDIR with a particular folder to be notify if a file or a foler is created in it. It works well for a new folder but for a new file, Explorer notifies me twice. For each notification LPARAM is SHCNE_CREATE. WPARAM is the pidl corresponding to the new file created. To make it works well, I have to use a BOOL and check if I already treated that notification! Thanks! -- Normand Hi Normand, I have build a sample program and tested it on my side, is works as expected in my Windows 2000 system--notify once per new file: if( (m_hNotify = SHChangeNotif...

Excel Opens twice
Wondering if someone could help. We have a hyperlink to an Excel spreadsheet on one of our web pages. Basically when launched some data is copied to the clipboard for the launched sheet to use. Problem being is that excel opens twice - first time copying the data from the clipboard leaving it empty. It then fails to load as the second time as excel tries to copy again from the clipboard. Is there a way of trying to stop this opening twice? Tried excel /regserver avail. ...

Bill pay notify doesn't notify!
Using Money Express in Money 2003 to get reminders of bills upcoming. It worked well in 2002 version but not in 2003. I have it loaded in my active task tray but nothing pops up until I click on it. I want it to pop up when bills are due like it use to. I'm running XP-Pro with Money 2003. Hi Brad As a former Quicken user, I started using money 03 and found that Money Express is totally useless. It really does nothing, so I don't allow it to load. At least now I know it, at one time, did do something. Bob "Brad" <anonymous@discussions.microsoft.com> wrote in me...

winlogon notify
Hello, I want to remove dll which is loaded by winlogon.exe vai winlogon\notify key. I don't have any notify dlls registered on my system. look under this registry key and you can remove the registry entries corresponding to the notification dlls. HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Winlogon -- Vipin Aravind http://blogs.explorewindows.com "Dipali" <Dipali@discussions.microsoft.com> wrote in message news:86EC926D-B83B-41FE-ABB6-DDFC768707FF@microsoft.com... > Hello, > I want to remove dll which is loaded by winlogon.exe vai >...

Notify me of replies
Hi, I never get notified of replies to my postings, Why? I always check the box. Thanks, Phil Phil, Been broken for a while now... Try using a newsreader... Outlook Express, Windows Live Mail are the free ones. Then you can *watch* your message and see when you get a reply. -- Gina Whipp 2010 Microsoft MVP (Access) "I feel I have been denied critical, need to know, information!" - Tremors II http://www.regina-whipp.com/index_files/TipList.htm "Phillip" <Phillip@discussions.microsoft.com> wrote in message news:6E311B6A-EEB2-44CB-9BA2-E...

Email notifier
Does outlook have the ability to activate email notifier Kevin wrote: > Does outlook have the ability to activate email notifier Sure. Just minimize Outlook to a tray icon and leave it running. As to whether Outlook can be minimized to a tray icon depends on the version that you have but never mentioned. ...

OWA : users prompted to log on twice
(We only have 1 Exchange 2000 server.) After a server reboot, remote (OWA) users are now prompted to enter their credentials twice. We wonder what the fix might be. We suspect it has something to do with the IIS authentication settings. Under Default Site Properties|Directory Security|Anonymous Access and Authentication Control, in the Authentication Methods window, Basic Authentication (password is sent in clear text) is the only box checked off. Our domain is selected as the default domain. We're not sure if this is the correct configuration. Should this box be unchecked? Should...

file opened twice on network
Hello ive had a query from the accountant in my work, now he has opened an excel file which is saved on a network and has been working on it for a couple of hours, now hears the problem, his assistant has also had the file open and when the file is saved by either the accountant or assistant, it is being over written,and data is being lost, now i have told them to rename one of these files to assure all data is saved, but i would like to know how to create an alert if an individual trys to open a file which has already been opened on the network. :) Thank You -- stevenmorrison --------...

I receive the message twice
It started about 3 months ago: I am receiving every email from eBay and PayPal twice which is a lot of duplicates, because I am dealing frequently with eBay. Yesterday also all emails from my friend came twice (same date and time). It must be related to MS outlook, because the same messages come only once into Shawmail. Shaw is my provider. Any suggestions? Thank It is more likely to be related to your anti virus app, and its OL plug in "Jan Nademlejnsky" <jannade@shaw.ca> wrote in message news:uw5ErvwfHHA.4980@TK2MSFTNGP02.phx.gbl... > It started about 3 months a...

Notify me when RULE
A user pointed out to me that some of her rules do not work. More specifically she wants a message to pop up when she gets a message from a certain person, and her name is in the TO field. Sounds simple enough. And if the sender is in DomainA and so is the recipient all is well. However if its accross domains and DomainA guy sends a message to DomainB the rule don't work. Can someone confirm that for me. Is this by design, or do I need to get off my a_ _ and fix something. lol ...

Do you notify users about spam mail ?
I configured Symantec SMS 4.0 to quarantine messages that contains for example: "Apply this patch immediately !" Recipients of such message will receive a text instead saying "Symantec replace message body with text message..." A question: Would you rather *not* send any message to users at all to let them know they are being spammed ? Would you just block the whole thing and send message only to administrators to avoid bothering users, for example ? I'd block it entirely. It isn't spam - it's actually a virus.... Marlon Brown wrote: > I configured Syma...

Notify Exceptions
Is there a way I can set up Notify to not notify me for certain emails? Mainy I do not want to be notifiedif the emails are already handled by a rule. Turn off the default notification then add a catch-all rule (an incoming mail rule that has no criteria) at the bottom of your rules that notifies you of mail items. If the rest of your rules end in a "Stop processing further rules" action the last rule should only fire for mail items not caught by other rules "Dorian C. Chalom" <DChalom@Comcast.net> wrote in message news:#Uthp54DKHA.5068@TK2MSFTNGP03.phx.gbl...

opens twice
My outlook is scheduled to open when i logon, now for some strange reason it opens twice when i logon any suggestions? ...

Fancy Notifier
Hi. I tried Incredimail the other day and really liked the 3d effects etc- spiced up the daily in and out of emailing! However am loathe to give up outlook. Any addin or program to incorporate some 3d effects or something into outlook? Thx, Ajay Incredimail is a little different market, in my opinion. There was a product a couple of years ago called Incredimail for Office which was an Outlook plugin: http://www.softpedia.com/get/Internet/E-mail/Mail-Utilities/IncrediMail-for-Office.shtml "Ajay Malkani" <ajay@malkani.net> wrote in message news:eXxI9VqjGHA.836@TK2M...

Being notified of user attribute changes
Morning Guys n Gals, Is there anyway for me to be notified when any of the following has occurred for a specific user? -Membership in a AD security group changes for particular users -A group or user with specific permissions is added or removed from another account -The allowed / denied settings on for a particular user or group is changed. Nik "Nik" <nik> wrote in message news:%23YusqwNfKHA.2184@TK2MSFTNGP04.phx.gbl... > Morning Guys n Gals, > Is there anyway for me to be notified when any of the following has > occurred for a specific user? &...

Notify me of replies
I know when I initiate a question there is an option to notify me of replies. It would be helpful as I read other's questions that are relative or of interest to me to be able to opt to be notified when replies are sent to those questions too. Is this an option that I just haven't discovered? I am trying to monitor the daily but the above would help. "Notify me of replies" appears in the upper right corner of the web reader and is available for any post whether originated by you or someone else. Best regards, -- MG.- Mariano Gomez, MIS, MCP, PMP Maximum Global Business...

notifying delivery
I have a mailbox forwarded to another one. If somebody sends mail asking for delivery notification, Exchange Administrator sends two mails: 1. To original recipient 2. To the account where the original is forwarded Is possible to disable the delivery notification? The account (2) is accessed by Outlook 2000 configured with NO read confirmation. ...

Book2 on open; click on X's twice to close Excel 2007?
I had a very annoying quirk that suddenly appeared in my work copy of Excel 2007: whenever I opened Excel, I was presented with a blank workspace. I was accustomed to seeing Book1 and a blank spreadsheet. When I clicked on the New icon, I always started out with Book2! This was the first book I created, why should it be Book2? Also, everytime I tried to close my session of Excel, I would click on the upper right X and the file would close, but the application would not?! I had to click on the same X a second time to close out the whole application. In reading several posts in thi...

twice or three times the same mail
Hello ! I use Microsoft Outlook 2002 and I am satisfied with it. There is just one thing that bores me : when I receive the mails, I receive thel twice or three times from the same origin and with same date ... I have two different addresses but, except forgetting, I don't subscribe anything with two different addresses. What can be wrong ? PS I have antivirus and went to www.secuser many times without finding anything. Thanks (remove 200 to mail me) -- Ceci est une signature automatique de MesNews. Site : http://mesnews.no-ip.com ...

Notify Expiry of Contracts
Hi there, Could someone help me out in creating a Work Flow process where in I can set a automated email notification to a particular user(s) one month (A particular time limit) before the contract expires. I know it is possible to notify as of the date when the contract expires by creating a workflow rule on the Contract Object. Cheers RV Hi there, Sorry guys for posting this query...Pls ignore as i did find the solution. It can be done through Work Flow manager by creating a rule for Contract Object using the TIMER OPTION. Cheers RV >-----Original Message----- >Hi there...

Notify when Calendar is viewed.
I would like to be notified when my shared Calendar is viewed in Outlook 2003. Is this possible? No, its not possible. -- Diane Poremsky [MVP - Outlook] Outlook Tips: http://www.outlook-tips.net/ Outlook & Exchange Solutions Center: http://www.slipstick.com/ Outlook Tips by email: mailto:dailytips-subscribe-request@lists.outlooktips.net EMO - a weekly newsletter about Outlook and Exchange: mailto:EMO-NEWSLETTER-SUBSCRIBE-REQUEST@PEACH.EASE.LSOFT.COM Poll: What version of Outlook do you use? http://forums.slipstick.com/showthread.php?t=27072 "Dawn" <...