|
You could use a ListBox and append the items from the list into the ListBox.
|
|
|
|
|
Ok Thanks, I will try that. Althought I would think that <cr> might be a problem
|
|
|
|
|
Jerry Graham,
Label listLabel = new Label();
listLabel.Location = new Point(10, 10);
listLabel.AutoSize = true;
foreach (string item in theList)
{
listLabel.Text += item + Environment.NewLine;
}
form.Controls.Add(listLabel);
Something like that?
Regards,
Gareth.
|
|
|
|
|
|
Hello,
I'm wondering how to go about getting the mouse cursor position relative to a child window in a given windows application. I'm writing an application that is interested in this data.
Example: The user clicks a button in some winforms app, and my application uses low level hooks (or some other strategy) to determine the mouse coordinates relative to the clicked button in the other application.
Any thoughts on how to proceed? I'm hooking the mouse so I get the screen coordinates when the mouse is clicked, but I'm not sure how to get position (relative or absolute) of the control that generated the "click" event.
Thanks!
|
|
|
|
|
You can get screen co-ordinates and do the conversion yourself, it's pretty straightforward, just get the position of the window in question.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Yeah, I guess my question is really how to get the position of a child window that generated the event (where the child window is running in a separate application from the code that is interested in its position). I see that Spy++ is able to identify the positions of child windows, I just don't know what APIs are being used.
|
|
|
|
|
Snippet:
protected override void OnStart(string[] args)<br />
{<br />
try<br />
{<br />
Log("Service Starting");<br />
<br />
serviceThread = new Thread(new ThreadStart(runThread));<br />
serviceThread.Start();<br />
}<br />
catch(Exception ex)<br />
{<br />
Log("Error: " + ex.Message);<br />
}<br />
}<br />
<br />
protected override void OnStop()<br />
{<br />
Log("Service Stopping");<br />
serviceThread.Abort();<br />
}<br />
<br />
private void runThread()<br />
{<br />
Log("Service Thread Running");<br />
while(true)<br />
{<br />
DCNAuditProcessor.DoCheck();<br />
Thread.Sleep(waitTime);<br />
}<br />
}
The runThread Method never runs. The service starts succussfully, but this code is never executed. The Serivce Starting notification and Service Stopping notification is succcessfully logged to a log file, but never the Service Thread Running.
I have reviewed the event logs and there are no errors.
Any ideas would be appreciated.
-Thanks
|
|
|
|
|
I dunno, I don't spot any glaring problems in what you posted.
Does the list of Services show it as Running?
|
|
|
|
|
I found out what the issue was, but still not exactly sure why.
This line of code is calling a method of a class that belongs to another DLL: DCN_Audit.DCNAuditProcessor.DoCheck();
The name of this DLL was DCN_Audit.dll. The name of the service was DCN_Audit.exe. I was able to trap this error by calling the method directly: Error: Could not load type DCN_Audit.DCNAuditProcessor from assembly CF_DCN_Audit, Version=1.0.3048.28191, Culture=neutral, PublicKeyToken=null.
This would start the service, and it showed as Running in the Services Manager. The thread would stop because the error loading the dll, so no processing was taking place. Also, no errors were visable in the Event Viewer.
So, it appears that the dll cannot have the same name as the exe. I changed the dll project name and re-compiled producing a dll name of DCN_Audit_Processor.dll, and everything processed successfully.
I just wanted to post in case others had similar issues.
-Thanks
|
|
|
|
|
ooten14 wrote: the dll cannot have the same name as the exe
That doesn't make sense. But glad to hear it's working.
|
|
|
|
|
Alright, so I have an application that is in constant communication with the database. As happens in the real world, sometimes (devilishly often in this case actually) the line goes down. When this happens, the application needs to be restored to its initial state. A similar thing will need to happen when the user allows the application to time out. Someone suggested on the ALT.NET list that I simply unload the application domain. After poking around online for what this actually means this seems like a great idea. I am having trouble however getting my test program to work and I fear that I must be missing something.
My test has two components
ApplicationDomainChild - a simple windows form with a label displaying a number and a button that when you press increments the number. I've compiled this to an .exe.
ApplicationDomainParent - another windows form with a single button and the following:
<br />
public partial class Form1 : Form {<br />
private AppDomain _second_domain = null;<br />
private string _second_assembly_path = @"ApplicationDomainChild.exe";<br />
<br />
private void Form1_Load(object sender, EventArgs e) {<br />
_second_domain = AppDomain.CreateDomain("Second Domain");<br />
_second_domain.ExecuteAssembly(_second_assembly_path);<br />
}<br />
private void button1_Click(object sender, EventArgs e) {<br />
try {<br />
AppDomain.Unload(_second_domain);<br />
_second_domain = AppDomain.CreateDomain("Second Domain");<br />
_second_domain.ExecuteAssembly(_second_assembly_path);<br />
}<br />
catch (Exception ex) {<br />
System.Diagnostics.Debug.WriteLine(ex);<br />
}<br />
}<br />
}<br />
What I expect to happen is for both forms to open at the same time, me to be able to increment the values in ApplicationDomainChild as much as I want by pressing the button and then be able to press the button on ApplicationDomainParent and have that shut down and restart the ApplicationDomainChild.
What happens however is that first ONLY ApplicationDomainChild runs. After 'X' out of the window ApplicationDomainParent runs. When I press the restart domain button the child program starts up again and I can interact with it, but if I attempt to click the restart button again I get a ThreadAbortException followed by an AppDomainUnloadException (or something like that). Can someone tell me what I'm doing wrong?
|
|
|
|
|
I know its bad form to give myself a self-bump but please can someone just give me a hint? The problem seems to be that my child application is running on the same thread as the parent, therefore only one of them can process input at a time. Do I need to somehow start the appdomain in a different thread? I thought threads were inside of appdomains.
|
|
|
|
|
Dear friends,
I'm developing windows application using Visual Studio 2005 and I want to know how can I write help sentences to be produced finally at the end of development as chm help file.
In other words,
How can I create chm file while developing a windows application?
Mohammed Emam
.NET Developer
|
|
|
|
|
You create those chm files by using Microsoft's HTML Workshop (google it).
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
I am developing a C# app which will download Rapidshare files for Free users. The program would work as follows:
1. Rapidshare webpage would open in WebBrowser control.
2. Captcha would be input in the webpage
3. File download will occur using the download manager of the app, instead of the default download manager.
I have designed the download section in the following way.
<br />
private void rapidWebBrowser_Navigating(object sender, WebBrowserNavigatingEventArgs e)<br />
<br />
{<br />
<br />
string filename = @"C:\test.rar";<br />
<br />
Regex pattern = new Regex(@"http://([0-9a-zA-Z]+)\.rapidshare\.(com|de)/files/([0-9]+)/([0-9]+)/([^\r\n]+)", RegexOptions.IgnoreCase);<br />
<br />
string match = e.Url.AbsoluteUri;<br />
<br />
if (pattern.IsMatch(match))<br />
<br />
{<br />
<br />
e.Cancel = true;<br />
<br />
WebClient client = new WebClient();<br />
<br />
Uri uri = new Uri(match);<br />
<br />
client.DownloadFileAsync(uri, filename);<br />
<br />
}<br />
<br />
}<br />
<br />
While running, the app downloads a 10KB file instead of the real one. If I use the followsing code:
<br />
private void rapidWebBrowser_FileDownload(object sender, EventArgs e)<br />
<br />
{<br />
<br />
Regex pattern = new Regex(@"http://([0-9a-zA-Z]+)\.rapidshare\.(com|de)/files/([0-9]+)/([0-9]+)/([^\r\n]+)", RegexOptions.IgnoreCase);<br />
<br />
if (pattern.IsMatch(match))
<br />
{ <br />
<br />
WebClient client = new WebClient();<br />
<br />
Uri uri = new Uri(match);<br />
<br />
client.DownloadFileAsync(uri, filename);<br />
<br />
}<br />
<br />
}<br />
<br />
the app downloads a 10KB file and pops up IE's default download manager.
How to solve the problem? I want to intercept the original file download by WebBrowser control, and pass the url to my app's custom downloader suppressing the IE's downloader. How to do this?
I am eagerly waiting for the solution. Thank you in advance.
Anindya Chatterjee
|
|
|
|
|
Anindya Chatterjee wrote: While running, the app downloads a 10KB file instead of the real one.
10kb file containing what?
led mike
|
|
|
|
|
The 10KB file has the same extension as the real one. But when I change its extension to "html" and open it into IE, a rapidshare page opens telling:
Your IP address ***.***.***.*** is already downloading a file. You have to wait until it is finished.
Premium-accounts can download many files at the same time. Get your own premium-account now. Instant download-access!
[Original IP is replaced by *, it is confirmed that no ther RS download is going on at that time. I am not using any kind of proxy. This IP is for my own.]
I don't know why this is happenning. More thing to notice during Rapidshare happy hour time the file is downloaded successfully, but when CAPTCHA is used this thing happens and downloads never get successful.
Help plz..
Anindya Chatterjee
|
|
|
|
|
Anindya Chatterjee wrote: Your IP address ***.***.***.*** is already downloading a file. You have to wait until it is finished.
First you cannot believe that message.
Anindya Chatterjee wrote: I don't know why this is happenning.
Second there are any number of HTTP headers and/or sections they might use to deny your request. Have you sniffed successful downloads using a browser to see what Headers / Sections are present? Unless RapidShare documents an API that is probably the only way you are going to figure it out.
led mike
|
|
|
|
|
I have seen a Orbit downloader log while downloading a rapidshare file:
2008-05-06 02:17:07 Connecting rs266gc.rapidshare.com:80
2008-05-06 02:17:08 Connected
2008-05-06 02:17:08 POST /files/96986359/1517356/MyPet.rar HTTP/1.1
2008-05-06 02:17:08 Host: rs266gc.rapidshare.com
2008-05-06 02:17:08 Referer: http://rs266.rapidshare.com/files/96986359/MyPet.rar
2008-05-06 02:17:08 User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
2008-05-06 02:17:08 Content-Length: 66
2008-05-06 02:17:08 Content-Type: application/x-www-form-urlencoded
2008-05-06 02:17:08 Accept: */*
2008-05-06 02:17:08 Pragma: no-cache
2008-05-06 02:17:08 Cache-Control: no-cache
2008-05-06 02:17:08 Connection: close
2008-05-06 02:17:08 HTTP/1.1 200 OK
2008-05-06 02:17:08 Date: Mon, 05 May 2008 20:46:37 GMT
2008-05-06 02:17:08 Connection: close
2008-05-06 02:17:08 Content-Type: application/octet-stream
2008-05-06 02:17:08 Accept-Ranges: bytes
2008-05-06 02:17:08 Content-Disposition: Attachment; filename=MyPet.rar
2008-05-06 02:17:08 Content-Length: 5518769
2008-05-06 02:17:08 Start receiving data
How to use this in my C# App? I don't know. Help plz.
Anindya Chatterjee
|
|
|
|
|
The lines in the log look like a DateTime stamp followed by HTTP headers. If you use HttpWebRequest you can access/change HTTP header information.
The problem you are having is this.
You open a WebBrowser control, launch the page and the user enters the catchup info and clicks download. When this finishes you capture the URL of the file once it is suppose to start downloading, that is the Navigating event you captured. You cancel that request (ending the server connection) and then try to launch a web client to download from the now expired URL. I seem to recall sending e.Cancel=true; is the same as pressing the "Stop" button inside IE.
What you might try doing, without getting into the HTTP headers is just move the e.Cancel=true; below your web client download (since you never opened the page, it might let you download it)
-Spacix
All your skynet questions[ ^] belong to solved
I dislike the black-and-white voting system on questions/answers.
|
|
|
|
|
Yes, Ofcourse it will download, but with the default download manager of IE. I don't want this. I want to download it by the app itself. Problem is that catching the direct link of the file on Rapidshare server, I am not able to download it. I think you get my point and that is here I am stuck.
Anindya Chatterjee
|
|
|
|
|
No, it won't download in IE until the Navigating event exits.
I'm asking you to do the following:
private void rapidWebBrowser_Navigating(object sender, WebBrowserNavigatingEventArgs e)
{
string filename = @"C:\test.rar";
Regex pattern = new Regex(@"http://([0-9a-zA-Z]+)\.rapidshare\.(com|de)/files/([0-9]+)/([0-9]+)/([^\r\n]+)", RegexOptions.IgnoreCase);
string match = e.Url.AbsoluteUri;
if (pattern.IsMatch(match))
{
WebClient client = new WebClient();
Uri uri = new Uri(match);
client.DownloadFileAsync(uri, filename);
e.Cancel = true;
}
}
and if this doesn't work, you can use download and use WireShark[^] and WinPCap to record a successful request from within IE and reverse engineer the "good" request header requirements and you're set. You might also be able to use FireFox with live HTTP headers plugin that allows you to view HTTP data...
Yet if not canceling the event until AFTER your file download fixes the problem; none of the header stuff would be required.
-Spacix
All your skynet questions[ ^] belong to solved
I dislike the black-and-white voting system on questions/answers.
|
|
|
|
|
Sorry this has nothing todo with the OP's questions but....
Why is it called "rapidWebBrowser" when it prevents downloading rapidshare files??
-Spacix
All your skynet questions[ ^] belong to solved
I dislike the black-and-white voting system on questions/answers.
|
|
|
|
|
He can call it anything he wants .
|
|
|
|