|
currently I am using the following code and it works when the site I'm trying to click on is a regular site.
But it's not working for the site I want it to, which is a flash game, I don't think the game recognizes that a click is being sent to it because it doesn't respond
int x = 283;
int y = 342;
IntPtr handle = two.Handle;
StringBuilder className = new StringBuilder(100);
while (className.ToString() != "Internet Explorer_Server")
{
handle = GetWindow(handle, 5);
GetClassName(handle, className, className.Capacity);
}
IntPtr lParam = (IntPtr)((y << 16) | x);
IntPtr wParam = IntPtr.Zero;
const uint downCode = 0x201;
const uint upCode = 0x202;
SendMessage(handle, downCode, wParam, lParam);
SendMessage(handle, upCode, wParam, lParam);
oops I meant to preview but posted by accident, so here is the rest of what I wanted to say:
I'm using the win32 imports to click but I'm not sure how those work since I'm still only a student and the things I am trying to do are outside of anything I have learned.
Someone told me that the SendMessage I was using is clicking on the webbrowser object and not the flash object within the browser and that that may be my problem, what can I do about this?
|
|
|
|
|
Hi,
I am working on a datagrid with a link button. There are several rows that are displayed in the datagrid. The employeeId is the primary key which is the linkbutton also. When the user clicks on the datagrid I should show the details of that employee in another form.
How can we do this?
|
|
|
|
|
There's an event that gets triggered when you "click" the linkbutton. Your typical course of action is to get the value of the key, create a new form, and display the values of the current row on the new form.
Good luck
I are troll
|
|
|
|
|
Hello,
I am fairly new to programming and was hoping someone might have a method for identifying an object within a grey scale '.jpg' image. The object is might lighter than the surrounding area. I am unsure how to locate the object and highlight it on the image.
I thought I could create an array of pixels that are adjacent to each other and share a similar grey scale. But this method seems clunky as i need to observe every individual pixel and i am unable to find a method of observing individual pixels that does not use 'unsafe'.
If anyone would be able to help me that would be fantastic.
Thank you very much for your time,
David
|
|
|
|
|
Are you trying to extract certain object from the image after converting ur colored img to gray scale?
|
|
|
|
|
No, the image is black and white to begin with. I think I have solved the problem now anyway. Thank you fro your time.
|
|
|
|
|
I created a dynamic textbox with this codes below here. However if there are 2 or more textbox, it will come out side by side. Is there anyway to break them apart and put them in a new line?
for (int i = 0; i < textfieldNo; i++)
{
TextBox tb = new TextBox();
tb.ID = "txtChoice" + s;
Form.Controls.Add(tb);
s++;
}
|
|
|
|
|
You need to set the Location property for your tb instances.
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.”
|
|
|
|
|
Sorry but it still not working. I need something some coding for ASP.Net thanks. any solution?
|
|
|
|
|
As your problem is an ASP.Net one, you might have done better to have posted it in the ASP Forum.
I am unable to help you further, but I hope that someone else sees your request and is able to help.
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.”
|
|
|
|
|
I want to reduce the line count in an edit window from another process. I
am using a controller that connects to an external unit(providing it is turned on). The controller connects via a button that I am programatically clicking.The controller has an edit window that shows its status(failed too connect, connected, etc.), and every time the button is clicked the line count increases by one.I am using a recursive setup telling the operator to turn on the unit on each pass and then clicking the connect button.The line count goes to 16 and then gives an error ,which I believe is a page saying the edit window is full.Is there a way to decrease the line count so that the count will not change on each pass?I have ben using window apis to communicate with the edit window.Some code would be very helpful. My program is written in C#.Thanks in advance.
|
|
|
|
|
Didn't you ask this question a while ago?
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.”
|
|
|
|
|
I had asked it, but was not very clear as to what I was trying to do. I have ben all over the web trying to find a way to do this. I found a lot of information on adding a line, but could find nothing to reduce the line count.
Ray
|
|
|
|
|
Hello, I was wondering what would be the fastest way to read from a SQL database. I have a inventory database that populates a listview with various icons depending on the TypeOfEquipment field. Now I did make it use threading when populating the ListView but it was very chopping... performance wise it didn't "freeze" while loading thei nformation, but everytime an item was insert I guess it would try to go to the top and made the way it looked very choppy.
Anyways, right now I read from the database with SqlDataReader. Would putting it in a datalist then reading from there be faster? All that I am pulling from the SQL table is text. There isn't any files or pictures.
|
|
|
|
|
I forgot to mention this was a Windows application.. and I said DataList but I meant DataSet.
|
|
|
|
|
The ONLY way to read from a SQL database, is SQL. An intermediate step is plainly not going to make it go any faster. Perhaps what you need to do is not try to populate all 3000+ rows at once, what if you show the first page full, and, assuming you can't use paging, just populate with the rest, allowing the user to see the first page while it loads, or something similar to that ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Well,
I see what you are saying now.. using a Dataset with a SqlDataAdapter isn't going to make much difference at all vs. a SqlDataReader right? It works fast and great at work since it is on the network but I was wondering if there was a better way...
Since it is an inventory I could make it not load the information.... you know now that I think about it, I have it grouped in the ListView by the type of equipment. I could put a listbox with checkboxes in it on what items to show. So it doesn't load anything onLoad unless the user clicks a checkbox... i think that might be the best way! Thanks!
|
|
|
|
|
Jacob Dixon wrote: using a Dataset with a SqlDataAdapter isn't going to make much difference at all vs. a SqlDataReader right?
It will be worse if you load everything in to the data set first then have the DataAdapter have to convert that in to SQL for the database. Just put it directly in SQL and miss out the middle bit. (As Christian suggested)
|
|
|
|
|
I'm reading from the database and putting into a listview. Not writing to a database. It has to be loaded into something like a datareader or dataset. Last I knew a listview can't read from a database itself
|
|
|
|
|
Jacob Dixon wrote: I'm reading from the database and putting into a listview. Not writing to a database.
Okay...
Jacob Dixon wrote: It has to be loaded into something like a datareader or dataset.
The DataAdapter uses a DataReader. It is simply another level of abstraction. If you want performance then you remove the layers of abstraction. This improves the performance but makes your application more difficult to maintain.
I'm wondering if what you really want is reponsiveness rather than raw response time? Responsiveness is how quickly the user can get on with what they are doing. Response time, on the other hand, is how quickly the operation as a whole takes to complete. Often you can trade a little response time for increase responsiveness. From the users point of view it appears to work faster when in fact it is slightly slower.
|
|
|
|
|
Well, remotely there is a pause when loading 3000 lines... maybe... 20-40 second pause... I think making it not load any items and displaying a list of EquipmentTypes in a checkbox listbox would be better. That way they can check the type of equipment they want (multiple) and it will display it in the listview. They could select multiple ones that list multiple EquipmentTypes in the listview (by Groups). I was just trying to make the pause (or waiting) the user has down to a minimal. But I know data over the internet is something that just can't be fixed by programming sometimes.
|
|
|
|
|
I am trying write a TCP client that connects to a server and requests HTTP packets using the Socket class. The problem I'm having is when I receive a HTTP return code of 400 (Bad Request), the server disconnects me and I have to close my connection as well. Once I close my connection, the Socket class won't let me start another TCP handshake, let alone send any more packets.
Here is my code for the connection:
;
Socket socket;
IPEndPoint hostEndPoint;
string packet;
public void run()
{
TCPConnect();
packet = SendReceive("/signin.aspx", "GET");
if (GetReturnCode(packet) == "400")
TCPReset();
packet = SendReceive("/index.html", "GET");
TCPClose();
}
private void TCPConnect()
{
if (socket == null)
{
socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
hostEndPoint = new IPEndPoint(ipaddr, port);
}
socket.Connect(hostEndPoint);
}
private void TCPReset()
{
socket.Disconnect(true);
socket.Connect(hostEndPoint);
}
private void TCPClose()
{
socket.Shutdown(SocketShutdown.Both);
socket.Close();
}
private string SendReceive(string strURI, strMethod)
{
string pcAppend = " HTTP/1.1\r\nConnection: Keep-Alive\r\n\Content-Length: 0\r\n" +
"User-Agent: Mozilla/4.0 (Compatible; MSIE 7.0; Windows NT 5.2; .NET CLR " +
"2.0.50727; .NET CLR 3.0.04506.30; InfoPath.1; .NET CLR 3.5.21022)\r\n" +
"Content-Type: application/x-www-form-urlencoded\r\nHost: " + strIPAddress + "\r\n\r\n";
byte[] pcSend = System.Text.ASCIIEncoding.ASCII.GetBytes(strMethod + strURI + pcAppend);
byte[] bfBuffer = new byte[10240];
socket.Send(pcSend, pcSend.Length, 0);
socket.Receive(bfBuffer, bfBuffer.Length, SocketFlags.None);
return System.Text.ASCIIEncoding.ASCII.GetString(bfBuffer);
} ;
I've been monitoring the commuications with Ethereal. .Net is closing the connection just fine, but it ignores any socket.Connect() calls after the initial connection.
Any ideas?
|
|
|
|
|
It has been a while since I've used sockets (I usually go for the HttpWebRequest/HttpWebResponse classes these days) so this is a bit of a guess based on some hazy memories. It's worth a try, at least.
When you open the socket for the second time you are openning a connection on the existing socket that was shut down. You may need to open a brand new socket in that case. In which case when you shutdown the old socket you might want to set socket=null; to force a new socket to be created when a new connection is requested.
|
|
|
|
|
That worked! Thanks a million
|
|
|
|
|
socket.Disconnect(true); works only on windows XP. You should try to dispose the socket every time and then create a new one.
Natza Mitzi
|
|
|
|