|
Hockey wrote: but I still find frameworks (MFC) non-conforming
To the assumption that MVC must be followed ? Yes. I used MVC because I knew that there would be 4 or 5 controllers and at least two views. In that sense, it made perfect sense, and worked really well. I doubt that MVC would have improved any of the MFC projects I ever worked on.
Hockey wrote: Is doing something like this possible in C#?
Not really, no. And, it's barely possible in C. I mean, like I said, it's still your control that recieves your keyboard and mouse messages. If you do it via a message pump, you make intercept a message with a window handle, so you know where it came from, but I still think it's a bit messy.
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 )
|
|
|
|
|
hello all.
I need an algorithm that will take a .avi video file and .jpg image file as input. and the output will be the .avi file with the given image overlayed on it.
can anyone help me to find a solution.
Thanks in advance.
Enamul Hoque
|
|
|
|
|
It's not an algorithm that you need. Basically, you can do this with DirectX, by creating a filter that superimposes the JPG. Or you can use WPF. Or you can decompose the AVI to frames, merge them with the JPEG, and render a new AVI.
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 )
|
|
|
|
|
Dear Christian,
thanks for your reply.can you explain it in more details kindly?
actually i am working with a C# program. here input will be a .avi file and a .jpg file, and the output is the .avi file with the image overlayed on it.
can i use directX or WPF in C#.
Please mention any article if you know.
Thanks again.
Enamul
|
|
|
|
|
If you use WPF, you need to rewrite your app to use it. Yes, you should be able to do this in DX, but I've not done it, I am only aware that it can be done.
I know of a component that will do it for you, it costs $800. Is this an option for you ?
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 )
|
|
|
|
|
Just look this test method:
public unsafe void Test()
{
int x=23;
int* px=&x;
*px+=1;
Console.Write(*px);
}
I want to know when will x and px distory?
thanks!
|
|
|
|
|
destroy ?
On the next GC cycle, as they exist for far too short a time to be marked to survive 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 )
|
|
|
|
|
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).
|
|
|
|