|
I all,
need to convert a MFC app to .net, would it be wise to strip out the MFC stuff first to just have normal ANSI C++ code and then wrap it in MC++?
not sure if i'll run into problems later.
thanks
|
|
|
|
|
Fu Manchu wrote: need to convert a MFC app to .net, would it be wise to strip out the MFC stuff
You have an entire application written using MFC, what would be left if you "stripped" it out?
led mike
|
|
|
|
|
well, i guess the windows stuff etc.. the code is an API for currency forex exchange - but i want to extract the main functionality of the API code and convert this to .net.
the application is a sample app, it just has a menu with some basic functions - nothing fancy.
|
|
|
|
|
Fu Manchu wrote: the code is an API for currency forex exchange - but i want to extract the main functionality of the API code and convert this to .net.
well that statement is not at all equal to your original post
Fu Manchu wrote: need to convert a MFC app to .net
You have just won the home edition of our game "Who Wants to be a Programmer", thanks for playing.
led mike
|
|
|
|
|
eh,
Sounds like you’re just in here for a laugh, I’ve been programming in many DIFFERENT languages for over 10 years, if you have nothing useful to add then don't question my ability...
I’ve done this before and i'm not in anyway a beginner - i came here for advice but it seems to me know one here has the knowledge or the qualifications to help!
|
|
|
|
|
Fu Manchu wrote: I’ve been programming in many DIFFERENT languages for over 10 years, if you have nothing useful to add then don't question my ability...
I’ve done this before and i'm not in anyway a beginner - i came here for advice but it seems to me know one here has the knowledge or the qualifications to help!
Yet you could not manage to formulate an intelligent question in your initial post that accurately represents your situation. And then you think it's ok to cast aspersions at me? Your like one of those assholes that cuts people off in traffic and then blames them for the incident, you are the problem in this thread ass wipe not me, f*** off.
led mike
|
|
|
|
|
You can simply compile your MFC application with the /CLR switch (project property, Configuration Properties|General|Common Language Runtime support.)
If I must move an application from native to .NET, my own preference is to understand how the application works and then rewrite it in C# and fully leverage .NET. (I've had some code move almost straight across with mostly cosmetic changes--like having to put public in front of methods and so forth.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Hai
I just want to highlight the keywords while typing itself,
For that i am using rtf format,can you tell me, Is any other way is there to highlight the key word.
In richtextformat what is mean by cf1,cf2,cf0 ?
Is it is a color reprasentation.
I saw the msdn i choudn't understand.
Thanks.
|
|
|
|
|
open or create usertype.dat file in a notepad and defined your keyword and save in folder where devenv.exe exist.
C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\usertype.dat
Nigah M Manzoor
|
|
|
|
|
Hi, I'm using Visual Studio 2005 C++/CLI. I guess my previous question on the autoscroll was a real stumper, so I'll try something else. When writing an application I will get quite a ways into the development when, at the insistance of my boss, I need to create a new version that I can continue development on. So I will go through the tedious process of creating a new folder and copying 'mySolution1 Version 1' to 'mySolution1 Version2' and then renaming the individual solution and project files (that isn't why I am posting but if someone knows an easier way to do that I would love to know). On to the question. While working on an app I did this through a 'mySolution1 Version5' at which time I added an icon of our company logo to appear on the forms and everything was good. Then I needed to use a copy of 'mySolution1 Version5 to begin a new and different application called 'mySolution2 Version1' again renaming the solution and project files accordingly. It compiled fine but crashed with a 'MissingManifestResourceException' on the 'Windows Form Designer' generated code "this->Icon = (cli::safe_cast<System::Drawing::Icon^ >(resources->GetObject(L"$this.Icon")));". If I remark out the line the app compiles and runs fine using the default icon. If I go into the 'Forms Designer' and change the Icon property the way I did before then the app crashes. The syntax of the line is the same. Anyone see what I am doing wrong?
Thanks,
Buck
|
|
|
|
|
BuckBrown wrote: I will get quite a ways into the development when, at the insistance of my boss, I need to create a new version that I can continue development on. So I will go through the tedious process of creating a new folder and copying 'mySolution1 Version 1' to 'mySolution1 Version2' and then renaming the individual solution and project files (that isn't why I am posting but if someone knows an easier way to do that I would love to know).
Umm, ever heard of source control.
led mike
|
|
|
|
|
|
|
Hey Mike,
Geez, considering I'm the only programmer on staff the Source Control in VS 2005 appears 100 times more tedious than the way I have been doing it. And considering that there is no money to buy a third party plug-in where would I get a free third party plug-in?
Buck
|
|
|
|
|
BuckBrown wrote: Geez, considering I'm the only programmer on staff the Source Control in VS 2005 appears 100 times more tedious than the way I have been doing it.
Ok, good luck
led mike
|
|
|
|
|
Just to let you know,
I have figured out a seven step process that I can use to consistantly be able to copy and rename entire solutions but that isn't what I need to do to correct this icon problem that give me an error on the line...
this->Icon = (cli::safe_cast<System::Drawing::Icon^>(resources->GetObject(L"$this.Icon")));
There was a Microsoft .NET article "http://msdn.microsoft.com/en-us/library/ms950960.aspx" talking about this very subject and another forum had a solution for this problem. The solution is to add the icon as a resource and then select the incon file's Build Action property and change it to Embedded. My problem now (as it always is with Microsoft) is that my VS 2005 does not have the same Forms or properties as these examples and the icon file I imported does not have a Build Action property. I will post again as a Build Action problem.
Sorry, it would have been nice to provide you with a link to the MS article but I don't know how to do that.
Thanks
|
|
|
|
|
Hai
I am using the keydown event, for performing some operation. I just want to store this return value as string, i don't know how to do this. Can you help me.
for example
If the user press the key 'a', I want to store 'a' as string
Thanks
|
|
|
|
|
It's a char, call ToString to store it as a string. But, it's one char, a char will do it just fine.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hai
Thanks for reply
I want to know want key is pressed by user.
I think KeyData will provide that user pressed keydata but it returns key.
I dont know how to store the return value as string.
So i used this keyvalue .
i wrote like this
int ^ keyvalue = e->KeyValue;
String ^data = keyvalue->ToString();
Can you tell me how to store the keydata as string. I am using .net framework 2.0 version(windows form application);
thanks,
|
|
|
|
|
Hai
Thanks, The problem is solved.
|
|
|
|
|
Hello,
I have a class in MFC and I want to use this class in Windows forms. For that I create a .dll file using the MFC class and load that .dll file in to CLR project and draw that object in Windows form. But now I want to add an event to that new control. How can I do this?
eg:
I have a ctreeview in MFC and I create a .dll file using that MFC class and open a CLR project in VC++2008 and add a form to that project and load that .dll file. Then I can access that MFC class in my new Windows form ( in CLR project ). and it is working. But my current problem is that, I want to read selected node value from that tree node to my Windows forms's text entry. How can I do this? I think, for that we need to add an event ( After select ) to that control. But that control is loaded from .dll file.
How can I solve this problem?
Please help me.
|
|
|
|
|
This is the second time you have posted this question. There are many details involved in building mixed mode applications. Far more than can be imparted to you in a simple forum reply.
However you are in luck because there are many resources on MSDN web site and here on Code Project in the form of articles and example code on this subject. It also seems you do not yet understand basic constructs like how events work, spend some time on this as well.
I strongly suggest you stop typing messages into forums and start reading and researching the subject.
led mike
|
|
|
|
|
I am at an initial stage of converting a mixed class to make it COM class. (and eventually a complete project)
I googled a bit but have found information only for managed(C#) class.
Typically the mixed class would look like
namespace MyNameSpace
{
public __gc class CPoint
{
public:
CPoint();
~CPoint();
CPoint(float x, float y, float z);
__property void set_X(float x){ m_pPoint->m_x = x; }
__property float get_X() {return m_pPoint->m_x;}
public private:
};
I have to expose this class as a COM class. I need an interface too.
But not sure how to do this. Any link or information will be very helpful.
modified on Monday, May 19, 2008 5:59 AM
|
|
|
|
|
Looks like I have to implement CCW (COM Collable wrapper) for the mixed class.
Any examples or links in this regard wil be great.
|
|
|
|
|
Hai,
I just want to change the color of certain keyword, while typing itself, for that i am using the rtf format. For this which event handler shall i use. if i use textchange event it shows the error as follows.
An unhandled exception of type 'System.StackOverflowException' occurred in System.Windows.Forms.dll
My code is as follows.
private: System::Void lettertyped(System::Object^ sender, System::EventArgs^ e)
{
array<String^>^ keyword = gcnew array<String^>{"#include","#define","struct","int","char","void","float","double","longint","long","if","else","true","false","return"};
int length = keyword->Length;
String ^ strRTF = this->richTextBox1->Rtf;
int iCTableStart = strRTF->IndexOf("colortbl;");
if (iCTableStart != -1)
{
int iCTableEnd = strRTF->IndexOf('}', iCTableStart);
strRTF = strRTF->Remove(iCTableStart, iCTableEnd - iCTableStart);
strRTF = strRTF->Insert(iCTableStart,
"colortbl ;\\red255\\green0\\blue0;\\red0\\green128\\blue0;\\red0\\green0\\blue255;}");
}
else
{
int iRTFLoc = strRTF->IndexOf("\\rtf");
int iInsertLoc = strRTF->IndexOf('{', iRTFLoc);
if (iInsertLoc == -1) iInsertLoc = strRTF->IndexOf('}', iRTFLoc) - 1;
strRTF = strRTF->Insert(iInsertLoc,
"{\\colortbl ;\\red128\\green0\\blue0;\\red0\\green128\\blue0;\\red0\\green0\\blue255;}");
}
int len = strRTF->Length;
String^ tempst;
String^ result;
String ^key;
//String ^strReplace;
String ^slash = "/*";
String ^endslash = "*/";
String ^commentlinestr = "//";
char startquots = '"';
char endquots = '"';
int keylen;
int iRTFLoc;
int intslash;
int stquotes;
//int endquotes;
int commentline;
bool found = false;
bool spacefound = false;
bool starcomment = true;
bool slashcomment = false;
bool endquot = false;
int nlen = strRTF->Length;
for(int nchRTF = 0;nchRTF < nlen;nchRTF++)
{
if(strRTF[nchRTF] == ' ' || strRTF[nchRTF] == '\n' || strRTF[nchRTF] == '"' || strRTF[nchRTF] == ';' || strRTF[nchRTF] == '(' || strRTF[nchRTF] == ',' /*|| strRTF[nchRTF] == '*' */)
{
//Keyword
for(int nkeyword = 0;nkeyword<length;nkeyword++)
{
key = keyword[nkeyword];
keylen = key->Length;
iRTFLoc = tempst->IndexOf(keyword[nkeyword]);
if(/*iRTFLoc >= 0*/ tempst->Contains(key))
{
found = true;
break;
}
}
if(found)
{
if(starcomment)
{
int location = 4+iRTFLoc+keylen+1;
tempst = tempst->Insert( iRTFLoc,"\\cf3 ");
tempst = tempst->Insert( location,"\\cf0 ");
}
found = false;
}
tempst = String::Concat(tempst, strRTF[nchRTF]);
//Single Comment line
if(strRTF[nchRTF] == '\n')
{
if(slashcomment)
{
int newlen = tempst->Length;
tempst = tempst->Insert(newlen,"\\cf0");
slashcomment = false;
}
}
commentline = tempst->IndexOf(commentlinestr);
if(commentline >= 0)
{
tempst = tempst->Insert( commentline,"\\cf2 ");
slashcomment = true;
}
// Quotes
if(strRTF[nchRTF] == '"')
{
if(endquot)
{
int quoteslen = tempst->Length;
tempst = tempst->Insert(quoteslen,"\\cf0");
endquot = false;
}
else
stquotes = tempst->IndexOf(startquots);
if(stquotes >= 0)
{
tempst = tempst->Insert( stquotes,"\\cf1");
endquot = true;
}
}
//Group comment line
intslash = tempst->IndexOf(slash);
if(intslash >= 0)
{
starcomment = false;
tempst = tempst->Insert( intslash,"\\cf2 ");
}
int intslashend = tempst->IndexOf(endslash);
if(intslashend >= 0)
{
tempst = tempst->Insert( intslashend + 2 ,"\\cf0 ");
starcomment = true;
}
//Concat the string
result = String::Concat(result,tempst);
tempst = String::Empty;
}
else
{
tempst = String::Concat(tempst,strRTF[nchRTF] );
}
}
result = String::Concat(result,tempst);
tempst = String::Empty;
this->richTextBox1->Rtf = result;
this->richTextBox1->SelectionStart = this->richTextBox1->Text->Length;
}
in this code is working fine while opening the file.
Thanks
Mani,
|
|
|
|