Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. how to run a method in biginning automaticaly

how to run a method in biginning automaticaly

Scheduled Pinned Locked Moved C#
tutorial
10 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    S K Y
    wrote on last edited by
    #1

    i got a method i need to run that method automatically when run my application without pressing any button or without any user interupt.

    A S E L A

    L 1 Reply Last reply
    0
    • S S K Y

      i got a method i need to run that method automatically when run my application without pressing any button or without any user interupt.

      A S E L A

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      umm ok so on your load event, throw a call to that method. If it is a console application, throw it in the main method...

      Check out the CodeProject forum Guidelines[^] The original soapbox 1.0 is back![^]

      S 1 Reply Last reply
      0
      • L Lost User

        umm ok so on your load event, throw a call to that method. If it is a console application, throw it in the main method...

        Check out the CodeProject forum Guidelines[^] The original soapbox 1.0 is back![^]

        S Offline
        S Offline
        S K Y
        wrote on last edited by
        #3

        when my application run allthe time i need to run this code.... pl help me to post some example codeing related to this... thankss..

        IntPtr hWnd = FindWindowEx(IntPtr.Zero, IntPtr.Zero, "Progman", null);
        ShowWindow(hWnd, 0);
        int intReturn = FindWindow("Shell_traywnd", "");
        SetWindowPos(intReturn, 0, 0, 0, 0, 0, SWP_HIDEWINDOW);

        A S E L A

        L D 0 3 Replies Last reply
        0
        • S S K Y

          when my application run allthe time i need to run this code.... pl help me to post some example codeing related to this... thankss..

          IntPtr hWnd = FindWindowEx(IntPtr.Zero, IntPtr.Zero, "Progman", null);
          ShowWindow(hWnd, 0);
          int intReturn = FindWindow("Shell_traywnd", "");
          SetWindowPos(intReturn, 0, 0, 0, 0, 0, SWP_HIDEWINDOW);

          A S E L A

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          I just puked a little bit.

          Check out the CodeProject forum Guidelines[^] The original soapbox 1.0 is back![^]

          D 1 Reply Last reply
          0
          • S S K Y

            when my application run allthe time i need to run this code.... pl help me to post some example codeing related to this... thankss..

            IntPtr hWnd = FindWindowEx(IntPtr.Zero, IntPtr.Zero, "Progman", null);
            ShowWindow(hWnd, 0);
            int intReturn = FindWindow("Shell_traywnd", "");
            SetWindowPos(intReturn, 0, 0, 0, 0, 0, SWP_HIDEWINDOW);

            A S E L A

            D Offline
            D Offline
            dan sh
            wrote on last edited by
            #5

            S K Y wrote:

            IntPtr hWnd = FindWindowEx(IntPtr.Zero, IntPtr.Zero, "Progman", null); ShowWindow(hWnd, 0); int intReturn = FindWindow("Shell_traywnd", ""); SetWindowPos(intReturn, 0, 0, 0, 0, 0, SWP_HIDEWINDOW);

            It is really surprising that you can understand this code and then ask such questions.

            C 1 Reply Last reply
            0
            • L Lost User

              I just puked a little bit.

              Check out the CodeProject forum Guidelines[^] The original soapbox 1.0 is back![^]

              D Offline
              D Offline
              dan sh
              wrote on last edited by
              #6

              This reminded me of this song: You don't know how sick you make me....[^]

              1 Reply Last reply
              0
              • D dan sh

                S K Y wrote:

                IntPtr hWnd = FindWindowEx(IntPtr.Zero, IntPtr.Zero, "Progman", null); ShowWindow(hWnd, 0); int intReturn = FindWindow("Shell_traywnd", ""); SetWindowPos(intReturn, 0, 0, 0, 0, 0, SWP_HIDEWINDOW);

                It is really surprising that you can understand this code and then ask such questions.

                C Offline
                C Offline
                Christian Graus
                wrote on last edited by
                #7

                He's obviously copying and pasting code from all over the web, and yet has no idea what he's doing. Remember the barcode login fiasco ?

                Christian Graus Driven to the arms of OSX by Vista. "! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums. I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp

                M 1 Reply Last reply
                0
                • C Christian Graus

                  He's obviously copying and pasting code from all over the web, and yet has no idea what he's doing. Remember the barcode login fiasco ?

                  Christian Graus Driven to the arms of OSX by Vista. "! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums. I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp

                  M Offline
                  M Offline
                  molesworth
                  wrote on last edited by
                  #8

                  Maybe it's some sort of experimental bot that's picking up code fragments from around the net, pasting them together, and then using keywords in them to post questions here... It's some sort of intellignece intelligence test :-D :doh:

                  There are three kinds of people in the world - those who can count and those who can't...

                  modified on Saturday, July 4, 2009 6:41 AM

                  C 1 Reply Last reply
                  0
                  • M molesworth

                    Maybe it's some sort of experimental bot that's picking up code fragments from around the net, pasting them together, and then using keywords in them to post questions here... It's some sort of intellignece intelligence test :-D :doh:

                    There are three kinds of people in the world - those who can count and those who can't...

                    modified on Saturday, July 4, 2009 6:41 AM

                    C Offline
                    C Offline
                    Christian Graus
                    wrote on last edited by
                    #9

                    No, it's outsourcing.

                    Christian Graus Driven to the arms of OSX by Vista. "! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums. I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp

                    1 Reply Last reply
                    0
                    • S S K Y

                      when my application run allthe time i need to run this code.... pl help me to post some example codeing related to this... thankss..

                      IntPtr hWnd = FindWindowEx(IntPtr.Zero, IntPtr.Zero, "Progman", null);
                      ShowWindow(hWnd, 0);
                      int intReturn = FindWindow("Shell_traywnd", "");
                      SetWindowPos(intReturn, 0, 0, 0, 0, 0, SWP_HIDEWINDOW);

                      A S E L A

                      0 Offline
                      0 Offline
                      0x3c0
                      wrote on last edited by
                      #10

                      That code snippet is horrible. You try to hide the ProgMan and Taskbar windows, mix up ints and IntPtrs, and use zero instead of a constant in the ShowWindow call. To answer your question, you put the startup code in the Main() method. But please, make that code cleaner. It burns my eyes By the way, this seems to be a little threatening to a user. You should try to find a way to do whatever you're doing without hiding the taskbar (and desktop IIRC), because whatever code you use to re-show them again won't be executed if your program's process is killed by Task Manager or some other unorthodox method

                      Between the idea And the reality Between the motion And the act Falls the Shadow

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups