Author Topic: Load at windows start-up as hidden ....  (Read 4702 times)

dvbzavisnik

  • Guest
Load at windows start-up as hidden ....
« on: April 03, 2007, 01:00:16 pm »
Hi,
I using Altbinz and think that is the best Newzdownloader . Only thing that (I think) program need is option : Load at start-up , load at start up in tray , load in start up as hidden .
Option run in tray means that program automaticly starts when widows is loaded but program strats from tray and program is only visible in tray with  and further actions are same like in other programs when is in tray.
Option Load at start up as hidden means that programs starts like hidden.
I found solution how to made it , but I needsource code and other.... i can put that little tutorial here.

Those options would be very useful for me ...


Thanx !!!

Offline Rdl

  • Administrator
  • *****
  • Posts: 4073
Load at windows start-up as hidden ....
« Reply #1 on: April 03, 2007, 01:51:15 pm »
Load at startup is easily done via windows, no need for that. Start as minimized/in tray is planed. I don't know what you mean by hidden.

/Mozesh mi objasniti i na srpskom :)

Offline Rdl

  • Administrator
  • *****
  • Posts: 4073
Load at windows start-up as hidden ....
« Reply #2 on: April 03, 2007, 03:40:11 pm »
+ "-minimize" cmdline switch to start as minimized
+ "-tray" cmdline switch to start as minimized in tray

dvbzavisnik

  • Guest
Load at windows start-up as hidden ....
« Reply #3 on: April 04, 2007, 08:14:35 am »
Thanks for helping me.
This two cmdline commands dont worx for me.Program starts but in normal window in both case.Neither minimized or in tray.
This is little tutorial how to make that application starts as hidden (this is useful only for Programers and Program developers) :

Making a Startup Windows Form Invisible

To make the main form of a Windows application invisible when the application starts, you have to move the application's startup logic into a separate class. You cannot simply set its Visible property to false.

After you have separated the lifetime of the application from the lifetime of the form, you can make forms visible (and invisible), because the application will end when you "close" the class that was used for application startup.

    Note   Because a module is invisible when its code is running, the procedure that follows includes a step for adding a message box to the startup module simply to demonstrate that the application is running.

To set a form to be invisible at its inception

   1. Do one of the following:
         1. In Visual Basic, add a module to your Windows application by right-clicking the project and choosing Add Module.
         2. In C#, create a new class.
         3. In Visual C++, open Form1.cpp of your Windows application.
         
   2. Within the module or class, develop a Main subroutine that can act as the startup object for the project. For example, the following code shows how you might approach this.

      ' Visual Basic
      Sub Main()
         ' Instantiate a new instance of Form1.
         Dim f1 as New Form1()
         ' Display a messagebox. This shows the application is running,
         ' yet there is nothing shown to the user. This is the point at
         ' which you customize your form.
         System.Windows.Forms.MessageBox.Show( _
            "The application is running now, but no forms have been shown.")
         ' Customize the form.
         f1.Text = "Running Form"
         ' Show the instance of the form modally.
         f1.ShowDialog()
      End Sub

      // C#
      // All methods must be contained in a class.
      // This class is added to the namespace containing the Form1 class.
      class MainApplication
      {
         public static void Main()
         {
            // Instantiate a new instance of Form1.
            Form1 f1 = new Form1();
            // Display a messagebox. This shows the application
            // is running, yet there is nothing shown to the user.
            // This is the point at which you customize your form.
            System.Windows.Forms.MessageBox.Show("The application "
               + "is running now, but no forms have been shown.");
            // Customize the form.
            f1.Text = "Running Form";
            // Show the instance of the form modally.
            f1.ShowDialog();
         }
      }

      // C++
      void Main()
      {
         // Instantiate a new instance of Form1.
         Form1 * f1 = new Form1();
         // Display a messagebox. This shows the application
         // is running, yet there is nothing shown to the user.
         // This is the point at which you customize your form.
         System::Windows::Forms::MessageBox::Show(String::Concat
            (S"The application is running now, ",
             S"but no forms have been shown."));
         // Customize the form.
         f1->Text = "Running Form";
         // Show the instance of the form modally.
         f1->ShowDialog();
      }

          Note   The message box in the code above is specified with a fully qualified namespace because the created module, unlike a standard Windows Form, does not import any namespaces by default. For more information about importing namespaces, see References and the Imports Statement (Visual Basic), the using Directive (C#), or the using Directive (C++).

          Note   Application.Run() will start the message pump, which is vital to the behavior of certain applications and can affect form behavior during certain times in the application lifecycle, such as on shutdown. For more information, see Application.Run Method.

   3. Change the startup object for the project to be Sub Main instead of Form1. For C#, set the startup object to be ApplicationName,MainApplication (as per the naming of the class in the code above). For more information, see Choosing the Startup Form in Your Windows Application.

          Note   Skip this step for Windows applications in Managed Extensions for C++.

   4. Press F5 to run the project.

      When the application runs, the code within Main() executes first while the instance of Form1 lingers, hidden, until the code to show it is run. This allows you to do whatever you like within the instance of Form1 in the background without the user's knowledge.
 This is taken from www.codeproject.com , so thanx them .

And of course thanks to you !!

Offline Rdl

  • Administrator
  • *****
  • Posts: 4073
Load at windows start-up as hidden ....
« Reply #4 on: April 04, 2007, 10:22:37 am »
Those two switches are implemented yesterday, so you'll have to wait for next version. Again I missed the point about hidden applications. No need for source code.

dvbzavisnik

  • Guest
Load at windows start-up as hidden ....
« Reply #5 on: April 04, 2007, 11:25:26 am »
Maybe solution coud be that Altbinz become a compatibile with Shellexecute.exe.
This small utility you can download from _http://depositfiles.com/files/748567 and that can execute some .exe files as hidden.
Example with Winamp :
1. Put shelexecute.exe in winamp installation folder (c:\Program Files\Winamp\ for example)
2. Open Notepad and put this in (exactly like below including quote marks)
"c:\Program Files\Winamp\ShellExecute" /f:c:\Program Files\Winamp\winamp /r:hid

than save text as :  test.bat   in any folder you wish.

note: if winamp path is different then in example(c:\Program Files\Winamp\ ) you should to change it to your Winamp path !
3. run test.bat

Now you can see only playlist of winamp , but if you are previously swich off play list in winamp clicking on PL button in main window, next time when you run test.bat winamp will start as hidden.
If you put this string in registry start-up , any time when you start windows  winamp will start as hidden.

Problem is when I tried this with Altbinz (and some other applications), Altbinz strats like normal visible window.

Few ansvers in serbian for Rdl :
Ako postavim u start ap atbinb.exe -satart minimized on ga baca u taskbar a nikao  u tray.Poenta je da se nevidi u taskbaru nego samo u tray-u.Oni cmdline isto nerade kod mene - startuje normalan window ili minimizovan u taskbaru sto mi ne odgovara.Meni bi odgovaralo da startuje u treju... ako ti radis ovaj program onda pokusaj da odradis kao sto sam napisao gore u tutorijalu. Ako neko drugi radi na programu reci mu da pogleda prethodni post ili da proba da napravi program kompatibilan sa shellexecute.exe
Ovo da startuje kao hidden trebalo bi da bude opcija koja ce se checkirati i uncheckirati pa onda onaj kome treba (a takvih ima ....) samo checkira u opcijama i reshio je problem.
Regards !!