|
Sorry !!!
Can I have sample code for that??
|
|
|
|
|
dokhinahaoa wrote: Can I have sample code for that??
You'd best start here[^], samples can be obtained here[^].
Basically, you transform an object into XML (or binary), send it, and rebuild the class on the receiving end. Something like this;
"Class X -> becomes XML -> gets send -> gets received -> receiver makes class from XML" Enjoy
I are Troll
|
|
|
|
|
Hi all
I would like to use Trace class or TraceListener to make code tracing in each thread at a different indendation level.
Function #1 From Thread#1
Function #2 From Thread#1
Function #1 From Thread#2
Function #3 From Thread#1
Function #2 From Thread#2
Function #3 From Thread#2
Most of Trace methods are shared so setting Trace.IndentLevel changes this value for all threads.
If I use 2 different objects for the same TraceListener, like for example ConsoleOutputTraceListener , there is no Thread safety guaranteed ( check IsThreadSafe for each object ).
Do you know some general approach to solve this issue?
Do I have to implement my own logger?
Kind Regards
Mn
|
|
|
|
|
One suggestion is to create a thread-safe singleton class.
As you create a thread you should register it with the singleton, which assigns it an indentation level.
Any trace statements should be made through a method on the singleton class, which can then resolve the indentation level.
When the thread ends, it is important to de-register it from the singleton.
CCC solved so far: 2 (including a Hard One!)
|
|
|
|
|
Hello I want to open an exe file within a form of my Application .How can I do this?
if the file was not sizable what shoud i do?
thank you
tahereh sadeghi
|
|
|
|
|
|
Try the following....
Process MyProcess = Process.Start("myApp.exe", strApplicationPath);
Starts a process resource and associates it with a Process component.
For more detail can be found at this
link...
Thanks
Md. Marufuzzaman
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
|
|
|
|
|
You need to use Process Class.
Below is the sample code which is used to open a notepad.
using System;
using System.Diagnostics;
class ProcessStartDemo
{
static void Main(string[] args)
{
Process pr = new Process();
pr.StartInfo.FileName = "notepad.exe";
pr.StartInfo.Arguments = "Sample.text";
pr.Start();
}
}
|
|
|
|
|
Hi, I'm trying to get the IP, subnet and gateway for my interfaces using IPInterfaceProperties but both UnicastAddresses and GatewayAddresses returns a collection...
How do I know which one to use?
Here is my loop and for now I'm just using UnicastAddresses[0] and GatewayAddresses[0] but that isn't always right
internal static NetworkAdapter[] AddExtraInformation(ArrayList adapters)
{
NetworkInterface[] networkInterfaces = NetworkInterface.GetAllNetworkInterfaces();
foreach (NetworkAdapter adapter in adapters)
{
foreach (NetworkInterface networkInterface in networkInterfaces)
{
if (!DescriptionToName(networkInterface.Description).Equals(adapter.DeviceName))
continue;
adapter.Name = networkInterface.Name;
adapter.OperationalStatus = networkInterface.OperationalStatus.ToString();
IPInterfaceProperties ipProperties = networkInterface.GetIPProperties();
if (ipProperties.UnicastAddresses != null)
if (ipProperties.UnicastAddresses.Count > 0)
{
adapter.Address = ipProperties.UnicastAddresses[0].Address.ToString();
adapter.SubnetMask = ipProperties.UnicastAddresses[0].IPv4Mask.ToString();
}
if (ipProperties.GatewayAddresses != null)
if (ipProperties.GatewayAddresses.Count > 0)
adapter.Gateway = ipProperties.GatewayAddresses[0].Address.ToString();
break;
}
}
return (NetworkAdapter[])adapters.ToArray(typeof(NetworkAdapter));
}
|
|
|
|
|
string hostName = Dns.GetHostName();
IPHostEntry ipEntry = Dns.GetHostEntry(hostName);
foreach (IPAddress ip in ipEntry.AddressList)
{
//Please check ip values
}
For example, if you want to get IPv4 value, use "ip" variable which is using foreach statement;
if (ip.AddressFamily.Equals(System.Net.Sockets.AddressFamily.InterNetwork))
string result = ip.ToString();
Best Regard...
|
|
|
|
|
Thanks for your reply
I'm not sure how to tell which nic has the ip-number that I get from using your code.
Anyway, I changed my code to this, looping the addresses and checking for IsDnsEligible, that seems to do the trick or am I missing something?
foreach (UnicastIPAddressInformation address in ipProperties.UnicastAddresses)
{
if(address.IsDnsEligible)
{
adapter.Address = address.Address.ToString();
adapter.SubnetMask = address.IPv4Mask.ToString();
break;
}
}
|
|
|
|
|
hi,
i want dll to change the pitch of the sound in my Music player project..
can any one help me plz...
i googled it but m no dll is working properly in my program..
|
|
|
|
|
Hello,
i've got a custom UserControl (UserControl-Class with a panel in it) and now i want to let it interact as a container in the Designer. Well - on the web I found a lot of tutorials for this problem, but my problem is, that the designer doesn't put the Controls i add to my control to the panel. It put them into the UserControl itself.
So how can i tell the designer, that it should use "panel" as it's container and not the UserControl itself? I've tried different thinks like make a own class which extends "System.Windows.Form.Panel" and tell them, that it is the Container for the designer and puttet it into my UserControl but all those things doesn't work...
Thanks for your help
|
|
|
|
|
You should have searched on CodeProject.
Take a look at Designing Nested Controls[^] by Yours Truly.
Hope this helps!
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'm having alittle trouble with the SOCKS5 protocol. Maybe someone here can help.
http://www.rfc-editor.org/rfc/rfc1928.txt
the initial request consist of 3 bytes
request[0] = 0x05;
request[1] = 0x01;
request[2] = 0x00;
the response contains 2 bytes
response[0] == 0x05;
response[1] == 0x00;
the next request is 10 bytes
request[0] = 0x05;
request[1] = 0x03;
request[2] = 0x00;
request[3] = 0x01;
(destination IP).GetAddressBytes().CopyTo(request, 4);
int byte1 = (destination Port) / 256;
int byte2 = (destination Port) % 256;
request[8] = (byte)byte1;
request[9] = (byte)byte2;
now this is where im having trouble. with the next response. the first 4 bytes are fine
response[0] == 0x05;
response[1] == 0x00;
response[2] == 0x00;
response[3] == 0x01;
but with the next 4 bytes its supposed to return an IP address to which im supposed to send udp data to. the bound address, but it returns an ip of 0.0.0.0. then the next two bytes are fine which is the bound port to send the udp data to. now why would it be returning a null ip? am I just suppsoed to use the proxy IP when it comes to UDP?
modified on Sunday, October 11, 2009 4:11 AM
|
|
|
|
|
|
I working on application in which i need to log urls browsed in internet explorer. For this up till now i am using low level key hook to trigger application to copy address bar content i.e. user have to press 'c' to log the url.
But i need to automate this part such that when ever there is change in url at address bar, trigger is generated to copy it to log file.I need some pointer for this task.
language preference is c# as i need to integrate it in latter dev stage.
|
|
|
|
|
I'm trying to get my PropertyGrid to refresh when the control in the designer has finished resizing, i'm not exactly sure on how to do this. Is there a way to get it to update on a value change as i'd rather not have to pass a reference of the property grid to the control being resized in order to refresh the values.
I'm not sure if i explained that to well
|
|
|
|
|
Most controls hanve a OnResize event, if not you will need to search the event list and choose one. Either refresh the property grid in that event or have the property grid subscribe to the controls event.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
To clarify things. Is the PropertyGrid you talk about the one in the Visual Studio IDE, or one you have put on your form?
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.”
|
|
|
|
|
How can I make it stop doing that?
I've been googling for hours, but they always say there is no solution.
Manually playing with GetFocus and SetFocus didn't even work, but it could be that I did something wrong there
|
|
|
|
|
This may sound like a silly question, but what is your tab order?
The lowest number control gets the focus on form load - I just tried it with a label, textbox, webbrowser and button, created in that order and the textbox got the focus as I expected.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Oh it's much worse than that, it doesn't even steal the "local focus" but it causes the entire window to steal focus (even though I disabled focus stealing with the TweakUI!)
|
|
|
|
|
Oo! Thats nasty!
Have you tried any of the webbrowser replacement controls?
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Ah no, I couldn't find any
Are there any you would recommend?
|
|
|
|