|
I think about creating bitmap from Graphics, use SetPixel and recreate Grahics object, but i can't while use Graphics object in OnPaint event...
Ideal compilator compiling comments without code...
|
|
|
|
|
Hi
I want to add a row with the value in the first and only column to be "oo", tried:
DataGridViewRow rw = new DataGridViewRow();<br />
....<br />
rw.SetValues("oo");<br />
dataGridView1.Rows.Add(rw);
This doesn't seem to work. What've I done wrong?
cheers
|
|
|
|
|
Your DataGridViewRow has no idea where to put "oo". You need to set the row schema from the DataGridView to which you intend to add the row. If you've defined your single column in your DataGridView definition, then it's cake:
DataGridViewRow rw = new DataGridViewRow();
....
rw.CreateCells(dataGridView1);
rw.SetValues("oo");
dataGridView1.Rows.Add(rw);
--
I've killed again, haven't I?
|
|
|
|
|
|
hi,
I am developing a Network Authentication Server, and I am using RAW Sockets to transmit packets to the internet.The receiving side works fine, but I get a "A blocking operation was interrupted by a call to WSACancelBlockingCall" ONLY when I try to send packets using TCP. Apparently this is due to the Windows update MS05-019 which disables the use of Raw Sockets.
I have tried the xpsp2tcpipfix.exe which modified the tcpip.sys...invain.
Then I tried to disable the SharedAccess service...still invain.
Apparently both of the above work fine for SP2 but not for MS05-019.
My alternate solutions would be either to
- reinstall windows without service packs (i need to confirm this will not be a waste of time)
- install an ethernet adsl modem (currently usb),-requires time & money :S
- find a way to uninstall MS05-019
I would apreciate any other solution, help, advice/clues on my options or any knowledge from anyone that has encountered this problem before or anybody that has ANY idea.
kind regards,
Dave
|
|
|
|
|
Sorry, I'm being a bit thick and lazy can you clarify what you mean by RAW?
Ed
|
|
|
|
|
RAW means that i am generating the whole IP packet from scratch, including both the IP header, and the TCP header.
This is done using
socket = new Socket(AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.IP);
socket.Connect(new IPEndPoint(IPAddress.None, 0));
socket.SetSocketOption(SocketOptionLevel.IP,SocketOptionName.HeaderIncluded,1);
and sending the whole packet stored in a buffer 'byte[] tmp', which contains source ip, destip, checksum...etc...in other words all the headers.
socket.Send(tmp);
As I mentioned before, the whole thing works fine for any packet, coz I checked them out with Ethereal. However when I change the protocol field in the IP header to 6, standing for TCP, I get the afore mentioned error, probably due to the XP update disabling raw packets.
thanks for your reply, not lazy at all;)
regards
dave
|
|
|
|
|
Just trying to get more background here but:
Do you have to use raw sockets? Don't the wrapper's provided by the .NET Framework do what you want?
Ed
|
|
|
|
|
Strictly speaking yes, I can simplyfy things and open a TCP client using .Net, howvever I was planning to implement my project with another final year project at a later stage, concerning TCP congestion control algorithims. This requires read and write access to the whole TCP layer, including the header.
So IDEALLY I stick to raw, but if nothing pops up I will have to do without.
Thanks m8
regards
Dav
|
|
|
|
|
Ok things are beginning to get clearer in my head now. Is WSACancelBlockingCall called by you or (as it appears) is fired from another program, i.e. this MS-9015 (wrong number I thing) thingy.
My first suggestion would be to if possible isolate the area of the network you're concerned with (i.e. don't connect it to the internet just have ideally two computers (or one with using the loopback interface) on the network. Then try the code while turning off all the network systems, i.e. firewalls, antivirus etc until you get to the one which is hopefully causing the problem. Once this has been established then we can delve further for a work-around.
Ed
|
|
|
|
|
Im not sending any WSACancelBlockingCall, so I assume this is due the update, at least this site lead me to think so: "http://www.microsoft.com/technet/prodtechnol/winxppro/maintain/sp2netwk.mspx#".
Good idea though, I will experiment Raw Sockets on my lan. Luckily I already got over the lan side by using an NDIS driver..and succesfully sent and received TCP over IP over Ethernet, and all other protocols. As regards firewalls and antivirus, I never had any of those.
|
|
|
|
|
|
So when you say you change the header to 6 representing TCP do you mean you do that to every packet or only TCP packets? You cannot change a UDP or most other packets to TCP. Make sure that isn't the case.
|
|
|
|
|
Im refering to the protocol field in the IP header. These are represented as
- 0: Reserved
- 1: Internet Control Message Protocol (ICMP)
- 2: Internet Group Management Protocol (IGMP)
- 3: Gateway-to-Gateway Protocol (GGP)
- 4: IP (IP encapsulation)
- 5: Stream
- 6: Transmission Control Protocol (TCP)
- 8: Exterior Gateway Protocol (EGP)
- 9: Private Interior Routing Protocol
- 17: User Datagram Protocol (UDP)
- 41: IP Version 6 (IPv6)
- 50: Encap Security Payload for IPv6 (ESP)
- 51: Authentication Header for IPv6 (AH)
- 89: Open Shortest Path First
I change it to 6 when the TCP layer contains TCP data, and this is correct as I am forwarding it directly from another user, and shows up correctly on Ethereal. As I mentioned before the problem is probably due to the Windows Update as seen on "http://www.microsoft.com/technet/prodtechnol/winxppro/maintain/sp2netwk.mspx#E5AAE"
Thanks,
Regards
Dav
|
|
|
|
|
Hello,
How do you get the filesize of an image (or images included in a web page), preferably using a WebBrowser control?
Thanks.
dan215
|
|
|
|
|
If you can get a reference to the Element which represents the image then I think you might be able to get it by using a method named something like GetAttributeValue (sorry I can't remember it exactly of the top of my head), if you call this with "width" and "height" as parameters I think you can get the height and width of the image (not the original image size but the size of the displayed image on the page).
Ed
|
|
|
|
|
Hi Ed,
Thanks for the quick reply.
You are correct: use the HtmlElement class and GetAttribute() method to get the image size with width & height as parameters. However I was referring to the "file" size (in bytes) of the image file. I know IE stores the webpage files in "Temporary Internet Files" folder as local cache but somehow programmatically it (OS?) does not allow the files to be read. However you can manually see these files using Windows Explorer.
Any thoughts?
Thanks.
dan215
|
|
|
|
|
How about:
string uri = @"the image filename here";
WebRequest request = WebRequest.Create(uri);
WebResponse response = request.GetResponse();
Console.WriteLine("Content.Length={0}", response.ContentLength);
You can use HtmlElement.GetAttribute("src") to get the path to the image. I shouldn't think that this re-downloads the file but you never know.
[mod]It doesn't unless my 512k line just downloaded 650 meg in 1/2 a sec [/mod]
Ed
-- modified at 19:31 Monday 17th April, 2006
|
|
|
|
|
Unfortunately, response.ContentLength only gives you the "HTML text" size. It does not include the image(s).
dan215
|
|
|
|
|
If you pass the image file URI which you want to get the size of then it will. I tested this on a PDF hosted on our website.
Ed
|
|
|
|
|
Hi Ed,
Thanks. You are correct. My dilemma is I'm using WebBrowser control first to navigate to the webpage to get all the images names via HtmlDocument/HtmlElement classes. If I use WebRequest/WebResponse, I'm essentially doing two requests from the server. I'm thinking if there a way to just do these things once. I don't have to use WebBrowser control but it helps in easily parsing the desired attributes.
Appreciate your help. Things are looking up!
dan215
BTW: I tried accessing a local image and I got a "401" not authorized error message.
-- modified at 13:51 Tuesday 18th April, 2006
|
|
|
|
|
dan215 wrote:
BTW: I tried accessing a local image and I got a "401" not authorized error message.
Is this a problem or just a point you cared to share?
Glad to see things are sorting themselves out.
Ed
|
|
|
|
|
Well, it was a problem but I got it fixed by changing the Authentication Method of my localhost webpage from Integrated Windows Authentication to Anonymous Access just for testing purposes.
I haven't figured out yet how to get the byte size in 1 request but 2 requests is ok for now.
Thanks a lot Ed.
dan215
|
|
|
|
|
Unless you already know the uri of the image/file you want to get the size of you cannot make it in one request because you have to have one to find the location of the file (i.e. a request to the html file to find the image path) and then a request to the image file for the file size.
Ed
|
|
|
|
|
I agree. Another way I thought I could do was to read the image file info from the Temporary Internet Files folder but I can't use the FileInfo class since XP does not seem to allow any file in that directory be read except desktop.ini. If I can circumvent this that would resolve the issue.
Any ideas?
dan215
|
|
|
|