|
I cannot say whether there is an "event" way of solving this. But what you can do is you can spawn a separate thread from your application, which will periodically call Process.GetProcessesByName() method, and you can pass in the process name for Microsoft Word (or any other process you want to wait on). Definitely if you receive an "event" that would be less complicated, but I doubt whether that is at all possible. No application will let you know that it has started - YOU have to find that out!
Koushik Biswas
|
|
|
|
|
Good day ladies and gentlemen.
I am writing an app that runs on a thin client hardward platform (written in C#). The app is denied access to the priamry drive on the server to which I have no control. I do have control to the "My Documents" folder.
I am seeking knowledge on locating the "My Documents" folder by code so that I may serialize/deserialize data to it.
All suggstions are deelpy appreciated.
"We succeed in enterprises which demand the positive qualities we possess, but we excel in those which can also make use of our defects."
Have a great coding day.
Regards,
Tony D. Abel
|
|
|
|
|
|
You are looking for Environment.GetFolderPath()[^]
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
If you serialize/deserialize data for the purpose of your application, you should think about putting it into the user's application data directory whose path you can get by Environment.GetFolderPath( Environment.SpecialFolder.ApplicationData ) .
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
I use a panel to simulate a scollbar put when i move it, just flicker.
How can i avoid this?
|
|
|
|
|
Use double buffering. There are several articles on this site and on the web relating how to do this.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Little House on the Flickr
Judah Himango
|
|
|
|
|
I am quite a novice at C# and have been making regular contributions to this board as a result. I was just wondering if there was a function to find a number in a string? Any help will be appreciated!
|
|
|
|
|
use the
\d+ regular expression.
<edit;Modified as per Leppie remark. Tx.</edit>
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
-- modified at 10:34 Wednesday 11th January, 2006
|
|
|
|
|
Thanks for the response. I however am not really familiar how Regex works. So how would I use that?
|
|
|
|
|
See the other answer. It is not complete, but MSDN has a topic explaining how to use the classes from the System.Text.RegularExpressions namespace.
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
|
Tx, I corrected it. I am a little rusty on regex
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
There are lots of ways, depends on what you want to do with the number.
#1
mystring.IndexOf(string.Format("{0}", number)); will return -1 if the number is not found, a valid index otherwise
#2
MatchCollection matches = Regex.Matches(mystring, @"\d+", RegexOptions.Compiled) will search the string for all occurences of any digits
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
With regards to your second approach how does one access the matches. I have tried reading about them on the MSDN but cant see any way to access the contents. Any help would be appreciated!
Greeeg wrote: #2
MatchCollection matches = Regex.Matches(mystring, @"\d+", RegexOptions.Compiled) will search the string for all occurences of any digits
|
|
|
|
|
foreach (Match m in matches)
{
Console.WriteLine(m.Value);
}
This will loop through all matches found. It is saved as a string, you will need to convert to an integer by yourself using int.Parse(m.Value);
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
How to communicate between two worker threads in C#
Pls reply if u know the answer
|
|
|
|
|
Events (AutoResetEvent, ManualResetEvent) and shared variables (locked as needed)
|
|
|
|
|
Butthe problem in that is that the function would be executedon the behalf of worker thread,u getting me,I want after the worker thread ghas completed his job,it shouls inform another worker thread to do his job
|
|
|
|
|
I understand what you want, but I do not see what additional information you need.
Create a variable (or queue to handle multiple request serially) protected by locks (or using a syncronized queue).
Thread 1 does whatever it needs, then insert the "task" in the variable or queue. Once it is inserted it sets the event.
Thread 2 simply waits for the event to be raized. Once raized it takes the work object and do whatever it needs to do. For a queue, keep looping until all data is done, then wait for the event. For the variable you might need an extra event from thread 2 to inform thread 1 that it can override the variable - all in all the queue is simpler.
Obviously you have to be careful with timing.
|
|
|
|
|
Well,probably i did not make myself clear
Ss I don't want my main thread to stop processing or wait for it,See what i want is the functionaliyu available in GUi threads (PInvoke) in a console based applications
That when the worker thread completes it informs other thread A ,and call a function of A on the behalf of A,not its own
|
|
|
|
|
Hi,
I am new to XML and C#. I want to load this XML via the below code to an XmlDocument but it returns an Error which I don't know how to handle it. Here is the XML:
<?xml version="1.0" encoding="UTF-8"?>
<epp xmlns="urn:iana:xml:ns:epp-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:iana:xml:ns:epp-1.0 epp-1.0.xsd">
<response>
<result code="1000">
<msg lang="en-US">Command completed successfully</msg>
</result>
<resData>
<contact:creData>
<contact:id>Epp1464</contact:id>
</contact:creData>
</resData>
<trID>
<clTRID>CrtContact0031</clTRID>
<svTRID>CrtContact0031-OLNIC-SRV</svTRID>
</trID>
<chksum>979170f7c148e945e352c7d155da8ac2</chksum>
</response>
</epp>
And here is my code. Actually I need also to know how to get the <contact:id> and <result> node bvalue and attribue.
try
{
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(strXMLSrc);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
Please help.
Samy
-- modified at 8:35 Wednesday 11th January, 2006
|
|
|
|
|
Please always include the error - saves the rest of us from running it so see the problem.
You are missing a namespace decleration for "contact".
If you do not know how XML namespaces work, you can for example look here:
http://www.w3schools.com/xml/xml_namespaces.asp[^]
|
|
|
|
|
Hi,
I am so sorry. Here si the error.
'contact' is an undeclared namespace. Line 8, position 2.
As It shows the namespace is not defined.
But the XML is generated by a server and I can't change the strcuture. Therefore How can I bypass this error checking.
Regards,
Samy
|
|
|
|
|
What's the error message?
|
|
|
|