Exit Navision

winfriedwinfried Member Posts: 3
edited 2004-04-28 in Navision Financials
I'm looking for some piece of code to close Navision. Anyone here who can give me a hint?

Comments

  • GoMaDGoMaD Member Posts: 313
    If you mean: "How can I close a client from inside the C/AL?"

    The answer is: "You can't!"

    the EXIT command only means, exit the object or function you are in.
    Now, let's see what we can see.
    ...
    Everybody on-line.
    ...
    Looking good!
  • GoMaDGoMaD Member Posts: 313
    There is one possibility (when you are running NT, W2K, W2003 or XP) and that's killing the fin.exe process through a shell.

    But if you do this and you have two clients open, it will be pretty though to distinguish which one you want to kill.

    Greetings,
    Now, let's see what we can see.
    ...
    Everybody on-line.
    ...
    Looking good!
  • winfriedwinfried Member Posts: 3
    Thanks a lot for your very quick answer. Your first message tells me what I've expected. The second message could show the way ...
    I'll tell you more, if a find a solution!
    cu
  • aciaci Member Posts: 41
    You can use Auto Close Idle. It works with Navision Financials or Attain, Native DB or SQL option. See here for details:

    http://www.autocloseidle.com/

    Regards,

    Naji Shaman
  • jreynoldsjreynolds Member Posts: 175
    From within C/AL you can use the Windows Script Host Object Model to send keystrokes to your application (e.g. Alt-F,X).
  • janpieterjanpieter Member Posts: 298
    You can do such thing with automation.

    Steps to do so:
    1. Find the active window.
    2. Find the topmost parent window (GetParent API).
    3. Send WM_CLOSE command to the window found at 2. (I think it can be done with SendMessage.

    Ofcourse you have to find yourself a VB or VC programmer first...

    And.. this doesn't work in all situations, for example while there are still pending errors or messages that has to be clicked upon.

    The piece for finding navision windows i have for you in VB code:
    Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, _
                                                                              ByVal hWnd2 As Long, _
                                                                              ByVal lpsz1 As String, _
                                                                              ByVal lpsz2 As String) As Long
    
    Private Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long
    
    Private Declare Function GetForegroundWindow Lib "user32" () As Long
    
    Public Sub GetHwnd(byref hwndFINEXE as long, byref hwndObjectDesigner as long, byref hwndMDIclient as long)
        Dim tmphwnd As Long
        tmphwnd = GetForegroundWindow
        Do
            hwndFINEXE = tmphwnd
            tmphwnd = GetParent(tmphwnd)
        Loop Until tmphwnd = 0
        hwndMDIclient = FindWindowEx(hwndFINEXE, 0&, "MDICLIENT", vbNullString)
        hwndObjectDesigner = FindWindowEx(hwndMDIclient, 0&, vbNullString, "Object Designer")
    End Sub
    
    In a world without Borders or Fences, who needs Windows and Gates?
  • aciaci Member Posts: 41
    janpieter,

    You are right about the error messages do not allow Navision to be closed. Navision also doesn't close if there was any Print Preview, Customer/Vendor/Quote/Invoices Lookup Lists, etc. windows open. Try closing Navision while any of these windows open and you would see a popup window.

    ACI handles all these situations and more, plus you see all users. If there was a popup window present, ACI does nothing and allows you to use the Remote Control function to respond to the popup window and close Navision.

    Regards,

    Naji Shaman
  • janpieterjanpieter Member Posts: 298
    But can it be closed with C/AL coding with ACI?
    In a world without Borders or Fences, who needs Windows and Gates?
  • aciaci Member Posts: 41
    Currently ACI does not have that feature. It's possible to add it, but this is the first time anyone requested it. A quick DLL or OCX can be made to tell ACI to close Navision in this case...

    Regards,

    Naji Shaman
Sign In or Register to comment.