I tried it only locally, but documentation on sysinternals site say it can,
Usage: pskill [\\computer [-u username [-p password]]] <process Id or name>
-u Specifies optional user name for login to
remote computer.
-p Specifies optional password for user name. If you omit this
you will be prompted to enter a hidden password.
And I believe SysInternals since they have the best win tools I have seen and most of them are <100k, which means they doing it at the very low level... An they work exactlly as said...
I think the best way to friendly close navision is to create a activex DLL and code as following (visual basic 6 example):
Option Explicit
private Declare Function SendMessage Lib "user32" _
Alias "SendMessageA" (ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) As Long
Private Declare Function GetForegroundWindow Lib "user32" () As Long
Private Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long
private Const WM_CLOSE = &H10
Public sub CloseNavision()
SendMessage getNavHwnd, WM_CLOSE, 0, 0
End Function
Private Function GetNavHwnd() as long
Dim tmphwnd As Long
tmphwnd = GetForegroundWindow
Do
getNavHwnd = tmphwnd
tmphwnd = GetParent(tmphwnd)
Loop Until tmphwnd = 0
End Sub
Reference the DLL and call CloseNavision. It should work I think. Didn't test it but parts of the code i'm using in my code so i only brought a few modules together.
This won't work when you have any form open that has code that prevents that form from closing. In that way navision is prevented from closing. It won't work while messagboxes are still pending (neither will your timer trigger fire in that case).
Enjoy
In a world without Borders or Fences, who needs Windows and Gates?
One problem with using kill or pskill is if the user runs two clients on his desktop and one of them reaches the timeout limit. Then any of them can be closed down.
When the user is in the middle of work, suddenly the client closes down...
Further on, kill cannot be used in Terminal Server or Citrix.
But if it was possible to find out the client's process ID, then the correct client could be closed down. Waterproof solution.
Comments
why don´t you use the windows kill command:
For Example like this:
OnTimer()
SHELL(kill fin.exe);
Regards,
Ole
http://www.sysinternals.com/ntw2k/freeware/pskill.shtml
Navision code looks like: or
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
does pskill actually kill the client's session on the server?
(P.S. Thanks for link yesterday )
Regards,
Ole
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
It seems to work - at least no sessions appear to be "hanging" on our sql server 8)
Regards,
Ole
Reference the DLL and call CloseNavision. It should work I think. Didn't test it but parts of the code i'm using in my code so i only brought a few modules together.
This won't work when you have any form open that has code that prevents that form from closing. In that way navision is prevented from closing. It won't work while messagboxes are still pending (neither will your timer trigger fire in that case).
Enjoy
http://www.autocloseidle.com/
http://www.BiloBeauty.com
http://www.autismspeaks.org
was $200.00 just a month ago - talk about inflation
http://www.BiloBeauty.com
http://www.autismspeaks.org
(This is available on both server platforms in 4.0).
This posting is provided "AS IS" with no warranties, and confers no rights.
When the user is in the middle of work, suddenly the client closes down...
Further on, kill cannot be used in Terminal Server or Citrix.
But if it was possible to find out the client's process ID, then the correct client could be closed down. Waterproof solution.