473,796 Members | 2,765 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 RegisterGPNotif ication API. But when want to do
that in a thread created in c# and call there the WaitForSingleOb ject 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.Interrup t 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 2440
"Fred" <fred(geenspam) @testomgeving.c om> wrote in message
news:Ou******** ******@TK2MSFTN GP12.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 RegisterGPNotif ication API. But when want to do
that in a thread created in c# and call there the WaitForSingleOb ject 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.Interrup t 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 WaitForMultiple Objects 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 WaitForMultiple Objects.

Chris Jobson
Nov 16 '05 #2

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

Similar topics

0
1166
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 by our email policy (.exe, .vbs etc ...) Source mailbox : <python-list@python.org> Destination mailbox : <james@alcatel.com.au> Message Subject :
5
4459
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 right with a table for viewing the contents of these messages. The left pane checks back with the server every few seconds to see if any new messages need to be processed and updates count accordingly.
2
2495
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 task bar. When its process is killed, however, the icon stays in the system tray. The only way to remove it is to move the mouse pointer over the top of it, at which point the icon vanishes. Is there any way (using the .NET framework or API...
3
7608
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 Sub to the worker so that the latter can refresh the DataGrid after updating the DataTable driving it. When I run the app under the debugger, everything's fine. But when I run it for real, it hangs, apparently in the Refresh() method of the...
3
2120
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 willing to test your environment and report back? I posted this question back in May because a client using our application reported it. We could only reproduce it on our network if we modified the configuration. Now, however, it's happening...
1
5640
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 can I refresh the system tray to remove the notify icon when the app closes?
6
4781
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 Peter
4
2809
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. After the user clicks on the cancel button I want the DataList to refresh its self. How can I do that - how can I tell the DataList or the parent web page to refresh it's self from the Popup / User Control?
1
1840
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" selects one of the menu entries, and if any other key is pressed, is prints "Character pressed is $c". The numbers work as expected, but if you press a letter, it acts like you've pressed enter. #!/usr/bin/perl # # Copyright (C) 2003 by...
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9535
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10021
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9061
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7558
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5453
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4127
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2931
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.