首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

VB 删除一个信号,该如何解决

2012-02-29 
VB 删除一个信号如果某个信号存在就删除该信号怎么弄?VB codePrivate Declare Function WaitForSingleObje

VB 删除一个信号
如果某个信号存在就删除该信号怎么弄?

VB code
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As LongPrivate Declare Function CreateSemaphore Lib "kernel32" Alias "CreateSemaphoreA" (lpSemaphoreAttributes As SECURITY_ATTRIBUTES, ByVal lInitialCount As Long, ByVal lMaximumCount As Long, ByVal lpName As String) As LongPrivate Type SECURITY_ATTRIBUTES    nLength As Long    lpSecurityDescriptor As Long    bInheritHandle As LongEnd TypePublic Function RunOnSetup(ByVal ExeName As String) As Long    Dim MdiMenuHwnd As Long    Dim hMenu As Long    Dim Semaphore As String, Sema As Long, Security As SECURITY_ATTRIBUTES    Dim PrevSemaphore As Long, Turn As Long    Security.bInheritHandle = True    Security.lpSecurityDescriptor = 0    Security.nLength = Len(Security)    Semaphore = ExeName    Sema = CreateSemaphore(Security, 1, 1, Semaphore)    Turn = WaitForSingleObject(Sema, 0)    RunOnSetup = TurnEnd FunctionIf RunOnSetup("Update") <> 0 Then    '删除该信号End If


[解决办法]
这个不是那个啥么?好像书上有的,不过我记不得哪本书了。
[解决办法]
ReleaseSemaphore
[解决办法]
lpSemaphoreAttributes 可以直接传Byval 0,不需要Security.bInheritHandle = True

热点排行