KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Alternative way of automatically starting your app on Windows Server 2008
PRODUCT: 4D Server | VERSION: 11.4 | PLATFORM: Win
Published On: May 14, 2009

Beginning with Windows Vista, you won't be able to interact with the desktop when running your application as a service. This is basically the same for any Windows release since Vista:

https://msdn.microsoft.com/en-us/library/bb203962(VS.85).aspx

As a workaround, you could simply launch 4D on the same machine and connect to the server as a client, then administer the database from there.

Another workaround may be to not launch it as a service at all, but to instead use the following approach:

  1. Setup a user to login automatically

  2. Use a batch file in combination with a 4DLink file to launch 4D and the appropriate database.

    The batch file may look like this:
    "C:\4D v11 SQL Release 4 Custom\4D Server\4D Server.exe" "C:\autostart.4Dlink"


    The autostart.4DLink file may look like this:
    <?xml version="1.0" encoding="UTF-8"?><database_shortcut structure_file="file:///D:/4D/myApp.4DC" data_file="file:///D:/4D/myApp.4DD"/>


  3. Optionally (for added security), you can also lock the workstation using the following command: "rundll32.exe user32.dll, LockWorkStation". This can be issued either through a batch file in the startup folder or in the registry.

    The batch file for this may look like this:
    rundll32.exe user32.dll, LockWorkStation

In this workaround, the database is not running as a service, but it is started automatically, and the screen is locked for added security.