|
Thanks for that. I only just realized, my brain no work properly this morning lol
Regards,
Jason Pezzimenti.
If you liked the answer that I have provided, then please click the 'Good Answer' link on the bottom-right of this post. Thank you.
|
|
|
|
|
My application is a windows service. it doesn't have any icon. I am closing another application which has an icon. This application doesn't provide any interface to restart it so i find its processes in task manager, save it exe path from there and then kill the processes. The path is used to start the service again if needed.
When i kill the process, its icon remains and disappears only when i move mouse over it.
|
|
|
|
|
Sorry for my misunderstanding in my previous post. It sounds like that article Xmen gave you would be the way to go. I hope it works out well.
Regards,
Jason Pezzimenti.
If you liked the answer that I have provided, then please click the 'Good Answer' link on the bottom-right of this post. Thank you.
|
|
|
|
|
|
Of course it works, how dare you doubt that?
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
That's a great article by the way
Regards,
Jason Pezzimenti.
|
|
|
|
|
Thanks. I wanted the problem solved at that time, and no solution seemed to be available, so...
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
mark_me wrote: its icon remains and disappears only when i move mouse over it.
I wonder if it is an XP thing, I have something at work (put in place by those IT Gods who maintain our infrastructure) that creates the task manager icon at start up, it disappears if I do this.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi,
Such exit code doesn't get executed when you kill a process. That is not the solution. Read the article that was mentioned, it works!
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
thanks and great article !!!
Thanx alot
|
|
|
|
|
You're welcome.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
How to implement paint brush in c# using mouseevent?
Neelam Verma
|
|
|
|
|
http://www.codeproject.com/KB/miscctrl/Painbrush_Color_Picker.aspx
|
|
|
|
|
The answer to this depends entirely on what you mean by paint brush and by using mouseevent.
Can you explain a little more clearly?
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.”
|
|
|
|
|
Hi,
theré's all kinds of brushes. This little article[^] shows what a gradient brush can do for you; but maybe all you want is a SolidBrush?
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Hi,
I created a proxy that listens on a port for a requests, and then redirects them to a server. For that I created a listening socket, and a client socket that streams the data.
The problem is that the server is using Authentication (for instance NTLM, or digest) and I need to authenticate the request.
I know that I can do it in a webrequest, using CredentialCache object; something like this:
CredentialCache credCache = new CredentialCache();
if ((auth & (uint)EAuthenticationFlags.eWindows) != 0) {
credCache.Add(URL, "Negotiate", (NetworkCredential) CredentialCache.DefaultCredentials);}
webRequest.Credentials = credCache;
However, I am unsure how to do it if all I have in my hand is a socket and a stream of data. Something like this:
ClientSocket.BeginReceive(Buffer, 0, Buffer.Length, SocketFlags.None, new AsyncCallback(this.OnClientReceive), ClientSocket);
DestinationSocket.BeginReceive(RemoteBuffer, 0, RemoteBuffer.Length, SocketFlags.None, new AsyncCallback(this.OnRemoteReceive), DestinationSocket);
And the code for the callbacks [b]OnClientReceive[/b] and [b]OnRemoteReceive[/b]:
protected void OnClientReceive(IAsyncResult ar)
{
try
{
int Ret = ClientSocket.EndReceive(ar);
if (Ret <= 0)
{
Dispose();
return;
}
DestinationSocket.BeginSend(Buffer, 0, Ret, SocketFlags.None, new AsyncCallback(this.OnRemoteSent), DestinationSocket);
}
catch
{
Dispose();
}
}
protected void OnRemoteReceive(IAsyncResult ar)
{
try
{
int Ret = DestinationSocket.EndReceive(ar);
if (Ret <= 0)
{
Dispose();
return;
}
ClientSocket.BeginSend(RemoteBuffer, 0, Ret, SocketFlags.None, new AsyncCallback(this.OnClientSent), ClientSocket);
}
catch
{
Dispose();
}
}
Does anybody has any suggestions of where the authentication should take place and how? Can I append a credentials object somehow to the socket o or to the stream of data? or worst case scenario, can I just append the correct http headers?
Thanks in advance for your time,
cheers,
Jo
|
|
|
|
|
List < string > lst = new List < string > ();
lst.Add("FirstValue");
lst.Add("SecondValue");
lst.Add("ThirdValue");
lst.Add("FourthValue");
Dictionary < string , int > dic = new Dictionary < string , int > ();
dic = lst.ToDictionary < string , int > ( ???? )
|
|
|
|
|
If you say why you want to do this and what the int value represents, it would be easier to advise you,
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.”
|
|
|
|
|
int is value of repeated string.
suppose lst.Add("this");
lst.Add("this");
Console.Write(dic["this"]) // will be 2 because of repeatation of "this".
|
|
|
|
|
this is known that same Key will throw exception but when key is repeated int is incremented and key will not register ( as it will throw exception)
|
|
|
|
|
try this:
public partial class ListToDictionaryTestForm : Form
{
List<string> testList = new List<string>();
public ListToDictionaryTestForm()
{
InitializeComponent();
testList.Add("one");
testList.Add("One");
testList.Add("two");
testList.Add("three");
testList.Add("one");
testList.Add("three");
testList.Add("one");
OutputResults(testList);
}
private void OutputResults(List<string> testList)
{
var itemcounts = from s in testList
group s by s into g
select new
{
key = g.Key,
val = g.Count()
};
Dictionary<string, int> results = itemcounts.ToDictionary(k => k.key, v => v.val);
foreach (KeyValuePair<string, int> kvp in results)
{
lboxResults.Items.Add(string.Format("{0} : {1}", kvp.Key, kvp.Value));
}
}
}
This is just a Form with a ListBox on it.
I've just realized that this can be abbreviated slightly:
private void OutputResults(List<string> testList)
{
Dictionary<string, int> results = (from s in testList
group s by s into g
select new
{
key = g.Key,
val = g.Count()
}).ToDictionary(k => k.key, v => v.val);
foreach (KeyValuePair<string, int> kvp in results)
{
lboxResults.Items.Add(string.Format("{0} : {1}", kvp.Key, kvp.Value));
}
}
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.”
modified on Friday, July 31, 2009 11:38 AM
|
|
|
|
|
However that doesn't satisfy the requirement "without using loop?"
you'll need stronger lambda magic, or an entirely different kind of Force!
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Hey! Play fair. It only uses the loop, at least explicitly, to demonstrate that it has worked.
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.”
|
|
|
|
|
as Dan points out below, there is a hidden loop in your magic, and as you said there is a visible one you don't need, so your solution actually contains two loops, that's way too much.
FWIW: The only way I see without loops is with recursion
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Luc Pattyn wrote: as Dan points out below, there is a hidden loop in your magic
That's why I explicitly said explicitly.
Luc Pattyn wrote: FWIW: The only way I see without loops is with recursion
Hadn't thought about that. You're probably correct, although isn't that a form of looping? In fact, isn't it a double loop? Once on the way through getting the results, and again whilst unwinding the recursion stack?
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.”
|
|
|
|