|
check out the following link.
http://www.c-sharpcorner.com/FAQ/Create1InstanceAppSC.asp
it show how to give focus to application if it is already running and uses its id to compare, in your case you can search process by name.
Shajeel
|
|
|
|
|
Thanks a lot Shajeel. It worked a treat
Web design and hosting
http://www.kayess.com.au
|
|
|
|
|
Hello,
I want to allow the user to specify if my application is automatically started when the OS boots. I understand that I need to add an entry to the Run registry key to make this happen but I also want to allow the app to auto-start in the system tray. To do this I have a command line and I use this command to set the key in the registry
key.SetValue("MyApp", Application.ExecutablePath + " /tray");
but this doesn't put any speech marks around the executable path.
How can I make it so that the value in the registry has the quote marks around it so that the /tray part is a command line param and not part of the path itself?
I want the registry key to be something like "C:\Program Files\MyApp\MyApp.exe" /tray.
How can I do this?
Thanks,
|
|
|
|
|
I'm pretty sure \" is the proper escape sequence for ".
I think you could say:
key.SetValue("MyApp", "\""+Application.ExecutablePath + "\" /tray");
But I don't know how the registry would like it.
-Daniel
|
|
|
|
|
Works perfectly, thanks Daniel.
|
|
|
|
|
I need to clip the cursor to a specific area in my application which I am able to do so. But the problem is when I ALT+TAB to some other window still the cursor is clipped restricting my movement. I would like to know how to clip the cursor only to my application thread without using API's
BK
|
|
|
|
|
You could probably, before you set the clip area store the existing one in a local variable. When you app/form loses focus it restores the original clip area then when it receives focus again it resets the clip area.
You know you're a Land Rover owner when the best route from point A to point B is through the mud.
Ed
|
|
|
|
|
i am working on my project which is related to transfer video clips i.e. video files from pc to mobile devies over session initiation protocol (sip)in the context of sms i.e. without using GPRS and needs help on it. if any one have any knowledge about this please guide me.
Thanks
Muhammad Kashif
|
|
|
|
|
I've tried asking this on microsoft.public.dotnet.languages.csharp, but I am getting no response. Maybe I'm getting lost in the traffic. So, let's try it here.
Dev env: VS 2005 C# Express, .Net Framework 2.0
I am trying to programmatically select an item in a listbox on a web page. The first thing I do is go through and de-select any selected items. The OuterHtml field of a selected element in the listbox looks something like this:
Default item
I want to simply remove the the term 'selected' this way:
elt.OuterHtml = elt.OuterHtml.Replace("selected","");
This results in OuterHtml being set to:
Notice: 1) the 'selected' term is untouched, 2) the visible text has been removed.
After the assignment I can see in the debugger that one of the members of the HtmlElement object (OffsetParent, I think) has a string indicating some kind of COM Interop services exception.
The MSDN documentation at
http://tinyurl.com/edbln
does contain this warning:
"If you assign a new value to OuterHtml, the current element reference will become invalid; it will not reflect the name, properties and child content of the HTML you have just assigned."
but I don't really understand what that means.
Is it possible to change the HTML in a web page? Am I going about it the wrong way? Is there some kind of initialization or setup call I am supposed to make? Is it just a bug in .NET 2.0?
|
|
|
|
|
Perhaps you should start by mentioning what you are doing? Are you changing the page in a browser from another program? Do you have a browser component in your program that shows the page you are trying to change? Are you writing a client side component that is changing the page it is running in?
---
b { font-weight: normal; }
|
|
|
|
|
Ok, fair enough, I am automating navigation through a set of web pages by putting the NET 2.0 Webbrowser control on a dialog. When I get to the third page in the sequence I need to change the default item in a listbox on the web page to the item that I know in advance I want selected. I've been successful in using InvokeMember("Click") to click a button on a web page but I have not been able to "click" on an item in a list in order to select it.
|
|
|
|
|
Hello everyone! My first post here
As you might have guessed from the message title: is it possible to read from a text file, while another application is always writing to it, without disturbing the writing process? And if it is, how do I do it?
I'd like to create an application that open such a file, and gets the data that has been added to the file since my last read (maybe you've got some good suggestions how to do that?).
Thanks in advance,
Paul
|
|
|
|
|
It might be possible to read from the file, but it's hard to guarantee that it would never disturb the writing process.
It sounds like you should use something that has much better functionality to handle multiple users, like a database.
---
b { font-weight: normal; }
|
|
|
|
|
That is true, but my question was more out of curiosity after observing programs like AviPreview or VLAN play avi or mpg files while they were still being downloaded. I hope someone knows a solution because this is driving me nuts
|
|
|
|
|
pistolenpaultje wrote: AviPreview or VLAN play avi or mpg files while they were still being downloaded
I don't know about these programs but it looks like LimeWire just pauses the download while it writes the downloaded bits so far to a temporary file which it then displays. Maybe these programs do the same and you havn't realised.
You know you're a Land Rover owner when the best route from point A to point B is through the mud.
Ed
|
|
|
|
|
Are you talking about something similar to the Unix tail command? If so, you might just want to look at something like this[^].
--
I've killed again, haven't I?
|
|
|
|
|
i looked at that, but it waits until the writing process is complete and then opens the file and reads the changes. i'd like to know how to read a file that is being written to while it happens. Or, probably the same, an application that is writing to the file sporadically but never closes the file handle while it is running.
thank you for your reply though, i'll get there!
maybe this is good material for an article: Advanced File I/O
|
|
|
|
|
I'm not sure how helpful this is, but I accidentally did something like that a while back. I wrote a program that was supposed to start capturing the screen into a WMV. I made the mistake of telling it to start capturing when it lost focus, as well as play the captured file when I manually stopped it. The result was this:
- captured WMV (wrote file)
- played WMV in MediaPlayer
- program lost focus
- program started writing to same WMV just before MP started playing it
- I saw the multiple smaller-and-smaller time-delayed MediaPlayer windows in the video.
Basically, MediaPlayer was reading a file that was being written just a little ahead of it, so I know it's POSSIBLE. It's just a matter of fooling Windows into doing it intentionally.
-Daniel
|
|
|
|
|
That's exactly what i mean! Funny though, because I never caught WMP doing anything like that (it refuses to play avi's or mpg's while the download is still in progress). Maybe it's because WMV's are designed with streaming in mind, so WMP opens it differently than avi's or mpg's..
Paul
|
|
|
|
|
I'm not very knowledgeable about streaming or deep file IO junk, but it would make sense for WMP to check to see if the file is not currently being written to.
In my scenario, I wouldn't be surprised if my program hadn't quite started writing to the file when WMP checked it (the WMV was a distinct file from a previous start-stop capture), kind of like how people used to play copied PS games (I never did, but I heard how to do it, with a real disk when the PS does its little preliminary validity check, then swapping).
-Daniel
|
|
|
|
|
you just have to keep tracks of the position of the writing process and limit yourself to not read beyond where the last write position was.
|
|
|
|
|
sounds like just what i need! however i already tried something like that but couldn't get it to work. do you have any suggestion (maybe an article link or code snippet) how i could accomplish that? many thanks for your reply, i now have an idea in what direction to search!
|
|
|
|
|
Does the C# Express Edition include the ability to deploy the application? I have seen that VS2005 has ClickOnce, but I cannot determine if it is available in Express Edition.
Also, are there any other options besides InstallShield to deploy VS2005 applications?
|
|
|
|
|
econner wrote: Does the C# Express Edition include the ability to deploy the application? I have seen that VS2005 has ClickOnce, but I cannot determine if it is available in Express Edition.
Does this answer your question.
econner wrote: Also, are there any other options besides InstallShield to deploy VS2005 applications?
NSIS, InnoSetup. I personally don't bother with InstallShield, MSI or ClickOnce. It's just this feeling of being in complete and utter control of NSIS that gives me a warm feeling
I suggest you take a look at the installer script for Sharpdevelop if you want a good example of installing .NET applications using NSIS. The #develop script performs checks for frameworks, registers file associations, custom bitmaps etc etc.
You've probably guessed this by now but I'd strongly recommend NSIS, the things you can do with it are endless. I even wrote scripts which would install mods into GTA III, Vice City and San Andreas with it .
You know you're a Land Rover owner when the best route from point A to point B is through the mud.
Ed
|
|
|
|
|
Thanks.
I will take a look at NSIS.
|
|
|
|