Unattended application...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Eric Robert

    #1

    Unattended application...

    Hi,



    I think I've tried everything I can without success. I want to bundle an
    application that can run unattended or not. That's means it can behave like
    a normal window application or a command line one i.e. with a standard
    input, output and error.



    If I make a console application, I can't seem to be able to get rid of the
    console window by any means. Anyway, it would probably popup in "window
    mode" since it has to execute a bit before being hidden and that would be
    kind of ugly.



    If I make a window application, I don't have standard streams. I've been
    trying to find the process that started me to see if I could use its
    standard streams. I don't know if it's even possible!



    If it is, can someone show me some pointers? If not, any alternative besides
    having two executable?




    Thanks!




    Eric Robert


  • AlexS

    #2
    Re: Unattended application...

    You can rid of console using SetParent (Win32 api) with HWND_MESSAGE
    parameter.
    Check both in Platform SDK.

    Tested and works
    HTH
    Alex

    "Eric Robert" <synapzzz@spam. hotmail.com> wrote in message
    news:%23lY1eGOp DHA.2820@TK2MSF TNGP10.phx.gbl. ..[color=blue]
    > Hi,
    >
    >
    >
    > I think I've tried everything I can without success. I want to bundle an
    > application that can run unattended or not. That's means it can behave[/color]
    like[color=blue]
    > a normal window application or a command line one i.e. with a standard
    > input, output and error.
    >
    >
    >
    > If I make a console application, I can't seem to be able to get rid of the
    > console window by any means. Anyway, it would probably popup in "window
    > mode" since it has to execute a bit before being hidden and that would be
    > kind of ugly.
    >
    >
    >
    > If I make a window application, I don't have standard streams. I've been
    > trying to find the process that started me to see if I could use its
    > standard streams. I don't know if it's even possible!
    >
    >
    >
    > If it is, can someone show me some pointers? If not, any alternative[/color]
    besides[color=blue]
    > having two executable?
    >
    >
    >
    >
    > Thanks!
    >
    >
    >
    >
    > Eric Robert
    >
    >[/color]


    Comment

    • Eric Robert

      #3
      Re: Unattended application...

      Sorry but this is not what I want. The console window isn't my child window.
      It "could" be my parent (if only I could find how to know that...). But your
      suggestion is to hide the child window. This makes no sense...

      "AlexS" wrote:[color=blue]
      > You can rid of console using SetParent (Win32 api) with HWND_MESSAGE
      > parameter.
      > Check both in Platform SDK.
      >
      > Tested and works
      > HTH
      > Alex
      >
      > "Eric Robert" wrote:[color=green]
      > > Hi,
      > >
      > >
      > >
      > > I think I've tried everything I can without success. I want to bundle an
      > > application that can run unattended or not. That's means it can behave[/color]
      > like[color=green]
      > > a normal window application or a command line one i.e. with a standard
      > > input, output and error.
      > >
      > >
      > >
      > > If I make a console application, I can't seem to be able to get rid of[/color][/color]
      the[color=blue][color=green]
      > > console window by any means. Anyway, it would probably popup in "window
      > > mode" since it has to execute a bit before being hidden and that would[/color][/color]
      be[color=blue][color=green]
      > > kind of ugly.
      > >
      > >
      > >
      > > If I make a window application, I don't have standard streams. I've been
      > > trying to find the process that started me to see if I could use its
      > > standard streams. I don't know if it's even possible!
      > >
      > >
      > >
      > > If it is, can someone show me some pointers? If not, any alternative[/color]
      > besides[color=green]
      > > having two executable?
      > >
      > >
      > >
      > >
      > > Thanks!
      > >
      > >
      > >
      > >
      > > Eric Robert
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • Eric Robert

        #4
        Re: Unattended application...

        Just to clarify things. If you create a C# window application and change it
        to console after (via the property menu), you have 2 windows poping up - one
        is the console and the other is the form. If I put a button and break in it,
        I see only one thread. If I look at both windows, the form isn't responding
        (that's fine) and the other behave normaly. So, they must be in separate
        process... right? I don't see how it could be otherwise.

        So, it can't be my parent window. It is my "parent" process's window. And it
        is those streams that I'm after!

        Eric Robert
        [color=blue]
        > Sorry but this is not what I want. The console window isn't my child[/color]
        window.[color=blue]
        > It "could" be my parent (if only I could find how to know that...). But[/color]
        your[color=blue]
        > suggestion is to hide the child window. This makes no sense...
        >
        > "AlexS" wrote:[color=green]
        > > You can rid of console using SetParent (Win32 api) with HWND_MESSAGE
        > > parameter.
        > > Check both in Platform SDK.
        > >
        > > Tested and works
        > > HTH
        > > Alex
        > >
        > > "Eric Robert" wrote:[color=darkred]
        > > > Hi,
        > > >
        > > >
        > > >
        > > > I think I've tried everything I can without success. I want to bundle[/color][/color][/color]
        an[color=blue][color=green][color=darkred]
        > > > application that can run unattended or not. That's means it can behave[/color]
        > > like[color=darkred]
        > > > a normal window application or a command line one i.e. with a standard
        > > > input, output and error.
        > > >
        > > >
        > > >
        > > > If I make a console application, I can't seem to be able to get rid of[/color][/color]
        > the[color=green][color=darkred]
        > > > console window by any means. Anyway, it would probably popup in[/color][/color][/color]
        "window[color=blue][color=green][color=darkred]
        > > > mode" since it has to execute a bit before being hidden and that would[/color][/color]
        > be[color=green][color=darkred]
        > > > kind of ugly.
        > > >
        > > >
        > > >
        > > > If I make a window application, I don't have standard streams. I've[/color][/color][/color]
        been[color=blue][color=green][color=darkred]
        > > > trying to find the process that started me to see if I could use its
        > > > standard streams. I don't know if it's even possible!
        > > >
        > > >
        > > >
        > > > If it is, can someone show me some pointers? If not, any alternative[/color]
        > > besides[color=darkred]
        > > > having two executable?
        > > >
        > > >
        > > >
        > > >
        > > > Thanks!
        > > >
        > > >
        > > >
        > > >
        > > > Eric Robert
        > > >
        > > >[/color]
        > >
        > >[/color]
        >
        >[/color]


        Comment

        • AlexS

          #5
          Re: Unattended application...

          Eric,

          just try the suggestion. To understand what's going on and who's whose child
          you might need to read Platform SDK docs on consoles. It's very different
          type of beast than standard forms. Console class in .Net exposes some of
          properties of this beast, but not all of them. That's why to do this trick
          you have to use SetParent. You can forget about child windows...

          I suggested this because it works for me - I can hide/show console at will,
          control its size and location, colors etc. and make it my child window

          HTH
          Alex
          "Eric Robert" <synapzzz@spam. hotmail.com> wrote in message
          news:exVq6EPpDH A.3504@TK2MSFTN GP11.phx.gbl...[color=blue]
          > Just to clarify things. If you create a C# window application and change[/color]
          it[color=blue]
          > to console after (via the property menu), you have 2 windows poping up -[/color]
          one[color=blue]
          > is the console and the other is the form. If I put a button and break in[/color]
          it,[color=blue]
          > I see only one thread. If I look at both windows, the form isn't[/color]
          responding[color=blue]
          > (that's fine) and the other behave normaly. So, they must be in separate
          > process... right? I don't see how it could be otherwise.
          >
          > So, it can't be my parent window. It is my "parent" process's window. And[/color]
          it[color=blue]
          > is those streams that I'm after!
          >
          > Eric Robert
          >[color=green]
          > > Sorry but this is not what I want. The console window isn't my child[/color]
          > window.[color=green]
          > > It "could" be my parent (if only I could find how to know that...). But[/color]
          > your[color=green]
          > > suggestion is to hide the child window. This makes no sense...
          > >
          > > "AlexS" wrote:[color=darkred]
          > > > You can rid of console using SetParent (Win32 api) with HWND_MESSAGE
          > > > parameter.
          > > > Check both in Platform SDK.
          > > >
          > > > Tested and works
          > > > HTH
          > > > Alex
          > > >
          > > > "Eric Robert" wrote:
          > > > > Hi,
          > > > >
          > > > >
          > > > >
          > > > > I think I've tried everything I can without success. I want to[/color][/color][/color]
          bundle[color=blue]
          > an[color=green][color=darkred]
          > > > > application that can run unattended or not. That's means it can[/color][/color][/color]
          behave[color=blue][color=green][color=darkred]
          > > > like
          > > > > a normal window application or a command line one i.e. with a[/color][/color][/color]
          standard[color=blue][color=green][color=darkred]
          > > > > input, output and error.
          > > > >
          > > > >
          > > > >
          > > > > If I make a console application, I can't seem to be able to get rid[/color][/color][/color]
          of[color=blue][color=green]
          > > the[color=darkred]
          > > > > console window by any means. Anyway, it would probably popup in[/color][/color]
          > "window[color=green][color=darkred]
          > > > > mode" since it has to execute a bit before being hidden and that[/color][/color][/color]
          would[color=blue][color=green]
          > > be[color=darkred]
          > > > > kind of ugly.
          > > > >
          > > > >
          > > > >
          > > > > If I make a window application, I don't have standard streams. I've[/color][/color]
          > been[color=green][color=darkred]
          > > > > trying to find the process that started me to see if I could use its
          > > > > standard streams. I don't know if it's even possible!
          > > > >
          > > > >
          > > > >
          > > > > If it is, can someone show me some pointers? If not, any alternative
          > > > besides
          > > > > having two executable?
          > > > >
          > > > >
          > > > >
          > > > >
          > > > > Thanks!
          > > > >
          > > > >
          > > > >
          > > > >
          > > > > Eric Robert
          > > > >
          > > > >
          > > >
          > > >[/color]
          > >
          > >[/color]
          >
          >[/color]


          Comment

          • Eric Robert

            #6
            Re: Unattended application...

            Well, I've tried to use that function... And I have look in the Platform SDK
            but maybe you're right and I have miss something. I just wish I'd know what
            ;-)

            Thanks anyway!
            Eric
            [color=blue]
            > Eric,
            >
            > just try the suggestion. To understand what's going on and who's whose[/color]
            child[color=blue]
            > you might need to read Platform SDK docs on consoles. It's very different
            > type of beast than standard forms. Console class in .Net exposes some of
            > properties of this beast, but not all of them. That's why to do this trick
            > you have to use SetParent. You can forget about child windows...
            >
            > I suggested this because it works for me - I can hide/show console at[/color]
            will,[color=blue]
            > control its size and location, colors etc. and make it my child window
            >
            > HTH
            > Alex
            > "Eric Robert" <synapzzz@spam. hotmail.com> wrote in message
            > news:exVq6EPpDH A.3504@TK2MSFTN GP11.phx.gbl...[color=green]
            > > Just to clarify things. If you create a C# window application and change[/color]
            > it[color=green]
            > > to console after (via the property menu), you have 2 windows poping up -[/color]
            > one[color=green]
            > > is the console and the other is the form. If I put a button and break in[/color]
            > it,[color=green]
            > > I see only one thread. If I look at both windows, the form isn't[/color]
            > responding[color=green]
            > > (that's fine) and the other behave normaly. So, they must be in separate
            > > process... right? I don't see how it could be otherwise.
            > >
            > > So, it can't be my parent window. It is my "parent" process's window.[/color][/color]
            And[color=blue]
            > it[color=green]
            > > is those streams that I'm after!
            > >
            > > Eric Robert
            > >[color=darkred]
            > > > Sorry but this is not what I want. The console window isn't my child[/color]
            > > window.[color=darkred]
            > > > It "could" be my parent (if only I could find how to know that...).[/color][/color][/color]
            But[color=blue][color=green]
            > > your[color=darkred]
            > > > suggestion is to hide the child window. This makes no sense...
            > > >
            > > > "AlexS" wrote:
            > > > > You can rid of console using SetParent (Win32 api) with HWND_MESSAGE
            > > > > parameter.
            > > > > Check both in Platform SDK.
            > > > >
            > > > > Tested and works
            > > > > HTH
            > > > > Alex
            > > > >
            > > > > "Eric Robert" wrote:
            > > > > > Hi,
            > > > > >
            > > > > >
            > > > > >
            > > > > > I think I've tried everything I can without success. I want to[/color][/color]
            > bundle[color=green]
            > > an[color=darkred]
            > > > > > application that can run unattended or not. That's means it can[/color][/color]
            > behave[color=green][color=darkred]
            > > > > like
            > > > > > a normal window application or a command line one i.e. with a[/color][/color]
            > standard[color=green][color=darkred]
            > > > > > input, output and error.
            > > > > >
            > > > > >
            > > > > >
            > > > > > If I make a console application, I can't seem to be able to get[/color][/color][/color]
            rid[color=blue]
            > of[color=green][color=darkred]
            > > > the
            > > > > > console window by any means. Anyway, it would probably popup in[/color]
            > > "window[color=darkred]
            > > > > > mode" since it has to execute a bit before being hidden and that[/color][/color]
            > would[color=green][color=darkred]
            > > > be
            > > > > > kind of ugly.
            > > > > >
            > > > > >
            > > > > >
            > > > > > If I make a window application, I don't have standard streams.[/color][/color][/color]
            I've[color=blue][color=green]
            > > been[color=darkred]
            > > > > > trying to find the process that started me to see if I could use[/color][/color][/color]
            its[color=blue][color=green][color=darkred]
            > > > > > standard streams. I don't know if it's even possible!
            > > > > >
            > > > > >
            > > > > >
            > > > > > If it is, can someone show me some pointers? If not, any[/color][/color][/color]
            alternative[color=blue][color=green][color=darkred]
            > > > > besides
            > > > > > having two executable?
            > > > > >
            > > > > >
            > > > > >
            > > > > >
            > > > > > Thanks!
            > > > > >
            > > > > >
            > > > > >
            > > > > >
            > > > > > Eric Robert
            > > > > >
            > > > > >
            > > > >
            > > > >
            > > >
            > > >[/color]
            > >
            > >[/color]
            >
            >[/color]


            Comment

            • Eric Newton

              #7
              Re: Unattended application...

              Maybe try system tray? and not basing code in a form but instead in a class
              instantiated by the Main method?


              --
              Eric Newton
              C#/ASP Application Developer
              eric@cc.ensoft-software.com [remove the first "CC."]


              "Eric Robert" <synapzzz@spam. hotmail.com> wrote in message
              news:%23lY1eGOp DHA.2820@TK2MSF TNGP10.phx.gbl. ..[color=blue]
              > Hi,
              >
              >
              >
              > I think I've tried everything I can without success. I want to bundle an
              > application that can run unattended or not. That's means it can behave[/color]
              like[color=blue]
              > a normal window application or a command line one i.e. with a standard
              > input, output and error.
              >
              >
              >
              > If I make a console application, I can't seem to be able to get rid of the
              > console window by any means. Anyway, it would probably popup in "window
              > mode" since it has to execute a bit before being hidden and that would be
              > kind of ugly.
              >
              >
              >
              > If I make a window application, I don't have standard streams. I've been
              > trying to find the process that started me to see if I could use its
              > standard streams. I don't know if it's even possible!
              >
              >
              >
              > If it is, can someone show me some pointers? If not, any alternative[/color]
              besides[color=blue]
              > having two executable?
              >
              >
              >
              >
              > Thanks!
              >
              >
              >
              >
              > Eric Robert
              >
              >[/color]


              Comment

              Working...