Re: How to tell if running in console or winexe mode?



"D H" <no@spam> wrote in message news:R9udnSPEjp7qr_7fRVn-qQ@xxxxxxxxxxxxxx
> Tim Haugton wrote:
>> The question you're asking seems to indicate that you're doing
>> something peculiar.
>
> As I explained, I used an incredibly simple example - make a beep()
> function. One that works at all times. Regardless of winexe or exe.
> I don't see anything "peculiar" or unreasonable about asking if something
> so basic and simple is possible.

I think what Tim was trying to get across is that generally, if you are
targetting both Console and WinForms, you have two separate codebases
handling the presentation tier, and then you business and data tiers behind
them. Therefore, each codebase would only require the code it needs. The
console application would not use MessageBoxes, and the WinForms exe would
not use console I/O. Thus, the "something peculiar" you're doing is
approaching this from the wrong side. Rather than try to create a cross-UI
system library, it is far easier to simply have 2 presentation layers. Many
things in Windows UI do not cross well as concepts into Console UI and vice
versa. So the approach is "peculiar", not this specific instance (beep).

> (and if it's not, just say so, don't tell me I must be doing something
> wrong or peculiar for even asking).

He didn't say that, he said that you're doing something peculiar for trying
to have a single codebase crossing Console and Winforms. I don't understand
how you get from his first sentence above to an attack on you for asking
your question?

> I found an alternative in this one specific case is to call
> microsoft.visualbasic.interaction.beep() which works on Mono and .NET and
> in console or winexe apps. Of course that's not a very generalizable
> solution for other cases, is it?

No, it's not.

> Console Apps and Windows Apps are fundamentally
>> different animals. You'd be much better factoring out all common code
>> into a library, then having a seperate console app and Windows app that
>> uses the common code.
>
> It's a beep. It couldn't be more simple. There is no common code. What's
> uncommon about a beep?

Um, you actually said "Of course that's not a very generalizable solution
for other cases, is it?". This implies that you're looking at something more
extensive than a beep. You've already pointed out that you have a solution
for beep, and now Tim is quite delicately pointing out that your overall
approach is flawed, not the beep solution.


.



Relevant Pages

  • Re: is killing zombies possible w/o a reboot?
    ... >>Are you saying that these zombies (or tasks stuck in state D) also ... > I get a couple of beeps from the console, but thats the limit of the ... > VC2, and tried it there, but that attempt didn't even get me a beep, ... To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ ...
    (Linux-Kernel)
  • Re: beep on text console
    ... That causes beeps on console or vi because that. ... Okay, so the real issue is the wrong layout, not that much the beep which is more of a symptom. ... You can use the "dumpkeys> file" command to create a keyboard configuration file, then adjust it to your actual keyboard layout and finally apply the changes with the "loadkeys file" command. ...
    (comp.unix.solaris)
  • Re: [SLE] USB on SuSe
    ... > When I insert my USB mass-storage device SuSe does beep. ... in a console do: ...
    (SuSE)
  • Console beep
    ... i have a question that has been on my mind for some time now. ... change the level and pitch of the console beep(other people in my house ... ctrl-f beep in the sinlge page file handbook), ...
    (freebsd-newbies)
  • Console beep
    ... i have a question that has been on my mind for some time now. ... change the level and pitch of the console beep(other people in my house ... ctrl-f beep in the sinlge page file handbook), ...
    (freebsd-newbies)