|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Can we determine at runtime if app is Console or Windows?Hi all, and to Cor, Herfried and the other "old folks", it's been a long
time :-) I might be hanging around again for awhile but in the meantime I have a question. Does anybody know of a way to determine at runtime whether the app is a console or a GUI app? I have to imagine the information is available but searching around didn't yield the answer. Thanks, Tom Hi Tom,
Good to see you back, in my idea is this a typical Herfried question. I am almost sure he knows this. Cor Show quoteHide quote "Tom Leylan" <gee@iamtiredofspam.com> schreef in bericht news:%23J$yDw06GHA.348@TK2MSFTNGP02.phx.gbl... > Hi all, and to Cor, Herfried and the other "old folks", it's been a long > time :-) > > I might be hanging around again for awhile but in the meantime I have a > question. Does anybody know of a way to determine at runtime whether the > app is a console or a GUI app? I have to imagine the information is > available but searching around didn't yield the answer. > > Thanks, > Tom > > > > Hi to you too... (you're an MVP now)!
It might sound a little funny since it must be known at compile time whether it is a console app. On the other hand I was hoping that I might develop a few routines that would adapt depending upon whether it was a console app, so I would like to check at runtime. It might not turn out to be too useful but I thought I'd check. Anything else been going on? Show quoteHide quote "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message news:erwc1U16GHA.4604@TK2MSFTNGP03.phx.gbl... > Hi Tom, > > Good to see you back, in my idea is this a typical Herfried question. > I am almost sure he knows this. > > Cor > > "Tom Leylan" <gee@iamtiredofspam.com> schreef in bericht > news:%23J$yDw06GHA.348@TK2MSFTNGP02.phx.gbl... >> Hi all, and to Cor, Herfried and the other "old folks", it's been a long >> time :-) >> >> I might be hanging around again for awhile but in the meantime I have a >> question. Does anybody know of a way to determine at runtime whether the >> app is a console or a GUI app? I have to imagine the information is >> available but searching around didn't yield the answer. >> >> Thanks, >> Tom Tom Leylan wrote:
> I might be hanging around again for awhile but in the meantime I have Seeing as no one else has answered, I'll offer you this solution. I don't > a question. Does anybody know of a way to determine at runtime > whether the app is a console or a GUI app? like it at all, but it does work (tested in VB2005): \\\ Public Function IsConsole() As Boolean Dim s As String Try s = Console.Title Return True Catch ex As System.IO.IOException Return False End Try End Function /// I'd strongly advise keeping this in a self-contained function, and then when someone suggests a proper implementation you can just swap the code over. :) -- (O)enone That works well enough. I agree that catching the exception isn't the idea
method but the functionality is isolated. I added a static variable within the function so it can be set once on the first call and subsequent calls don't need to trip the exception again. Thanks... it works! Show quoteHide quote "Oenone" <oen***@nowhere.com> wrote in message news:FXxWg.9303$Or2.1939@newsfe7-gui.ntli.net... > Tom Leylan wrote: >> I might be hanging around again for awhile but in the meantime I have >> a question. Does anybody know of a way to determine at runtime >> whether the app is a console or a GUI app? > > Seeing as no one else has answered, I'll offer you this solution. I don't > like it at all, but it does work (tested in VB2005): > > \\\ > Public Function IsConsole() As Boolean > > Dim s As String > > Try > s = Console.Title > Return True > Catch ex As System.IO.IOException > Return False > End Try > > End Function > /// > > I'd strongly advise keeping this in a self-contained function, and then > when someone suggests a proper implementation you can just swap the code > over. :) > > -- > > (O)enone >
Combo Boxes in Datagrids
Experience Request: GPS Application What is the optimal way to upload 10,000 records to Oracle DB? Multi-dimensional array - Question on Data types How to lock a text file? How to debug program error on Windows with another language? Prompting for an IP address Tab groups in VB2003 debugging Connect to the right SQL Server during runtime Access DB on a pocket PC |
|||||||||||||||||||||||