Member Avatar

Hello, I try to catch the HTML code from a webpage after I have logged in to a page. HTML is returned but that is the orignal HTML only BEFORE I logged in. For example I try to find "Log out" and other content in the string "getDocumentHTML" returned which exists on the webpage. But that can't be found. How do we returned the final HTML content for the webpage after logging in? private void button1_Click(object sender, EventArgs e) { String url = textBox1.Text; webKitBrowser1.Navigate("http://hotmail.com"); } private void webKitBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { //This doesn't returnd the FINAL HTML content …

Member Avatar
0
8
Member Avatar

Hello, I use the webkitbrowser which is simular to the webbrowser. Now on a website, I want to programatically insert a string into a textBox. This I have succeeded to do like this: webKitBrowser1.Document.GetElementById("txtbox1").SetAttribute("value", "hello"); After this I will need to programatically click a button that will check that "hello" is correct. I have succeeded to click the button like this: webKitBrowser1.Document.InvokeScriptMethod("execFunction", new object[] { }); Now comes the problem. When "execFunction" is activated which is a <a></a> tag in HTML, I get the message that the "hello" string is not correct. Now I know why that is the problem. …

0
7
Member Avatar

Hello, I have an application that is not mine, that has 6 textboxes with values on it. I am trying to use the windows API to retreive the values from those textBoxes. I know that they exists in a control named "Panel1". So I have come so far in the code like below to find the "Panel1". But from here, I can't manage to find the textboxes and get their values? I have used "SysExp" software which do find those values for those textboxes so it is possible in somehow. Code attempt: [DllImport("user32.dll")] static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, …

Member Avatar
0
15
Member Avatar

