|
Hello,
In my void main l have Application.EnableVisualSytles
This so that l can have an application that gives the XP appearance. This works wells for all the controls apart from the toolbar icons l have. The icons do not display. If l comment out Application.EnableVisualStyles, then the toolbars display the icons ok.
This visual style used to work on my application, and all of a suddern does not work now. I was doing some changes with main, but l don't think this has anything to do with the icons not showing.
Many thanks in advance,
Steve
|
|
|
|
|
i face a problem .
the problem is summerized as following:
1- i have 600 MB of text files.
2- each text file has specific symbol to indicate a racord like *1 (means reacod number 1 and so on).
3- i want to write a boolen query like (C# and programming) the result reaturned as following : text-file + record number that contains these terms
4- i read alot about inverted file and how big is it , and how we can compress it , but i didn't reach to anything
so can any one help or give me an idea to build an index from these text and that index doesn't exceed 10% of the origianl files and suppose a method to retrieve these records ...
thanks alot
DEvX
|
|
|
|
|
Hi,
I am having an interface that i have developed in C#. i am trying to execute another exe file (already generated by a cpp program) and that exe file will take a filename as input argument and should return an array to the calling program.
Now I am having 2 problems..
1) How to execute an exe file with passing arguments to it.
2) Am i able to read the return values from the exe file.
the below ones are doubts in a cpp file (already posted in c++ forum)..but if u have any ideas... u can suggest...
3) How can i return an array of data from a cpp file as a return value from a main().
any kind of suggestions are appreciated...
thanks in advance,
Suman
|
|
|
|
|
See System.Diagnostics.Process.Start .
Instead of making a mess with data returns why don't you dump the data into a file and read back from there?
The situation you are describing seems like a mess. Make sure your final solution is somewhat robust and reliable. Maybe use P/Invoke to instead of returning the data. Or maybe rewrite in c#??
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
Hi Alex,
thanks for ur suggestions and i did the same way as u told, like dumping the data into a file and then reading the data from it.
But i am having a problem, when the process is started using Process.Start, my calling program is not waiting for the called process to complete before it goes to next step of execution. So, i am having some inconsistent data file by tht time as the called process take some considerable time to complete.
Is there any command to make the calling program to wait untill the called process is comepleted.
thanks in advance,
Suman
|
|
|
|
|
Yes. Take a look at System.Diagnostics.Process. Method WaitForExit .
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
Hi Alex,
yeah... i figured it out... sorry i forgot to delete my previous reply, since i figured it out after i posted the reply to you.
Anyway thanks for ur help.
Suman
|
|
|
|
|
one that will be fun to work out and get good or interesting results, or to make an existing one better, need the ideas since I can't really think of any at the moment, thanxs in advance ;P:P;P
|
|
|
|
|
Something that interfaces with a airplane simulator. The neural networks job would be to make sure the plane flies in all weather.
Something that interfaces with Counter Strike. The neural networks job would be a killing machine
Alex Korchemniy
|
|
|
|
|
something simpler since I don't have alot of time since I need to be almost finished with it in a month since I will have to do alot of work..
|
|
|
|
|
navigating a maze?
there are no facts, only interpretations
|
|
|
|
|
Given a particular string, is there a way to tell whether it contains unicode characters? I know could test every character's range, but I'm wondering if there is some API call for this. I'm looking in string, System.Text.Encoding, and Globalization, but haven't found any likely suspects yet...
Matt Gerrans
|
|
|
|
|
Strings in .NET are stored as Unicode. The encoding only matters when reading and write from and to streams (text files, network streams, etc.).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I know that.
I'm adding lines to existing files. If the existing file is ASCII and I'm adding regular ASCII text, then everything's fine. However, if the line I'm adding has some Unicode characters (which may be the case), I want to change the file's encoding to Unicode and rewrite the thing out. (If the existing file is already Unicode, it is easy of course (except for this StreamReader bug that tells you it is UTF8)).
I've figured out how to do this aready, by going through all the characters and checking for any out of the 0-255 range, but I was wondering if there was an API call, or more idiomatic way of handling this.
Matt Gerrans
|
|
|
|
|
And why do you call it a bug? It sounds correct. UTF8 is an MBCS (multi-byte character set) that uses 7-bit characters as ANSI does, but 8-bit characters (i.e., the 8th bit is set) denotes Unicode codepoints. That's the beauty of UTF8 - it maintains backward compatibility so long as you don't use Unicode, and if you must it allows for that.
So, use the UTF8Encoding instead.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
It is incorrect if the file's BOM ("\xff\xfe") says it is Unicode (or UTF16) and the reader thinks it is UTF8 ("\xef\xbb\xbf"). So I call it a bug, because I think it is one. I've since noticed that if I use the StreamReader 's string constructor, it correctly identifies it as Unicode, but if I use the FileStream constructor it mis-identifies it as UTF8. So if I do this with a Unicode encoded file:
void SomeMethod( FileInfo info )
{
StreamReader reader = new StreamReader( info.OpenRead() );
System.Text.Encoding encoding = reader.CurrentEncoding;
string data = reader.ReadToEnd();
reader.Close();
data = Massage(data);
StreamWriter writer = new StreamWriter( info.OpenWrite(), encoding );
writer.write(data);
writer.Close();
}
I get a UTF8 encoded file as a result, which I don't want. On the other hand, if I do this:
void SomeMethod( FileInfo info )
{
StreamReader reader = new StreamReader( info.FullPath );
System.Text.Encoding encoding = reader.CurrentEncoding;
string data = reader.ReadToEnd();
reader.Close();
data = Massage(data);
StreamWriter writer = new StreamWriter( info.OpenWrite(), encoding );
writer.write(data);
writer.Close();
}
The file will be Unicode, as expected (and desired). Maybe the intermediate use of the FileStream causes the loss of the encoding?
Because these files are used by multiple platforms and programming languages (not all of which support MBCS), I want to simply use either ASCII or Unicode, but not UTF8 (or UTF7 or Unicode Big-Endian, etc.). I think there is not that much beauty in UTF8 (the "backward compatibility" also get hosed by use of extended ASCII characters, which usually comes from "backward" text files that were using drawing characters and the like), just unnecessary complexity, especially in these days of multi-gigabyte storage.
By the way, the original question was about detecting the presense of Unicode characters in a string (which, having 16-bit characters could contain some, or not); this would affect the case where the original file was ASCII, but a line with some Unicode characters were inserted into it. In that case, I just want to switch the whole file over to Unicode.
Matt Gerrans
|
|
|
|
|
You should use StreamReader reader = info.OpenText(); . If you look at the IL, the code for opening a StreamReader from a stream vs. a filename is the same. The constructor which takes a string actually does the same thing you are - opens a FileStream and passes it to Init (an internal method which every constructor eventually calls).
As for your original question, see the StringInfo class defined in the System.Globalization namespace. This allows you to enumerate characters (derived from however many code points), which you could then determine if a string contains one character or more.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hi,
I noticed in a sample app source code that the app made use of a class for example a user class and then had the user objects that got created stuffed into a user collection. I was wondering why do they do this if the user object that was created existed for the life of the object why u would need a user collection? I would think u could just call the user object and get your info from that just as easily then going the extra step to put the user object into a user collection. What am I missing here?
What is the user collection giving me over just using the user objects that I can create by themselves? I hope I am explaining this correctly.
Thanks,
JJ
|
|
|
|
|
MrJJKoolJ wrote:
user class
MrJJKoolJ wrote:
user objects
MrJJKoolJ wrote:
user collection
What is a "user" class, object or collection? Do you mean one that isn't part of the .NET Framework? For the rest of my reply I'll assume that is what you mean.
MrJJKoolJ wrote:
I would think u could just call the user object and get your info from that just as easily then going the extra step to put the user object into a user collection.
There are many reasons for putting objects into a collection despite the fact they will exist elsewhere. Mostly this is to do with ease of access in the other location, the ablility to iterate over the objects and perform the same operation on all of them, the ability to create a varying number of objects and still reference them and so on.
Do you want to know more?
Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.
|
|
|
|
|
Hello
How can i change the title bar color?
i have using MSDN sample code but
no use link below
http://msdn.microsoft.com/library/default.asp?url=/libraray/en-us/sysinfo/base/changing_the_color_of_window_elements.asp
|
|
|
|
|
You either change it for the whole system using the Display control panel, or you complete draw the window frame yourself, which requires knowledge about the Window APIs and P/Invoke. If you want to venture down that route, I highly suggest you read all of Interoperating with Unmanaged Code[^] (pay close attention to the marshaling topics) and search this site for examples of owner-drawn window frames.
BTW, the link doesn't work.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I have a usercontrol with a few controls on it. In the load of my usercontrol I read the settings from the registry. I also want to write these settings back to the registry when my usercontrol is unloaded. But there is no such thing as unload.
Can anyone tell me which event to use to write these settings to the registry?
|
|
|
|
|
|
That wouldn't work. Disposed happens after the control is disposed, so his controls that contains the values and any fields or properties that might reflect those values are already gone.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Handling the Disposed event is too late. You need to override Dispose(bool) , persist your data, then call base.Dispose(bool) like so:
protected override void Dispose(bool disposing)
{
PersistToRegistry();
base.Dispose(disposing);
} That way the child controls and other data is disposed after you get the data contained within. Once those controls are disposed you can't get their data (because it's been disposed).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|