Console problem. New, I swear.  
Author Message

PostPosted: Visual C# General, Console problem. New, I swear. Top

I am testing TCP connections locally on my PC. I created two forms: Server and Client. I start the Server form first. There is code for AllocConsole in both of these Widnows Forms applications.:

[DllImport ( "kernel32.dll", SetLastError = true )]
[return: MarshalAs ( UnmanagedType.Bool )]
Static extern bool AllocConsole ( );

After testing some methods unsuccessfully for a day or so I downloaded a few classes from MSDN site describing server side code: ms-help://MS.VSCC.v80/MS.MSDN.vAug06.en/dv_fxnetwork/html/13624cd3-f5c5-4950-8cda-31273b1fa6d1.htm

I made some slight modifications, essentially negligible. I ran the forms and to my surprise found that the Server form did not appear at all, only the Console showed up. Puzzled I added a statement: this.Visible and ran them again. This time the Server form appeared but the Console for it was invisible. It is either Console or the Server Form. There is a statement: AllocConsole (); in the form_Load () method.

What is the explanation for this behavior What causes it


Visual C#19