|
Member 3722261 wrote: what is the best implementation to start a new process at the end of the current one?
Did you find out what a process is?
What happens when you stop the current process?
I'll give you a hint: In the previous question, replace "stop" with "saw off" and "current process" with "branch you are sitting on".
Re-think what you are trying to do. Stopping a process (particularly the current one) is not a solution to your problem, it is a whole new world of pain all of it's own. Think about what you are trying to achieve, and how you would do it in the real world - ignore computers. If you want to read a different book, you don't start by burning down the library to get rid of the previous one, do you?
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
|
|
|
|
|
I guess I dont know much about process as you... but still!!!!!
Thanks for your help!
|
|
|
|
|
OriginalGriff,
I'm using close not Kill.
Close - Frees all the resources that are associated with this component.
so what is so wrong by opening a new process as the last action of current process. I dont think its like your library folk tale .
Thanks!
|
|
|
|
|
Kill is intended for non-gui processes, and for abnormal termination. See documentation[^]
Close[^] does much the same thing (normally after CloseMainWindow) but does not loose resources.
You still cannot close or kill your own process! You can restart it, but if you close or kill it it stops existing.
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
|
|
|
|
|
You can restart it, but if you close or kill it it stops existing. <br />
You will be amazed by the things you can do after calling currentProcess.close().
Check it out...
Thanks!
|
|
|
|
|
Hi,
I think System.Windows.Forms.Application.Restart() is what you are looking for. The docs explain the intended usage.
Alan.
|
|
|
|
|
Hi,
but I think that Application.Restart wont help me because my process has alot of static "junk" that I want to clear. that the reason I need to start a new process.
Am I right?
Thnaks!
|
|
|
|
|
Hi,
I've no idea what you mean by static junk. Please clarify.
Alan.
|
|
|
|
|
Hi,
Static members on some objects.
Static cntor
...
All static belong to the process so my Q is if all will initialize again?
Thnaks!
Ronen
|
|
|
|
|
Hi,
Yes, it would do that as it terminates the old process and starts a new instance.
Alan.
|
|
|
|
|
Hi,
Is it possible to call a function from an external DLL from C#.NET code. If needed I would use LoadLibrary and GetProcAddress. It would be better if it could be linked at Program Loading.
Regards
Bram van Kampen
|
|
|
|
|
|
Thanks, that is much help. What is not entirely clear is, Where does the C# app look for the DLL. On the Server, or on the Remote Machine. I would require it to look for it on the server. The DLL I have in mind produces a Datablock in a buffer provided by the C# code. The C# Code will not have an understanding of the contents, All it will have to do with it is to store it in an SQL Database held on the server.
Regards,
Bram van Kampen
|
|
|
|
|
You can try adding the path of the dll. I'm not totally sure if that works.
|
|
|
|
|
The sytem loader looks in the library paths of the machine where the C# code is running for the DLL. So if your code is running on the server the dll must also be on the server.
|
|
|
|
|
Hi,
I am using c#.net to create a windows application
in that i have a rich text box control
when ever the text comes to end in the rich text box
for every new line in that rich text box the first line becomes disappears
now what i need to do is i have to restrict the user
when ever the rich text box becomes full
please advice me how can i do this
Thanks
Anil Veeraghattapu
|
|
|
|
|
Maybe you just need to add a vertical scrollbar
|
|
|
|
|
I am not going to use the vertical scroll bar.
instead of that i have to redirect the user to the next rich text below
Thanks
Anil Veeraghattapu.
|
|
|
|
|
Dear All, I have an application which uses impersenation to login to remote machine in same domain.
It works very well in Windows XP, but it doesent works in Windows Server 2003.
here i have the code
void login(string username,string archieveUserpassword,string domain)
{
IntPtr accessToken = IntPtr.Zero;
if (LogonUser(username, domain, archieveUserpassword, LOGON_TYPE_INTERACTIVE, LOGON_TYPE_PROVIDER_DEFAULT, ref accessToken))
{
WindowsIdentity identity = new WindowsIdentity(accessToken);
WindowsImpersonationContext context = identity.Impersonate();
dir[]==Directory.GetDirectories(fullArchievePath);
MessageBox.Show(dir[0].ToString());
}
}
It works very well in Windows XP, Y not with Windows Server 2003?
Abdul Rahaman Hamidy
Database Developer
Kabul, Afghanistan
|
|
|
|
|
Where does it now work? any error messages?
|
|
|
|
|
well, if i use this code in my windows xp pc then i can login to with specific user name and password and then it messages the directory. The same code doesent work in windows server 2003. As i am not returning any error message from that. The login fails in remote server which means the method login returns false. I have bellow question.
Can we login with specific account to remote server while we are not in that dommain? if yes any suggestions or idea.
Abdul Rahaman Hamidy
Database Developer
Kabul, Afghanistan
|
|
|
|
|
It would still help if you can tell me what method is actually failing. I'll assume it is LogonUser and I'll also assume that it is PInvoking to the Win32 API. After it fails by returning false, you can find the error code by calling Marshal.GetLastWin32Error().
|
|
|
|
|
i am getting the error bellow
else
{
int error=Marshal.GetLastWin32Error();
MessageBox.Show("Failed To Login\nError Code:\t"+error);
}
well our win server 2k3 has two NIC
NIC A connected to IP 10
NIC B connected to IP 192
i recieved the error code: 1311
I then disabled NIC A because remote server has IP 192
now i am getting the following error code: 1789
Abdul Rahaman Hamidy
Database Developer
Kabul, Afghanistan
modified on Monday, September 7, 2009 1:01 AM
|
|
|
|
|
Well according to the documentation[^] 1311 is ERROR_NO_LOGON_SERVERS - There are currently no logon servers available to service the logon request. 1789 is ERROR_TRUSTED_RELATIONSHIP_FAILURE - The trust relationship between this workstation and the primary domain failed. Not sure how to fix it, but you may want to google ERROR_TRUSTED_RELATIONSHIP_FAILURE and see what you can come up with.
|
|
|
|
|
Hi,
I'm probably missing something really simple here, but i'm stuck.
Basically I have a listbox, which a user puts items into via a textbox and button, this works fine, the items go in.
Now, on exit the items save to a text file, this also works fine, ive checked all the items are contained in the text file. Now, when the user re-opens the application there is a button called load previous items, when i click this i have a streamreader reading the text document, also works fine, checked with a messagebox, and it saves it to the string
Now, I want the string to be saved into a array which is then put back into the textbox, the problem being, I dont know how to count the items in the string (each on a diffrent line) to put them into a array, and then after that I need a example of adding the array into my listbox.
Im guessing its something to do with the
listbox1.Addrange();
command.
Cheers,
Ben.
|
|
|
|