在MSDN的帮助中看到:
HANDLE CreateEvent(
LPSECURITY_ATTRIBUTES lpEventAttributes,
BOOL bManualReset,
BOOL bInitialState,
LPTSTR lpName);
我如下引入:
[ DllImport("kernel32") ]
public static extern IntPtr CreateEvent(ref SECURITY_ATTRIBUTES secatt,bool bManualReset,bool bInitialState,StringBuilder lpName);
[StructLayout(LayoutKind.Sequential) ]
public struct SECURITY_ATTRIBUTES
{
uint nLength;
IntPtr lpSecurityDescriptor;
bool bInheritHandle;
}
调用:
IntPtr hNotify=CreateEvent(null,false,true,new StringBuilder(""));
编译时说CreateEvent有无效参数,请大侠指教
HANDLE CreateEvent(
LPSECURITY_ATTRIBUTES lpEventAttributes,
BOOL bManualReset,
BOOL bInitialState,
LPTSTR lpName);
我如下引入:
[ DllImport("kernel32") ]
public static extern IntPtr CreateEvent(ref SECURITY_ATTRIBUTES secatt,bool bManualReset,bool bInitialState,StringBuilder lpName);
[StructLayout(LayoutKind.Sequential) ]
public struct SECURITY_ATTRIBUTES
{
uint nLength;
IntPtr lpSecurityDescriptor;
bool bInheritHandle;
}
调用:
IntPtr hNotify=CreateEvent(null,false,true,new StringBuilder(""));
编译时说CreateEvent有无效参数,请大侠指教
请来者领分,偶也可结贴,不过你得贴点好的代码噢
关于如何监视注册表,请大家到我的另一贴子http://community.csdn.net/Expert/topic/3864/3864295.xml?temp=.9699976
上看看,相信你看后也能写出注册表监视程序
static extern IntPtr CreateEvent(IntPtr lpEventAttributes, bool bManualReset, bool bInitialState, string lpName);再试试