How to identify if the workstation is locked?
-
Project Objective: Immitate MSN Messenger when Workstation is locked it sets status to away Details: I made a code to identify if the workstation is locked. using this ---------------------------------------------------------------------------------- Private Declare Sub LockWorkStation Lib "User32.dll" () Private Declare Function SwitchDesktop Lib "User32.dll" _ (ByVal hDesktop As Long) As Long Private Declare Function OpenDesktop Lib "User32.dll" Alias "OpenDesktopA" _ (ByVal lpszDesktop As String, _ ByVal dwFlags As Long, _ ByVal fInherit As Boolean, _ ByVal dwDesiredAccess As Long) As Long ---------------------------------------------------------------------------------- it seems to work fine in VB6 but somehow doesnt work with VB.NET I always got a warning when i pass parameters to the functions ---------------------------------------------------------------------------------- PInvokeStackImbalance was detected Message: A call to PInvoke function 'CSC-RTMS!CSC_RTMS.frmClient::OpenDesktop' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature. ---------------------------------------------------------------------------------- anyone have a solution to my problem?
-
Project Objective: Immitate MSN Messenger when Workstation is locked it sets status to away Details: I made a code to identify if the workstation is locked. using this ---------------------------------------------------------------------------------- Private Declare Sub LockWorkStation Lib "User32.dll" () Private Declare Function SwitchDesktop Lib "User32.dll" _ (ByVal hDesktop As Long) As Long Private Declare Function OpenDesktop Lib "User32.dll" Alias "OpenDesktopA" _ (ByVal lpszDesktop As String, _ ByVal dwFlags As Long, _ ByVal fInherit As Boolean, _ ByVal dwDesiredAccess As Long) As Long ---------------------------------------------------------------------------------- it seems to work fine in VB6 but somehow doesnt work with VB.NET I always got a warning when i pass parameters to the functions ---------------------------------------------------------------------------------- PInvokeStackImbalance was detected Message: A call to PInvoke function 'CSC-RTMS!CSC_RTMS.frmClient::OpenDesktop' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature. ---------------------------------------------------------------------------------- anyone have a solution to my problem?
nevermind ignore this heheh i found the solution... long and integer.