Hello, I wonder how it would be possible to get text from a datagridview in another form application? The datagridview has 5 rows and 5 columns with text in each cell. I know that this could be achieved with windows API but googling around I have not understand how to actually do this. My beginning of code finds the application and in somehow we would return all childcontrols that exists to find the datagridview and extract text from the cells? [DllImport("user32.dll")] private void button15_Click(object sender, EventArgs e) { foreach (Process clsProcess in Process.GetProcesses()) { //We found the application if (clsProcess.MainWindowTitle.ToString().ToLower().Contains("nameofapplication")) …

Member Avatar
0
6
Member Avatar

Hello, I have a question about the webBrowser control. It does work good to display webpages but it seems that the control have problem to display certain webpages. (I think it has to do with javascript on the webpage). When trying to display this webpage, it will not FULLY load everything on the webpage. * Trying to open the webpage in IE8 gets the same problem. * Trying to open the webpage in CHROME does work! I wonder if we can modify anything for the webBrowser1 to make this work? webBrowser1.Navigate("http://www.allslotscasino.com");

Member Avatar
0
22
Member Avatar

Hello, I am trying to find all possible operative system/router/adapter reasons what can cause internet to stop connecting. The goal is to create code that check for all those reasons and programatically resolves those issues. I have found 2 codes that do reconnect the internet connection if not connected. Example 1: enables the network adapter if disabled using "\" enable" Example 2: I don't know what this code is doing. What is that code doing and how is it possible to check for if we need to "/renew" the connection? Using "/renew" and "/release" connects and disconnects to internet in …

Member Avatar
0
24
Member Avatar

Hi, It is possible to open a webbrowser window with the below code. I wonder how it would be possible to have the web browser docked at TOP of the desktop and have the window stretched to LEFT and RIGHT of the desktop and also how to choose a HEIGHT of the opened web browser window? System.Diagnostics.Process.Start("opera.exe", "http://google.com");

Member Avatar
0
14
Member Avatar

Hello, I wonder how we can use lock objects between 2 different applications. In the example below we can use lock objects to let only one thread to execute the code inside the lock object at a time. This works fine within one application. Now I wonder how we can use a lock object between 2 different applications. Is there some kind of Global system lock that can be used? I have put this code as illustration of what I try to find a solution for: object lockobject = new object(); //Application 1 void thread1() { Random rnd = new …

Member Avatar
0
28
Member Avatar

Hello, I will try to ask this question very straight forward to not complicate the example. As seen the an event called currentTime is located INSIDE a public class EWrapperImpl. The functions comes from a DLL reference file that I code against. By default it seems that the currentTime(long time) has to be declared in the EWrapperImpl class. I wonder if there are any standard procedure to be able to let this currentTime event to Also run in the "public partial class Form1 : Form" somehow? public class EWrapperImpl : EWrapper { public void currentTime(long time) { } } What …

Member Avatar
0
18
Member Avatar

Hi, I get an error when trying to compile a class that I have created: "EWrapperImpl.cs" **Error: TestCsharp.EWrapperImpl' does not implement interface member 'IBApi.EWrapper.currentTime(long)** It is documented in an example that: "you need to provide at least an empty shell of the method declared in EWrapper" but I don't know how to do this. I wonder if it is a basic delaration that can be done in EWrapper ? namespace TestCsharp { public class EWrapperImpl : EWrapper { EClientSocket clientSocket; private int nextOrderId; public EWrapperImpl() { clientSocket = new EClientSocket(this); } public EClientSocket ClientSocket { get { return clientSocket; } …

Member Avatar
0
17
Member Avatar

Hello, I have a very strange problem. I have created a code that I beleive is multicore/parallell threading to make a task to run faster using more cores in the computer. **My computer is a server: 32 cores (2 CPU with 16 cores each) 32 GB** Refering to my code: - If I use 1 process (1 core), the task takes 12 minutes. - If I use 2 process (2 cores), the task takes 7 minutes (This is what my goal is with multithreading) - If I use 4 process (4 cores), the task takes also 7 minutes (How is …

Member Avatar
0
64
Member Avatar

Hi, I wonder if the below code I have take up "2 threads" on the processor. In the Form1_Load event I call "startProcess". That process starts a backgroundworker in a separate class. The process also monitor callbacks from the backgroundworker. This is what makes me wonder if this takes up "2 threads" on the processor. The big concern with my question is that I will launch the application 20 times which would mean that 40 threads are running where perheps 20 of those are not nessecary. To add is that is a big task to move the backgroundworker to the …

Member Avatar
0
14
Member Avatar

Hello, I have an instance called "Instance". From the button event I try to create 2 Instances of "Instance". I want those 2 Instances to be completely separate from eachother in terms of the variables that exists inside "Instance". So for example you can see the List variable: "instanceValues" However, when I click the button to do a test to see if "instanceValues" is 0 when written to file, the value is 0 for the first file "D:/test0.txt" but for the second file "D:/test1.txt" the value is 3 which I don't want it to be. This must mean that the …

Member Avatar
0
10
Member Avatar

Hello, I am trying to restrict to maximum type 60 words in a textbox. I have tried to put a code that check if we have more than 60 words. The code restricts to 60 words but when I loop the textboxes words and put back the string (up to 60 words) the string says: "undefined undefined undefined undefined... etc" Why does this happen? what is undefined? <asp:TextBox ID="TextBox26" runat="server" Height="209px" TextMode="MultiLine" onkeyup="return countwordsarticle();" Width="650px" Font-Names="Arial" Font-Size="10pt" ForeColor="#333333"></asp:TextBox> function countwordsarticle() { var str1 = document.getElementById("TextBox26").value.replace(" ", " ").trim(); var words1 = str1.split(' ').length; //If more than 60 words only show …

Member Avatar
0
16
Member Avatar

Hi, I wonder if it is possible to put a "Twitter Follow Button" on a windows form application? Usually I have this code on a ASP.net webform. <a href="https://twitter.com/_TwitterName" class="twitter-follow-button" data-show-count="false" data-show-screen-name="false"></a><script> !function (d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (!d.getElementById(id)) { js = d.createElement(s); js.id = id; js.src = "//platform.twitter.com/widgets.js"; fjs.parentNode.insertBefore(js, fjs); } } (document, "script", "twitter-wjs");</script>

Member Avatar
0
21
Member Avatar

Hello, I am trying to declare a 2D List Globally. I beleive I miss something out in my declaration. It seems that I can declare the list. But when I try to add 1 dimension to the list, it only accepts: "new Requests.GlobalVariables.list2()" when it should be: new Requests.GlobalVariables.list1() I wonder what I can be doing wrong? //Global declaration public class list1 : List<int> { }; public class list2 : List<list1> { }; private static List<list2> _list; public static List<list2> list { get { return _list; } set { _list = value; } } Requests.GlobalVariables.list = new List<Requests.GlobalVariables.list2>(); //Declare Requests.GlobalVariables.list.Add(new …

Member Avatar
0
4
Member Avatar

Hello, I have a little problem with a timer that I have set up. I use Thread.Sleep(). What I am trying to do, is to let a code run exactly when a new minute occurs on the millisecond (0 millisecond). I have tried to set it up below and test it to write to file 4 times to see what the output is. As seen the outputs are strange where the first result actually triggers on the 988:th millisecond before the next minute and the rest 4 milliseconds after the new minute. //Minute,Second,Millisecond **32,59,988 34,0,4 35,0,4 36,0,4** Are there any …

Member Avatar
0
8
Member Avatar

Hello, I wonder if 2 backgroundworkers which are asynchronous can call the same function like in the code below. What I wonder is if the function is called Exactly at the same time from 2 workers. Can anything go wrong here or is this not a problem. I am not 100% sure how this works? public static String returnString(double Number) { String returnNumber = Number.ToString(); return returnNumber; } private void worker1_DoWork(object sender, DoWorkEventArgs e) { while(true) { String serverDateTime = returnString(123); } } private void worker2_DoWork(object sender, DoWorkEventArgs e) { while(true) { String serverDateTime = returnString(1234567); } }

Member Avatar
0
3
Member Avatar

Hello, I wonder if there could be faster way to convert a string to .Double() and Int32(), then the methods below? The code below takes approx: 7000 ms //7000 ms String number1 = "21.58"; String number2 = "21"; double getNum1 = 0; int getNum2 = 0; DateTime dt = DateTime.Now; int runs = 85000 * 15 * 10; for (int s = 0; s < runs; s++) { getNum1 = Convert.ToDouble(number1); getNum2 = Convert.ToInt32(number2); } DateTime dt2 = DateTime.Now; TimeSpan diff = dt2 - dt; MessageBox.Show(diff.TotalMilliseconds.ToString());

Member Avatar
0
21
Member Avatar

Hello, I wonder if there is any faster method to find an index of an occurence within a string? The .IndexOf method in the below test, takes approx: 1050 milliseconds. Why this is interesting is that I have code that uses .IndexOf on perheps 100 places and have loops that could exeed billions of iterations. Thank you! //Approx: 1050 milliseconds DateTime dt = DateTime.Now; String str = " hello hello.. ,0"; int loops = 4250000; for (int i = 0; i < loops; i++) { index = str.IndexOf(",", 0); } DateTime dt2 = DateTime.Now; TimeSpan diff = dt2 - dt; …

Member Avatar
0
7
Member Avatar

Hello, I have just bought a "USB Network server": http://www.conrad-uk.com/ce/en/product/992249/LOGILINK-4-port-USB-network-server I have attached a harddrive to the USB Network server and the USB Network server is connected to the router. I use 2 computers that needs to use the harddrive at the very same time. However the software that connects to the harddrive only allows one computer at a time to use the harddrive and blocks out the other computer from connecting to it. I have set the network server IP to static: 192.168.1.15 but the server supports DHCP also that randomly gives an IP. My question is simply this: …

Member Avatar
0
4
Member Avatar

Hi, I wonder how it would be possible to set a "string" in another application. I know the "MainWindowTitle" as my code goes below but I dont know how to set the text in one textBox that exists there. The thing I have to start with is the below but dont know how to continue from here. I dont know the names of the textBox on "someSoftware" [DllImport("user32.dll")] private static extern int SendMessage(IntPtr hWnd, int wMsg, int wParam, [MarshalAs(UnmanagedType.LPStr)] string lParam); private const int WM_SETTEXT = 0x0C; private void button8_Click(object sender, EventArgs e) { foreach (Process p in Process.GetProcesses()) { …

Member Avatar
0
5
Member Avatar

Hi, I wonder how the SendMessage method is used. I have googled around but can´t find any straight forward method of how to just send a String to another application. I have 2 desktop applications with a Form handle named: "Application1" and "Application2". I wonder how I will pass the below string from "Application1" to "Application2" ? String sendThisString = "Hello from Application1";

Member Avatar
0
4
Member Avatar

Hi, I have a special problem that I wonder how it could be possible to solve. I have 2 backgroundworkers that I know are, asynchronous events. I start the 2 backgroundworkers with the startButton. The workers have a loop with Thread.Sleep(1). With the setFlagButton, I set the variable like this: block = "notbusy"; In this moment, I want only one of the backgroundworkers to report progress and show the messageBox. Either MessageBox.Show("From a1") or MessageBox.Show("From a2"). Sometimes only one of the messageboxes are shown but sometimes both are shown. How can this be solved so only one messagebox will be …

Member Avatar
0
7
Member Avatar

Hi, I wonder if this namespace is possiblet to use. However I cant find ::Messaging in System::Windows ? I do use this namespace in Silverlight to mention. Is there a assembly etc to add to be able to use this? System::Windows::Messaging

0
1
Member Avatar

Hi, I have a code that checks if one specific process is running in the TaskManager with the code below. If not the function will start this process. The code I use in a Form_Load event when the application starts. (Working code is below) What I initially wonder is instead of a Form Application, I would only need some kind of file that should run this code. This means that you would double click a file that open/closes very fast while only running this code. Is this possible to achieve somehow. I am not sure what possibilities there are to …

Member Avatar
0
3
Member Avatar

Hi, I am starting another applicaton with this code below. When starting that application it is called "javaw" in the ProcessesTab in TaskManager. I simply wonder if it is possible to give this a choosen name in taskmanager under ProcessesTab when starting an application like this with the below code. For example if we want to call this process: "testprocess"? //Start 3:rd party application System::Diagnostics::Process^ startApp = gcnew System::Diagnostics::Process^(); startApp::StartInfo->FileName = "C:/someApplication.exe"; startApp::Start();

Member Avatar
0
2
Member Avatar

Hi, I have encountered a problem. I am checking if my application "testApp" is found in the ApplicationTab in TaskManager. The code below works 100%. But the problem is this when you just "rightclick" with the mouse on the "testApp" in the Taskbar, this code will produce the file and tell that it no longer was found in the ApplicationTab. This happens only when you "rightclick" the "testApp" in the Taskbar without doing anything else. I wonder why this happens as I need to check that "testApp" is still running all the time? using System.Diagnostics; private void checkConnection_DoWork(object sender, DoWorkEventArgs …

Member Avatar
0
5
Member Avatar

Hi, The below TimeZone code returns the following string: "(GMT-05:00) Eastern Time (US & Canada)" TimeZoneInfo FromZoneID = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time"); What I wonder how it is possible to do is how I create the TimzeZoneInfo object by using the string directly. I have tried this but it doesn´t work. I beleive I do something wrong? TimeZoneInfo FromZoneID = TimeZoneInfo.FromSerializedString("(GMT-05:00) Eastern Time (US & Canada)");

Member Avatar
0
2
Member Avatar

I have a mathematical problem that I am not sure how to solve. I am trying now but still cant find a solution. What I is doing is this: The example is that I have a number: "129" that I will need to round down to the nearest value. The answers to these example values look like this. How can I find a formula that can round down to nearest value like these examples ? Round down to nearest 5 gives: [B]125[/B] Round down to nearest 10 gives: [B]120[/B] Round down to nearest 20 gives: [B]120[/B] Round down to nearest …

Member Avatar
0
11

The End.