Programmatically Determine If Console/WinForms/WPF?
Jun 21, 2010
I need to figure out a way to programatically determine whether code is being called from a console application or a WinForms application (or even WPF). The scenario is, a .net DLL library needs to know what kind of application is calling it. Is this possible?
I've made console apps that show what they are doing, open forms etc. now I don't always want to show the debug console. I want to make a Winforms app, that starts as a form. and in some menu open that same console that i see in a console project. how can i do that?
I've added a CKEditor instance programmatically to my page in the code-behind of my ASP.NET page:
[code]...
which works fine. I can get the HTML on the postback and do stuff with it.However, I also want to do some client-side stuff with it, specifically take a selected item out of another control, and insert it into the text by handling the onchange event.So, how can I get the name of the editor instance in the JavaScript, so that I can do stuff like:
Does anyone know of a way to programmatically determine which version of the .NET framework is installed on a computer? I was thinking of trying to scan the registry, but my main worry is that a user would need admin rights if trying to use the method
If a user navigates to my webpage how can I programmatically determine they are accessing my page from within the Intranet? (Not interested in NTLM or Windows forms authentication. Need a programmatic method.)
I'm attempting to write a solution so that my user's can "watermark" their Images with their Company Logo. I've got the actual watermarking part done and working so now I'm creating the "upload logo" feature so that they can provide me with the Logo they wish to appear watermarked onto their Images.I'm using VB.NET and this will probably end up in a Web Service that accepts the Logo JPG file, and returns the "altered" Logo. What I need to happen in this Web Service is:
1) Gray-scale the image. Which I have working as well, thanks to this article.
2) Make the background transparent (so the logo looks clean when watermarked onto an image). This is where I'm stuck.
I think for the most part, any logos that are uploaded will have a generic white background but I can't assume that. Is there a way to somehow detect the background of an image or the background colors, so that I may make those colors transparent?So basically what I need is just a way to determine the background on an Image or even just the background colors so that I may make them transparent.
I've created a VB Console Application Project and am trying to instantiate a Report Viewer object. To my understanding I need to import Microsoft.Reporting.WinForms however Visual Studio does not recognize this name space. Is there some reference I need to add?
I'm trying to write an application that will allow a non-administrator user to create virtual directories in IIS6. I've tried numerous different ways of impersonating a administrative account but nothing seems to work to create the virtual directory.
Here's some of what I've tried: dim sDirPath as string = "IIS://remotehost/W3svc/1/root" Dim de As DirectoryEntry = New DirectoryEntry() de.Path = sDirPath de.AuthenticationType = AuthenticationTypes.Secure de.Username = tbxUsername.Text [Code] .....
what is the correct way to impersonate another user in winforms application that will allow me to create the virtual directory without the user that's running the application being an administrator on the web server? I know this can be done, IIS manager allows you to use "connect as" checkbox to do it.
detect whether the current application is a console or a winforms application.The reason that I want to do this is that I am developing a library with a global error handler in it and I need to know what type of application it is in order to be able to subscribe to the appropriate exception event.Obviously I could get the user to pass in a parameter specifying what type of application it is, but I would rather deal with that automatically so its all encapsulated from the user of the class.
I was thinking of adding a simple bandwidth monitor to a console application and I was wondering if it would be possible to keep a line in the console window visible at all times. I could set something up manually to pass new console output into a method that would get the contents of the console, clear the console, add the bandwidth data on the first row, then rewrite each line of previous information back to the console, etc.. but that seems like a really hacky way to go about it, and I'd be limited to the amount of rows visible at once in the console window (no scrolling).
STATS: Downloaded: 2599b, Uploaded: 754b <- this always stays at the top constantly changing text constantly changing text constantly changing text
I have a console application I'm using to run scheduled jobs through windows scheduler. All the communication to/from the application is in email, event logging, database logs. Is there any way I can suppress the console window from coming up?
so I am making a program that will run a server for a game. I've programmed a console into the form and it works but it only works until it is finished reading the slandered output.
I am currently working on an application, where I am using a console application, that will set up the application prior to the main form is run. This is no problem I've got that all working perfectly, the only problem I have is that the console is showing while the application is running, I was wondering whether anyone knows any way in which I would be able to hide the console before it gets shown to the user.
I am trying to send/print/write all possible ASCII codes (0-255) to another console-window application. From my application I would enter the name of the "receiving" application and the comma seperated hex values that should be sent/print/written to it. I have used AppActivate to select the "receiving" application and then have used sendInput and send.sendkeys to attempt to send the desired ASCII value. However, these appear to have limitations on values greater than 127. I need to be able to send all 255 values.
How do I get the console from closing immediatley upon opening in a Console Application program? I have all of the code written but when I run the program it pops up the console window and then immediatley exits so I am unable to read what is in the window to see if my program is operating correctly. This is the first time I've ever used a console window so I don't know where in the code I would need to put "whatever it is" I might need to put to keep the window open until closed by the user.
It sounds confusing but it's not really. What I need is basically a way to emulate the console style text, without using a console. What I'm really doing is trying to do a matrix effect on my form background, by drawing symbols and moving them, alternating their colors (see this video for what I mean).
Is there a way to do this effectively with a timer and a draw event, with the timer calling the draw event and changing the intervals?
Is it possible to set a project default for VB.NET winforms projects so that the default Modifier for controls added to winforms is Private (not Friend)?I know there's a "modifiers" property in the properties window so I can set it for each individual control however I would like to change the project so from now on myself and other developers have to specifically decide to change from friend to private. (Which I would strongly discourage them from doing).I believe there is no way of doing this, but on another forum a while ago someone mentioned it would be possible with an add-in (but didn't name the add-in or where to get it).
i havea dropdwonlsit (loads on the page_load event) and a unbound CheckBoxList is based on the selection from DropDownlist, the checkboxList is display CheckBox (might be one or two or three or any numbers)..... i just want to know after the page is loaded on the browser and user click on the checkbox's, i need a way to know what checkboxs users have selected... what is the best way of doing that? so far i have come up with this...
I have a need to figure out which adapter is used when a connection is created. In other words, if I have multiple NIC cards (i.e. wireless, lan, etc) on my machine, which card is being used for the connection?
I'm intend to use Aero glass in my program. It require use Black background to use this. If user is using Basic style, it will be very bad :( (although there's no error). How can I know if user is using Aero?What is big but light?