|
In UNIX, in order to have the program put itself in the background, it needs to fork a child process. True system daemons are double-forked. The first fork puts the program in the background, the second fork isolates itself from the current process group (e.g., a user's session). However, Windows has never supported the concept of fork(), so it would be surprising to see it in .NET.
It appears that Mono is closely following the .NET SDK to make sure that Mono (.NET) programs are cross-platform, but in case there is a concept of fork() within Mono, go with that. For a 100% pure .NET cross-platform program, I'd suggest you take a peek at System.Diagnostics.Process.
|
|
|
|
|
I need to find a smaller string of characters inside a larger string, but have no idea how to go about it. I know there is the 'SubString' method, but that will not work in this case, as the sting i am looking for will be in different locations withing the large string, or it may not be in there it all.
I am just trying to test for it's existance(true/false).
Any help would be appreciated.
********************
* $TeVe McLeNiThAn
********************
|
|
|
|
|
See String.IndexOf method in help. This returns the integer index of the first character of a substring in another string, -1 if not foune, 0 if the substring requested is an empty string.
Some ideas are so stupid that only an intellectual could have thought of them - George Orwell
|
|
|
|
|
Hmmm the documentation for String isn't that difficult to follow!
Try String.IndexOf(String)
|
|
|
|
|
How can export specific record(s) in MS Access mdb file to text comma seperated file?
Jassim
|
|
|
|
|
I would look at pulling the stuff into a DataSet and then exporting it as XML instead of csv files. Why do you need it as a text file?
I don't know whether it's just the light but I swear the database server gives me dirty looks everytime I wander past.
-Chris Maunder
Microsoft has reinvented the wheel, this time they made it round.
-Peterchen on VS.NET
|
|
|
|
|
ok but can you tell me about the following :
1. can I have a sample code please?
2. Can I protect the XML file with password so that no body will be able to view the contents?
Many Thanks,
|
|
|
|
|
How can I update the MDI container statusBar text from the MDI child? can I have an example please...
Jassim
|
|
|
|
|
Has anyone delved into the deep dark secrets of Outlook connectors with C#?
All the references I have seen ("Inside MAPI" and MSDN) show C++ references. In particular, each connector type has a set of launch functions (the main one of which basically goes "create me a COM object and return it") and a set of COM enabled classes.
Now, I'm guessing here that I can fairly reasonably create the COM Classes using COM Interop. What is mystifying me is how do I deal with the launch functions within a C# DLL?
Any ideas?
-Adrian
|
|
|
|
|
Hi,
I've written a custom windows control, that displays an OpenGL scene, but I'm having troubles with it's properties. I can programmatically modify the properties fine, adding objects etc. I can also do this at design time, using the properties window. However, any changes I make at design time don't last, as soon as I run the program, it resets to it's default properties, and then resets in the design window too.
I'm I missing something here? Do I need a special attribute to tell properties to persist, and shouldn't they persist anyway? Otherwise all these design time properties I've added are rather pointless.
Cheers,
Dave
Dave Kerr
focus_business@hotmail.com
www.focus.esmartweb.com
|
|
|
|
|
I did some work with this a while back. I remember it got tricky depending on the type of your properties.
There is a DesignerSerializationVisibilityAtttribute you can apply to change the default designer serialization behavior. If the property is a collection, you may need
[DesignerSerialzationVisibility(DesignerSerialization.Content)] and a property get that returns the collection.
If you property values are instances of some custom type, you may need to use the DesignerSerializerAttribute .
More detail about the type of the property might be useful.
Burt Harris
|
|
|
|
|
I used the following code to download the source of an HTML page:
<br />
...<br />
try<br />
{<br />
HttpWebRequest _request = (HttpWebRequest)WebRequest.Create(_url);<br />
<br />
if (_useProxy)<br />
{<br />
WebProxy _proxy = new WebProxy(_proxyHost + ":" + _proxyPort.ToString());<br />
_request.Proxy = _proxy;<br />
}<br />
<br />
HttpWebResponse _response = (HttpWebResponse)_request.GetResponse();<br />
<br />
if (_response.StatusCode == HttpStatusCode.OK)<br />
{<br />
Stream _stream = _response.GetResponseStream();<br />
StreamReader _streamReader = new StreamReader(_stream, Encoding.UTF8);<br />
MessageBox.Show(_streamReader.ReadToEnd().Trim());<br />
}<br />
catch (WebException we)<br />
{<br />
}<br />
catch (Exception e)<br />
{<br />
}<br />
...<br />
My question is, what if the page I need to access requires authentication. In other words, when browsing normally, with a web browser client, a dialog pops up asking for my username and password. I have the access information, but I want the preceding code to be able to send that authentication information along and get the code without any user intervention.
Any ideas?
|
|
|
|
|
|
Authentication information is handled via the HttpWebRequest.Credentials property. You can set this to either an instance of NetworkCredential or CredentialCache . See the help under these two classes.
If your using Windows authentication (typically only in a corproate intranet scenario) this works to provide the credentials the current use is logged in with:
request.Credentials = System.Net.CredentialCache.DefaultCredentials;
Burt Harris
|
|
|
|
|
|
I want to contruct a tree view ... but instead of vertical expansion, I want it to expand out horizontally. The intent is to present a navigation view going left to right. Has anyone seen a control like this?
Thanks
_____________________________________________
The world is a dangerous place. Not because of those that do evil, but because of those who look on and do nothing.
|
|
|
|
|
What kind of application would use this kind of control, wouldn't it give uneasy feeling to the user, because most controls only do a vertical scroll and horizontal scroll only when things could not be shown on the fullscreen.
Kannan
|
|
|
|
|
Kannan,
I stated the application in my post: it is a Navigation view. And moving left to right is more natural than an expanding tree that moves up and down. As to scroll bars....I never said anything about scroll bars in my question.
_____________________________________________
The world is a dangerous place. Not because of those that do evil, but because of those who look on and do nothing.
|
|
|
|
|
Does anyone know how I can insert a macro into Excel from C#?
I tried
fExcel.RecordMacro(macro, System.Reflection.Missing.Value);
but that seems to do nothing.
I can find no other way... or even a clue...
Help would be appreciated.
Thanks.
Michel van Meijer.
|
|
|
|
|
Hi,
I just can't figure out how to obtain logical drive information. What I need is the volume label, capacity, etc. I guess by now I know all System.IO classes by heart. Can somebody kick me into the right direction please.
I'm loosing hair over this one...
Matthias
In theory, there is no difference between theory and practice. In practice, however, there is.
(unknown author)
|
|
|
|
|
Did you have a look around System.Management ?
Cheers,
Kannan
|
|
|
|
|
I've looked everywhere for functions like the ones you are interested in (and many others), but I suppose some Win32 calls were never ported to the CLR. I have found Environment.GetLogicalDrives(), which is similar to GetLogicalDriveStrings() in the Win32 API. Well, maybe someone else has found others, but I just use the PInvoke/DllImport stuff. Here's some code from one of my projects:
public class Volume {
[DllImport("kernel32.dll", EntryPoint="GetVolumeInformation", CharSet=CharSet.Auto)]
public extern static int
GetVolumeInfo(string sRootPathName,
StringBuilder sbVolumeNameBuffer,
int nVolumeNameSize,
out uint uVolumeSerialNumber,
out uint uMaximumComponentLength,
out uint uFileSystemFlags,
StringBuilder sbFileSystemNameBuffer,
int nFileSystemNameSize);
[DllImport("kernel32.dll", EntryPoint="GetDriveType", CharSet=CharSet.Auto)]
public extern static uint
GetDriveType(string sRootPathName);
[DllImport("kernel32.dll", EntryPoint="GetDiskFreeSpaceEx", CharSet=CharSet.Auto)]
public extern static int
GetDiskFreeSpaceEx(string sAnyPath,
out ulong ulFreeBytesAvailable,
out ulong ulTotalNumberOfBytes,
out ulong ulTotalNumberOfFreeBytes);
}
uint uSerialNum, uMaxEntryLen, uFileSysFlags;
StringBuilder sbLabelBuf = new StringBuilder(260);
StringBuilder sbFileSysTypeBuf = new StringBuilder(260);
int iSuccess =
Volume.GetVolumeInfo("C:\\", sbLabelBuf, sbLabelBuf.Capacity,
out uSerialNum, out uMaxEntryLen, out uFileSysFlags,
sbFileSysTypeBuf, sbFileSysTypeBuf.Capacity);
FWIW, I'm amazed I have any hair left at all
Matthias Steinbart wrote:
In theory, there is no difference between theory and practice. In practice, however, there is.
Love that one.
Cheers
|
|
|
|
|
|
|
I’ve a WinForm application and a TreeView control on it. I’m creating another thread to add data to the control. So far I’m able to achieve this behavior, but sometimes secondary thread is not destroyed. I know it is not recommended, but I’d like to know more about my options and why I should not do this.
Thanks
|
|
|
|