|
What do you mean with the sentence
<br />
And also dispose the returned processes!<br />
What shall I do?
|
|
|
|
|
Hello,
foreach (Process newProcess in newProcesses)<br />
{<br />
newProcess.Dispose();
}
All the best,
Martin
|
|
|
|
|
I rewrote action on the button to this:
Notepad button has the same functionality.
<br />
private void btnGvim_Click(object sender, EventArgs e)<br />
{<br />
Process[] p = Process.GetProcessesByName("gvim");<br />
int number1 = (int)p[0].MainWindowHandle;<br />
if (p[0].MainWindowHandle != IntPtr.Zero)<br />
{<br />
ShowWindow(number1, SW_SHOWNORMAL);<br />
}<br />
p = Process.GetProcessesByName("notepad");<br />
number1 = (int)p[0].MainWindowHandle;<br />
if (p[0].MainWindowHandle != IntPtr.Zero)<br />
{<br />
ShowWindow(number1, SW_SHOWMINIMIZED);<br />
}<br />
}<br />
Unfortunatelly it is not the same or similar behavior as ALT+TAB.
Do you know where I have been made mistake?
regards
Petr
|
|
|
|
|
Hello,
I would do something like this:
private void btnGvim_Click(object sender, EventArgs e)
{
Process[] allProcesses= Process.GetProcessesByName("gvim");
if(allProcesses.Length>0)
{
if (allProcesses[0].MainWindowHandle != IntPtr.Zero)
{
ShowWindow(allProcesses[0].MainWindowHandle, SW_SHOWNORMAL);
}
}
DisposeProcesses(allProcesses);
allProcesses= Process.GetProcessesByName("notepad");
if(allProcesses.Length>0)
{
if (allProcesses[0].MainWindowHandle != IntPtr.Zero)
{
ShowWindow(allProcesses[0].MainWindowHandle, SW_SHOWMINIMIZED);
}
}
DisposeProcesses(allProcesses);
}
public static void DisposeProcesses(Process[] processes)
{
if(processes!=null)
{
if(processes.Length>0)
{
foreach(Process p in processes)
{
p.Dispose();
}
}
}
}
If you later want to get the actual status of a process, look at the "IsIconic" method.
[System.Runtime.InteropServices.DllImport("user32.dll")]
[return: System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Bool)]
private static extern bool IsIconic(IntPtr hWnd);
All the best,
Martin
|
|
|
|
|
|
Hello Giorgi,
thanks for the additional information!
All the best,
Martin
|
|
|
|
|
You are welcome
|
|
|
|
|
public delegate int AddDelegate(int a, int b);
Private int AddMe(int a, int b);
AddDelegate add = new Add(AddMe);
Now I can call the AddMe() method by just doing
add(1, 2);
shouldn't i simply call the
AddMe(1,2);
what's the need to use the delegate.
i thnk it is merely a incease in line of code.
Soniagupta1@yahoo.co.in
Yahoo Messenger Id = soniagupta1
|
|
|
|
|
I guess that's because you didn't bother to read the explanation you got the other times you asked this, nor did you bother to google it. Like many constructs, you can write useless delegate code, and there are times when you can't get by without delegates.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
|
?????
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Search The F**** Web.
Very similar to JFGI[^]
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Never seen it before, but it's not hard to figure out...
Search The F-ing Webb
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
string message = "Hello world.";
Console.WriteLine(message);
can just as well be written:
Console.WriteLine("Hello world.");
Therefore, variables are useless and only increase the code volume.
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
before my environment vs2005 C#.net and make web project now.
while i was mad my code, i need to take some arraylist array.
for example...
defind arraylist array under the partial class
------------------------------------------------
public ArrayList[,] arFood = new ArrayList[4, 2];
and i use my button click event
------------------------------------------------
arFood[iMeal, 0].Add(CommonLib.IsNullString(myListItem.Value));
but while i was compiled source printed out error message.
"System.NullReferenceException" ..
so i was debug trace but myListItem.Value was not empty ..
so my opinion, that's not initialize arraylist array.
how can i initalize my arraylist array? or it's wrong code ?
thanks for read my question...
.. knodark
|
|
|
|
|
if (arFood[iMeal,0] == null) arFood[iMeal, 0] = new ArrayList()
Why would you use an array list and not a generic list ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
|
Maybe because he is using .Net < 2.0!
Ahh, sorry I forgot I'm the only one who is doing that!
All the best,
Martin
|
|
|
|
|
Hi,
I have implemented compare method to return 0 if objects are equal based on sort criteria.
Say i have 2 objects with name,age,date as fields. I pass two objects for sorting obj A and obj B and sort on date. In both cases date is null. The sequence of objects in container being passed is obj A first and than obj B. After sorting on date sequence changes and become obj B and obj A. I wish to have sequence as obj A and obj B in this case. Is it feasible?
|
|
|
|
|
The sorting algorithm used in the built in sorting methods doesn't preserve the order of items that are equal. If you want that, you have to implement the sorting yourself, using an algorithm that does.
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
Do you have any implementation with you
|
|
|
|
|
The QuickSort algorithm used is a so called "unstable sort". You want to search for a "stable sort".
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
can we use java script in windows application?
If so just brief me how to use
Thanks in advance
Praveen Kumar Palla
|
|
|
|
|
Hey Hey Hey!!!!
Java script means client side validations right...?
And Windows application always runs onto the client side
And .Net have many many validation controls for windows application.
Regards
Pankaj Joshi
|
|
|
|
|
Thanks for the reply Pankaj
My requirement is
the textbox should have validation routine that should be defined in external to the application. If anytime any change in the validation routine need not be compile and build the application.
how can i achieve this?
please help me on this.
Ex: validation is
textbox should accept positive integers including 0
praveen Kumar Palla
|
|
|
|