|
Thanks!
You are right,its destory
You say
-------------
On the next GC cycle,
-------------
but there are unmanaged variables,does GC collect unmanged variables?
|
|
|
|
|
Will GC clean up unsafe code too?
Regards,
Arun Kumar.A
|
|
|
|
|
GC collects all allocated memory. Unsafe doesn't really come into it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Thank U very much for clearing my doubt.
Regards,
Arun Kumar.A
|
|
|
|
|
Hi,
these value types reside on the stack, they disappear when the method returns.
There is no new, no object, no collection involved.
|
|
|
|
|
*sigh* I thought so, but I wasn't sure. Certainly, I knew that unsafe wasn't going to change anything.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
It should also be mentioned that the code isn't guaranteed to work if the variables hadn't been allocated on the stack.
If it uses a real object that is allocated on the heap:
public unsafe void Test() {
string x = 42.ToString();
string* px = &x;
*px += 1;
Console.Write(*px);
}
The variable x is still allocated on the stack, but it is a reference to a string object that is allocated on the heap. If you copy the reference to a pointer, you will get the current location of the string in memory, but as the garbage collector can move objects in the heap, there is no guarantee that the string will stay in that location. It can be moved to another location at any moment, and the garbage collector will update the reference x to point to the new location, but it will not update the pointer px.
---
single minded; short sighted; long gone;
|
|
|
|
|
Hello,
Im trying to use this Syntax highlighting textbox http://www.codeproject.com/cs/miscctrl/SyntaxRichTextBox.asp[^] but i have a small problem.
On the source code of demo project, inside form1_Load (), a new RichTextBox is created and syntax tokens are added to it.
What if i already have a RichTextBox created and wanted to add highlighting keywords to it?
By using something like this:
SyntaxHighlightingTextBox shtb = new SyntaxHighlightingTextBox();
A new RTB is getting created, on top of the existing RTB i have on the form. How can i solve this..?
|
|
|
|
|
The choice you have either implementing the functionality in your own RTB control, or using the one canned in the project. You can't just add it on to the stcok RTB you dropped on your form.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
oh... How can i implement this functionality into my own RTB control, i dropped into the form?
Im fairly new to C#, I've never done anything like this before and haven't seen any tutorial on this, so i haven't got any clue how to do this.. im stuck
|
|
|
|
|
You go over the code that's in that project and see what you need to do to convert it. Don't ask me, or anyone else here, to do it for you. The amount of space required to explain everything you need to do would take up a small book.
Why do yo uhave to add this to a stock RTB control? Why not just use the control in the project, altered to your formatting requirements? It'd be much simpler, but still too much to put into a forum post.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Yes, you need to REPLACE your control with the control provided in the article. All of your existing functionality should be preserved since the control in the article inherits from RichTextBox.
Take note of the comments in the article, several of them have performance improvements that are very, very necessary. I've incorporated the control in that article into one of my projects and it's basically worthless without the improvements.
------------
Cheers,
Patrick
|
|
|
|
|
Hi, im not speaking of opening a file in the program and reading it, im talking about opening the file in windows, running the standard application to open it.
So question is where do I get the Name of the Program associated with a file-Extension? When i have that, i could use Process.Start().
Is there a way to do what i want in C#?
Thanks for any help
|
|
|
|
|
Send it to Process.Start and it shall do it.
|
|
|
|
|
All you have to do is start the data file. You don't need to know the name of the application associcated with it. If you use ShellExecute, it'll launch just like you double-clicked the file itself.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Thanks for the answers.
What is ShellExecute()? Where do I find it?
If I use Process.Start(), i get an Exception when there is no program associated with the file.
Is there a possibility to get all programs associated with an extension?
|
|
|
|
|
Ehh, Windows is telling you that no program is associated with the file, hence your list of all programs associated with an extension is... well... empty
|
|
|
|
|
I would like to have a list of all programs associated with an extension, so that i can display a quick list in a contextmenu (like in windows-explorer).
|
|
|
|
|
You're looking for the Process[^] class. UseShellExecute is a property of the ProcessStartInfo class that is used in the Start method of Process.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
But what is the difference when UseShellExecute is true?
And IS there a possibility for me to get a list of each program associated with an extension?
|
|
|
|
|
c.bartsch wrote: But what is the difference when UseShellExecute is true?
If you don't turn ShellExecute on you have no choice but to launch an actual executable file, not a document file.
c.bartsch wrote: And IS there a possibility for me to get a list of each program associated with an extension?
Sure, you have to parse all of the the registry keys under HKEY_CLASSES_ROOT to get the various pieces of information you need. The problem with this is that there isn't one method, or one location under every key that gives you this information. Various things have to be parsed and other values chased down and followed to find all the information. This is NOT a good idea.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Hi
I have developed one windows application ( it is testing application) which is used to test real hardwares.. it has lot thread running in the background that will constantly monitor the hardware communication. Also my application is an touch screen application, so i have used lot of images for buttons. I am facing sometimes the Application is hanging after i ackwnoledging message box during application execution.
During that time... CPU is 100% utilized.. i think if the memory is full..... button click events will not be handled.. (but at that time i could able to open/close other applications )
So how to make my application is very effect in order to avoid these situations. I have tired GC. Objects.Dispose().. but still the problem is there
I am going to try ngen.exe!
any ideas or thoughts are welcomed!
Thanks
srini
|
|
|
|
|
Most likely you have a loop somewhere that is taking some time to execute. Of if it isn't a loop it is just a long running process. Usually when I hear cpu 100% I think of a loop going out of control. Anyway, I would look for something like that. Next you if you do have a long running looping process you can every ten loops or every 100 loops do an Application.DoEvents() This will allow the processing of click events and refresh the form.
Hope that helps.
Ben
|
|
|
|
|
hi all
i made double buffering in a form with
this.DoubleBuffering = true;
but this is not working in the tab so i wanna to know how to make double buffering by using Bitmap to enhance performance by drawing in memory as bitmap and then draw my background in the bitmap and draw bitmap again to the screen
can any one tell me how to begin search how to use this technique
thanx
Generator
|
|
|
|
|
I think SetStyles is the method you call, turn on double buffering and all drawing in WMPAINT.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|