Locked Workstation, Visual Basic & Logon

Hi Guys Have any of you done any work with running Navision through VB. If the workstation is unlocked I can Shell Navision, Run the Menu, & Logon and interact with Navisions windows and menus, via API Posting Messages to retreived the Window Handles. Problem If the workstation is locked the post message to the Logon window does not work although the handle is returned [V] Reason Navision class “C/Side Glued” is a painted lightweight control, so you cannot get a handle to the text boxes. I need Navision to run a function in the background on a locked workstation. I am 90% through this and stuck, any Ideas Dave

Why not NAS?

If you create an ActiveX application you can just fire events to Navision and you wont need (rather dangerous) WM messages to control Navision functions. It might also work when the workstation is locked but that you’l need to try yourself. I’m not sure if you are able to control the logon window cause i’m not really a C/AL expert but i’m an VB expert and know 2 things: - With VB you can fire (custom) events to navision using automation - You could use codeunit 1 to receive these automation events. I don’t know if code unit 1 runs before loging on because i haven’t done this yet.

Problem is that you may be able to fire events at Navision but you need to interact with the various results you may get back. If I open Navision with a user name and password and it fails I would be in a different screen, Error box or Main Menu I may have to look at what happens with the Navisions Message Queue and if I can interact with this the same as with Windows Post, Send Message functions to the queue. Anyone ?? Regards David

You may want to run a program like winwatch, which displays the windows caption, handle and class. You will see that Navision has a seperate class for every type of form, one for the standard forms, which can be identified by their captions, one for the error messages (always the same caption) and one for windows used for example by the import backup function. If you implement such window-watch-funtions into your VB-Program, it will be able to recognize if the actual window ist the one it is expecting or if it is a different one. You then have also the ability to set focus to the window you want to “type” to, because some applications often have unwanted popup windows, which would eat up your keypresses. I used this method for creating a macro-driven backup utility which worked quite fine. It sure is not the proper way to schedule Financials or Attain, but as far as I know it is the only one. Alex

That is fine Alex But the problem is the loggon Navision class “C/Side Glued” which you can send to when the workstation is unlocked by getting the handle to the control but you cannot get the handle to the text boxes as they are not classes in thier own right, I think they are painted controls. If the workstation is locked you can get the handle to the control but cannot post to the input boxes. Regards David

David You can use NAS to respond to event from outside and pass back messages. You just have to look how comerce server works to see an example. You can start a NAS session that interacts with an OCX so that when you pass it an XML message it responds with an XML message. The message could be anything from a status response to an order created on the system to all the customers with an overdue balance. For every message you OCX passes to Navision you get a response. No response then there is an error. Your best bet is to use MSMQ’s to pass the messages but you can pass them directly. The best part of NAS is that as it runs as a service it can be made to auto start if there is a problem or when the server starts up. It also logs messages in the event log although I normally add a navision log table as well. Paul Baxter