Run your application at startup

  • To run your application on startup you have to add the registry parameters LaunchXX and DependXX (XX is 00-99) under the key [HKLM\Init].


    LaunchXX defines the order that the module is started in. The value (string) specifies the name of the module to be started (e.g. "Launch80"="myprogram.exe")


    DependXX assigns a dependency that prevents the module from starting until another module is started. The value (hex) defines the hexadecimal number of the module that must be run before the defiened module is run.
    The entry for one module is two bytes long and you can specify more the one modules (e.g. "Depend80"=hex:14,00,1E,00 waits for modules defined in Launch20 and Launch30)


    The applications to wait for has to call SignalStarted().


    Please also refer MSDN online help "Configuring a Registry File to Run an Application at Startup".

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

  • I added my application SerialTest in the registry init. As I would like my application full screen I deleted the registry entries for the explorer.


    My registry key init looks as following:



    If I reboot the board the application starts, but then I get a popup with an exclamation mark saying: 51 was not found.


    Why is that?


    Thank you very much in advance.


    Georg

  • Quote from "schliz"

    If I reboot the board the application starts, but then I get a popup with an exclamation mark saying: 51 was not found.


    If the application really started (shows its screen), then most probably the message does come from within your application, not from the init-manager.


    Does your program work when called from the command line (and not from init)? Probably you are using a feature that the explorer provided, e.g. searching for a window that does not exist anymore without the explorer running.


    Regards,


    H. Keller

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

  • At first I tried to include the explorer again:


    Quote

    08 "Launch50"=string:explorer.exe \
    09 "Depend50"=hex:14,00,1e,00 \


    The explorer startet and in the backgroup my application appeared, and as well the popup showing the error message.



    Then I deleted the entries at the init key and tried to call my application out of the command line. It worked, and I did not get any popup.


    I have to mention, If I change the order for example 51 to 60 the popups says: 60 was not found.



    Thank you very much.


    Georg

  • It still does not work:


    I now launch my program as Launch101 depending on every other program:



    I still get a popup saying: 101 was not found.


    as well I tried:


    same result.


    I can see that explorer is started before and afterwards my program is started. Is it possible that explorer would need more time?


    What can I do?



    If I start my program out ouf of Run: - It works



    Thank you very much


    Georg

  • Hello,


    i dont think that the value for "DependXX" you set is the problem. Your first example must work! E.g. try "\windows\control.exe" for the value "LaunchXX". Does this work?


    What is about the command line in your application? The value "XX" is passed to the applications command line and should be used for call "SignalStarted()". Maybe your program use the "XX" value in a wrong way -> "XX was not found".

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

  • Is there any specific time to send SignalStarted()?


    I do it like this:


    Code
    1. BOOL CSerialTestApp::InitInstance()
    2. {
    3. DWORD x= _wtol(::GetCommandLine());
    4. SignalStarted(x);


    As parameter I get 101. And then I send it.


    I tried it later as well. What do I do wrong?


    I just found an example of Mike Hall he started SignalStarted() streight after WinMain(...)
    As I have an application using MFC I tried the above version.


    Thank you very much.


    Georg

  • Quote from "schliz"

    Is there any specific time to send SignalStarted()?


    By giving Depend-Entries, you can tell that one application is dependent on another application. For example if your program depends on a device driver, you have to give a depend entry so that your program waits for "device.exe".


    SignalStarted() is the signal, that allows all other programs depending on that progam, to start running. In the example above, the device.exe program will only call SignalStarted() *after* it has loaded all drivers. Calling this will trigger that the dependency of your program to device.exe is solved and your application can start now.


    If you don't provide any service that some *other* software may use, then you need not call SignalStarted() at all. Otherwise you have to decide when your service is up and running far enough so that all other programs can start using it. Then at this stage you can call SignalStarted().


    Regards,


    H. Keller

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

  • Hi,


    i got the same Problems. And i tried it with the dependency without any success. My solution was a small delay (1s) in the Application Sub Main(). Antoher solution ist to check is the API ready.


    This test should be done in the entry point of the application, before it begins to do any functionality. Again, it depends on the application. It could be enough with:

    while(!IsAPIReady(SH_SHELL))
    Sleep(500);


    best regards Benjamin

  • Thank you for the reply!


    I tried to call:


    while(!IsAPIReady(SH_SHELL))
    Sleep(500);



    at the entrypoint of the application.



    as I have got a WCE mfcApp (Wizzard) project I tried to call it at:
    CSerialTestApp::CSerialTestApp()
    : CWinApp()
    {
    ...
    }



    This should be the entry point isn't it?


    As well I created a completly new and empty WCE mfcApp using the
    Wizzard. I exchanged the .exe and rebooted the board and as well I get
    the same Messagebox.



    Then I created a WCE application ->A typical "Hello World" Application.
    I exchanged the .exe on the board again and started the board again.
    And now I don't get the message box.


    Thank you.


    Georg

  • Hallo,


    beim Starten über die Registry können Sie dem Programm keine Parameter mitgeben.


    1. Sie können eine *.LNK Datei erstellen und im Startup Ordner (\ffsdisk\StartUp) ablegen.
    Syntax:

    Code
    1. 17#\ffsdisk\test.exe


    Vor dem "#" steht die Anzahl der Zeichen für das Kommando. Hier können Sie auch beliebige Parameter anfügen.


    2. Sie könnten ein eigenes Programm erstellen und über die Registry starten. Via "CreateProcess" startet dieses Programm andere Programme Das kann sehr flexibel sein wenn Sie die Parameter für "CreateProcess" aus der Registry lesen. Siehe Anhang.

    Files

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

  • Quote from "all-finder"

    Wie kann man der Anwendung Parameter mitgeben?


    Ist es nicht sinnvoller, die Parameter selbst irgendwo in der Registry abzulegen und dann in der Anwendung dort nachzuschauen? Denn um Parameter in init zu ändern -- angenommen dies ginge überhaupt -- müsste man ja auch die Registry ändern.


    Mit freundlichen Grüßen,


    H. Keller

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

  • Hello everyone,


    I have different troubles related with this issue, could you give me any solution?


    First of all I must change the register using only the DCUTermi program because with the Registry Editor tool in Embedded Visual C++ 4.0 I cannot save the changes I made on it; any idea how to solve this?


    With the NDCUCFG utility I execute the following commands in order to run mi application on startup:


    reg open \init
    reg del value Launch50
    reg del value Depend50
    reg set value Launch200 string myapplication.exe
    reg set value Depend200 hex 14,00,1e,00
    reg save


    I have also located myapplication.exe on the \\FFDISK directory
    Then I reboot my NetDCU8 board and the result is the same as it has been stated in this post: the application runs but it appears a pop window with the text "200 was not found". I have also tried with the value 80 (instead of 200) and the result is similar ("80 was not found"), this popup is blocked and cannot be closed.
    As I have read in a previous message, I changed from mi application to "control.exe" (with the commands "reg set value Launch200 string control.exe" or "reg set value Launch80 string control.exe"), in this case it works fine and the control panel runs on startup.


    My application is a very simple VC++ program which only shows an image on screen, I am a little confused with the different messages I have found on this pots. Could you, please, explain me step by step the procedure to follow for running my application on startup?


    Thank you very much.
    HSF

  • Hello,


    i suggest this is the reason of your problem:

    Quote

    Zutter wrote;
    What is about the command line in your application? The value "XX" is passed to the applications command line and should be used for call "SignalStarted()". Maybe your program use the "XX" value in a wrong way -> "XX was not found".


    and this may be the solution:

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.