|
No - as the program will be in use!
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
As Dave said - no, but why on earth would you want to do this? The only reason I can see for this would be to try to put something malicious on a machine which removes itself when it's completed it's nefarious purpose. As you earlier posted about wanting to write a key logger, I'm highly suspicious of what you are hoping to accomplish.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Please stop deleting your messages, just because you don't like the answers you're getting.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
|
nike_arh wrote: Hi! I recently started working on internet applications. I wondered what is the principle behind programs like TeamViewer. How do they work, because I'm interested in making my own similar program.
Errrm. You did see the honking great bit of text at the top that said this was the C# forum didn't you? I mean - I can see that it would be easy to miss, what with it being twice as big as the rest of the text and green. I mean, c'mon; couldn't they have made it any more apparent that this section was about C# code and nothing whatsoever to do with asking questions about commercial applications?
Would you like to go away now, or shall I mock you some more?
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Pete O'Hanlon wrote: Would you like to go away now, or shall I mock you some more?
You sons of a silly person!
Man who stand on hill with mouth open wait long time for roast duck to drop in
|
|
|
|
|
More! More!
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Jörgen Sigvardsson wrote: What's your beef with this guy? He wasn't rude, he didn't ask you to do his homework, and he didn't offend anyone.
|
|
|
|
|
Hello,
I have 3 types of resources embeded in my executable :
html, jpg and pdf. I also have a listbox, and I want whenever a user sleects a different item, to display it in a web browser.
I have no problems doing that to HTML files, but with the other one, it's a different thing and I hope someone can help me do this.
First, I want to say that I don't want to save the resources locally and after that load them in the browser, because I don't want users to see them.
I am using this to view the html :
<br />
Assembly assembly = Assembly.GetExecutingAssembly();<br />
webBrowser1.DocumentStream = assembly.GetManifestResourceStream("ebook.index.html");
If I try to do the same thing to the pdf or jpg, it simply shows me the binary data of the files, it does not display them in the browser.
Is it possible to make the visible in the browser, directly from the assembly ? What are my options ?
Thank you
|
|
|
|
|
Hi,
I haven't done this myself, but the way I understand it you must also set the WebBrowser.DocumentType (try "application/pdf"); that should allow you to view a PDF document (or any image) as a web page.
You probably also want images inside web pages, so have a look at embedded images[^].
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Hello,
Thank you for the quick reply but unfortunatly the DocumentType is read only
Any other ideeas ?
Thanx
|
|
|
|
|
Yes, you are right.
And the data scheme[^] is usable only for small amounts of data, hence small images only, no PDF documents.
I guess the next logical approach is to come up with a simple HTTP server that can provide HTML and PDF; then embed that in the app, andmake the WebBrowser navigate to it.
This seems to be a candidate: Sample HTTP Server Skeleton in C#[^]
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Hi,
I now have a simple embedded HTTP server working based on the article I provided a link to.
It gets a PDF document somewhere (from a file!), then serves that to its client, which can be either a regular browser (e.g. FireFox) or a WebBrowser. It still needs a lot of clean-up though, but I wanted to confirm you can make it work.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Thank you very much for your help
|
|
|
|
|
Hi
I want my application to update itself. As far as I know we can't do this in C# ( or any other language -without workarounds- ) because a file can't change itself while running.
I tried using another method which first downloads the newer executable, creates a batch file which waits for a while for the application to terminate then deletes the main app and replaces it with the newer one, then launches it.
But there is something wrong here I think. The batch file doesn't do everything correctly. Sometimes it doesn't delete itself or the update file, or sometimes newer does anything.
Class:
class updater
{
public string UpdaterURL = null;
public string LocalUpdaterLocation = null;
public int ErrorCounter = 0;
public void Download()
{
if (ErrorCounter == 0)
{
WebClient wc = null;
try
{
wc = new WebClient();
wc.DownloadFile(UpdaterURL, LocalUpdaterLocation);
}
catch { ErrorCounter++; }
finally { if (wc != null) wc.Dispose(); }
}
}
public void CreateBatchFile()
{
if (ErrorCounter == 0)
{
string AppPath = Application.ExecutablePath.Replace(Application.StartupPath, "").Replace(@"\", "");
StreamWriter sw = null;
try
{
sw = new StreamWriter("update.bat");
sw.WriteLine("@echo off");
sw.WriteLine("ping 127.0.0.1 -n 2 -w 1000 > nul");
sw.WriteLine("ping 127.0.0.1 -n 2 -w 1000 > nul");
sw.WriteLine("ping 127.0.0.1 -n 2 -w 1000 > nul");
sw.WriteLine("ping 127.0.0.1 -n 2 -w 1000 > nul");
sw.WriteLine("ping 127.0.0.1 -n 2 -w 1000 > nul");
sw.WriteLine("ping 127.0.0.1 -n 2 -w 1000 > nul");
sw.WriteLine("ping 127.0.0.1 -n 2 -w 1000 > nul");
sw.WriteLine("ping 127.0.0.1 -n 2 -w 1000 > nul");
sw.WriteLine("ping 127.0.0.1 -n 2 -w 1000 > nul");
sw.WriteLine("ping 127.0.0.1 -n 2 -w 1000 > nul");
sw.WriteLine("deleteexe:");
sw.WriteLine(@"del """ + AppPath + @"""/Q/S>nul");
sw.WriteLine(@"if exists """ + AppPath + @""" goto deleteexe");
sw.WriteLine("rename " + LocalUpdaterLocation + " " + AppPath);
sw.WriteLine(AppPath);
}
catch { ErrorCounter++; }
finally { if (sw != null) { sw.Close(); sw.Dispose(); } }
}
}
public void StartUpdating()
{
if (ErrorCounter == 0)
{
Process prc = new Process();
prc.StartInfo.FileName = "update.bat";
prc.StartInfo.ErrorDialog = false;
prc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
prc.Start();
Environment.Exit(0);
}
}
}
How I call it:
updater upd = new updater();
upd.UpdaterURL = "http://.../update.exe";
upd.LocalUpdaterLocation = "update.exe";
upd.ErrorCounter = 0;
upd.Download();
upd.CreateBatchFile();
upd.StartUpdating();
Thanks in advance,
Can
|
|
|
|
|
|
Thank you for your answer.
I have read that article you have linked. It is a sophisticated solution. But there is only one problem, There should be an AppStart.exe to start the updated solution.
I can only have one executable, that's why I was trying to work with batch files.
|
|
|
|
|
Hi people!
I don´t know how make a functionality to write text in a multiline richtext o multiline textbox, and set maxlenght property depending of width and height of the control. ( the control take diferent sizes in runtime ).
I´m using MeasureString method of System.Drawing.Graphics, but I don´t know if is the correct way.
Somebody know something ,please?
I home your help,
best regards.
PS: sorry for my english
|
|
|
|
|
Can you not set the ScrollBars property to either Horizontal , Vertical or Both .
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi,
the requirement for this functionality, the scrollbars must be set to "None".
thanks anyway
|
|
|
|
|
The only method I can think of would only give an approximation, so for what it is worth.
The VisualTextRenderer class has a GetTextMetrics method. The structure returned contains details such as FontHeight , AverageCharWidth , MaxCharWidth etc. for the Font and Graphics it is given.
You could divide the height of the TextBox by the FontHeight to give the number of lines. Then use either Average or Max Width to calculate how many characters fit on a line.
I have no idea how accurate this would be though.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
hi,can someone help me with this....
i want to know how to get the file name currently being modified/openned by certain process, i know about FileSystemWatcher tool but i want to get it in another way(i mean what process x is openning or modifying at a specific moment).
is there any API or c# code to it???
any help is appreciated
|
|
|
|
|
lost_in_code wrote: i want to know how to get the file name currently being modified/openned by certain proc
Unless the process exposes some kind of ommunication mechanism, there's no way to tell.
lost_in_code wrote: i know about FileSystemWatcher tool
The FSW won't work for you anyway since it can't tell that a file was opened at all. All it can see is the changes in the files timestamp attributes, which don't change if you open a file for read access.
lost_in_code wrote: i want to get it in another way(i mean what process x is openning or modifying at a specific moment).
The only way I can think of would be to enumerate all the process handles, and all of the file handles in the system and start trying to match them up with each other. But, there is no way to tell an .EXE file from a .DLL file from a .TXT file from a .DOC file, or any other file type. On top of that, most apps out there don't hold files open when they load them, so there's no file handle to try and match up anyway.
The bottom line is what you want to do is extremely difficult and unreliable.
|
|
|
|
|
with due respect
regardds to all the lover and users of c # dear i am new learner of c# and i have two problums
1. i want to convert the numeric value of text
eg when i enter 100 so it should converted to one hundred
eg i enter in one text box 123 in the other text box should come one hundred and twenty three
2. i want to calculate the value of two text boxes and minusing from thrid and showing in the another text boxes
not on button click but on the text box events (onchange or any one)but it should be textbox event thank you
|
|
|
|
|
Hi,
welcome to CodeProject
1.
there are over 20000 articles here; at least one of them deals with Number To Text Converter[^]
2.
TextBox events are explained in the documentation. Use Google to locate them.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|