473,383 Members | 1,795 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Registering for Policy Refresh Notification in c#

Hello,

I've a question about implementing a group policy notification in c#. I've
read the MSDN about this and they have a sample in C++.
http://msdn.microsoft.com/library/de...tification.asp
(Sorry for the wrap!)
I can create the events for the machine and user with the CreateEvent API
en register them with the RegisterGPNotification API. But when want to do
that in a thread created in c# and call there the WaitForSingleObject API
then i've got a problem that the thread won't stop without a call to
gpupdate. According to the MSDN doc is that correct:
<qoute>
If a thread makes an unmanaged call into the operating system that has
blocked the thread in unmanaged code, the runtime will not take control of
it for Thread.Interrupt or Thread.Abort. In the case of Thread.Abort, the
runtime marks the thread for Abort and takes control of it when it re-enters
managed code.
</qoute>
So my question is, is there a work around or a better solution for
implementing a Policy Refresh Notification?

TIA

Fred

Nov 16 '05 #1
1 2423
"Fred" <fred(geenspam)@testomgeving.com> wrote in message
news:Ou**************@TK2MSFTNGP12.phx.gbl...
Hello,

I've a question about implementing a group policy notification in c#. I've
read the MSDN about this and they have a sample in C++.
http://msdn.microsoft.com/library/de...tification.asp
(Sorry for the wrap!)
I can create the events for the machine and user with the CreateEvent API
en register them with the RegisterGPNotification API. But when want to do
that in a thread created in c# and call there the WaitForSingleObject API
then i've got a problem that the thread won't stop without a call to
gpupdate. According to the MSDN doc is that correct:
<qoute>
If a thread makes an unmanaged call into the operating system that has
blocked the thread in unmanaged code, the runtime will not take control of
it for Thread.Interrupt or Thread.Abort. In the case of Thread.Abort, the
runtime marks the thread for Abort and takes control of it when it
re-enters managed code.
</qoute>
So my question is, is there a work around or a better solution for
implementing a Policy Refresh Notification?


How about creating a second event and use WaitForMultipleObjects to make the
thread wait on either event being signalled? When you want to interrupt or
abort the thread just signal the second event. The thread will know which
event was signalled by the return value from WaitForMultipleObjects.

Chris Jobson
Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: support | last post by:
******************** e-mail Manager Notification ********************** As a security precaution this mail was blocked and discarded since it contains attachments with file extensions not allowed...
5
by: Steve | last post by:
Hi, I have a private website for 20 people that is similar to a web email client like hotmail. There are two frames, one on the left with links for "New", "History", "Todays" and a frame on the...
2
by: Oenone | last post by:
I've a little piece of code that I sometimes need to use that kills a running process when it stops responding. The process has a notification icon that it displays in the system-tray area of the...
3
by: David Cartwright | last post by:
Hi all, I'm having a weird time with a call to the Refresh() method of a DataGridView. I have a VB.NET 2005 Windows application with a main form and a "worker" thread. The main form delegates a...
3
by: Danny J. Lesandrini | last post by:
-- previously posted on newsgroup :: <microsoft.public.access-- Has anyone else noticed this behavior? Focus jumping from current cell to upper left in embedded datasheet. If not, would you be...
1
by: =?Utf-8?B?RW5naW5lZXJpaw==?= | last post by:
I have an application which uses a notification icon in the system tray. When the application is closed the notification icon remains in the system tray until I hover over it with the mouse. How...
6
by: Peter | last post by:
I have a APS.NET 3.5 webpage which calls a web service. What I need is to update this page automatically when a value changes in the webservice, does anyone have an example? Thank You ...
4
by: Peter | last post by:
ASP.NET 3.5 I have a web page and this web page has a DataList, when user hovers the mouse over a picture in the datalist a popup appers, this popup is a User Control and it has a cancel button....
1
by: LazarusHC | last post by:
I'm currently trying to learn perl as well as perl curses. I found this script, and I understand why it's supposed to work, but I don't understand why it doesn't. The idea is that pressing "enter"...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.