Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Determine if application is console application at runtime

Status
Not open for further replies.

chandlm

Programmer
Feb 11, 2003
114
GB
Hi Folks,

Is there any way to determine if an application is a console application at runtime?

I want to write a DLL that is fairly universal but it needs to do something extra if the application is a console.

any ideas?


Matt
[rockband]
 
Why don't you break out the "Extra" either into a separate function/class and then only call it, from the console, if needed.

If [blue]you have problems[/blue], I want [green]source code[/green] AND [green]error messages[/green], none of this [red]"there was an error crap"[/red]
 
I have no idea if this code is reliable or not but thought I'd put it out as a suggestion.
Code:
        Dim IsConsoleApp As Boolean

        Try
            Dim wh As Integer = Console.WindowHeight
            IsConsoleApp = True
        Catch ex As Exception
            IsConsoleApp = False
        End Try
 
Thanks for the Suggestions, in the end I decided to go down the route of creating a boolean property and setting the value to true when I use this dll in my apps.




Hope this helps.

Matt
[rockband]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top