|
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,
|
|
|
|
|
I am using eclipse for C++ and powerpc-apple-darwin9-gcc-4.0.1 as my compiler.
I am trying to compile a code example, butI am running into the following problem with an include of a standard library.
here is the main program:
[code]
#include <iostream>
#include "d_search.h"
#include "d_sort.h"
#include "d_random.h"
#include "d_timer.h"
using namespace std;
int main()
{ const int ARRAY_SIZE = 100000, TARGET_SIZE = 50000;
int list1[ARRAY_SIZE], list2[ARRAY_SIZE], targetList[TARGET_SIZE];
int i;
timer t;
randomNumber rnd;
for (i = 0; i < ARRAY_SIZE; i++)
list1[i] = list2[i] = rnd.random(1000000);
for (i=0;i < TARGET_SIZE; i++)
targetList[i] = rnd.random(1000000);
cout << "Timing the Selection Sort" << endl;
t.start();
selectionSort(list2,ARRAY_SIZE);
t.stop();
cout << "Selection Sort takes " << t.time()
<< " seconds." << endl;
cout << endl << "Timing the Sequential Search" << endl;
t.start();
for (i = 0; i < TARGET_SIZE; i++)
seqSearch(list1,0,ARRAY_SIZE,targetList[i]);
t.stop();
cout << "Sequential Search takes " << t.time()
<< " seconds." << endl;
cout << endl << "Timing the Binary Search" << endl;
t.start();
for (i = 0; i < TARGET_SIZE; i++)
binSearch(list2,0,ARRAY_SIZE,targetList[i]);
t.stop();
cout << "Binary Search takes " << t.time()
<< " seconds." << endl;
return 0;
}
[/code] </iostream>
here is the included header file:
[code]
#ifndef SEARCH_FUNCTIONS
#define SEARCH_FUNCTIONS
#include <vector>
#include <list>
using namespace std;
int seqSearch(const int arr[], int first, int last, int target);
template <typename t="">
int seqSearch(const T arr[], int first, int last, const T& target);
int binSearch(const int arr[], int first, int last, int target);
template <typename t="">
int binSearch(const T arr[], int first, int last, const T& target);
template <typename t="">
int seqSearch(const vector<t>& v, int first, int last, const T& target);
template <typename t="">
int binSearch(const vector<t>& v, int first, int last, const T& target);
template <typename t="">
list<t>::iterator seqSearch(list<t>::iterator first,
list<t>::iterator last, const T& target);
template <typename iterator,="" typename="" t="">
Iterator find(Iterator first, Iterator last, const T& target);
int seqSearch(const int arr[], int first, int last, int target)
{
int i;
for(i=first; i < last; i++)
if (arr[i] == target)
return i;
return last;
}
template <typename t="">
int seqSearch(const T arr[], int first, int last, const T& target)
{
int i;
for(i=first; i < last; i++)
if (arr[i] == target)
return i;
return last;
}
int binSearch(const int arr[], int first, int last, int target)
{
int mid;
int midValue;
int origLast = last;
while (first < last)
{
mid = (first+last)/2;
midValue = arr[mid];
if (target == midValue)
return mid;
else if (target < midValue)
last = mid;
else
first = mid+1;
}
return origLast;
}
template <typename t="">
int binSearch(const T arr[], int first, int last, const T& target)
{
int mid;
T midValue;
int origLast = last;
while (first < last)
{
mid = (first+last)/2;
midValue = arr[mid];
if (target == midValue)
return mid;
else if (target < midValue)
last = mid;
else
first = mid+1;
}
return origLast;
}
template <typename t="">
int seqSearch(const vector<t>& v, int first, int last, const T& target)
{
int i;
for(i=first; i < last; i++)
if (v[i] == target)
return i;
return last;
}
template <typename t="">
int binSearch(const vector<t>& v, int first, int last, const T& target)
{
int mid;
T midvalue;
int origLast = last;
while (first < last)
{
mid = (first+last)/2;
midvalue = v[mid];
if (target == midvalue)
return mid;
else if (target < midvalue)
last = mid;
else
first = mid+1;
}
return origLast;
}
template <typename t="">
list<t>::iterator seqSearch(list<t>::iterator first,
list<t>::iterator last, const T& target)
{
list<t>::iterator iter = first;
while(iter != last && !(*iter == target))
iter++;
return iter;
}
template <typename iterator,="" typename="" t="">
Iterator find(Iterator first, Iterator last, const T& target)
{
Iterator iter = first;
while (iter != last && *iter != target)
iter++;
return iter;
}
#endif // SEARCH_FUNCTIONS
[/code]</typename></t></t></t></t></typename></t></typename></t></typename></typename></typename></typename></t></t></t></typename></t></typename></t></typename></typename></typename></list></vector>
the error seems to be when I call the list template. the syntax check in eclipse says
"expected constructor, destructor, or type conversion before 'seqSearch'
here is the error output of the build:
[code]
make all
Building file: ../source/prg3_1.cpp
Invoking: GCC C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"source/prg3_1.d" -MT"source/prg3_1.d" -o"source/prg3_1.o" "../source/prg3_1.cpp"
"../source/d_search.h:43: error: expected constructor, destructor, or type conversion before 'seqSearch'
"../source/d_search.h:164: error: expected constructor, destructor, or type conversion before 'seqSearch'
"../source/d_sort.h: In function 'void distribute(const std::vector<int, std::allocator<int=""> >&, std::queue<int, std::deque<int,="" std::allocator<int=""> > >*, int)':
"../source/d_sort.h:234: warning: comparison between signed and unsigned integer expressions
make: *** [source/prg3_1.o] Error 1
[/code]</int,></int,>
any help is appreciated
thanks in advance.
|
|
|
|
|
C++/CLI is the .NET extensions to C++, which Eclipse does not support. I know it's not as clear as it could be, but the visual C++ forum is the place to ask this.
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 )
|
|
|
|
|
In my Form application, I have created several object pointer using new operator. These objects are of Templated class and classed are exist in a separate lib (native c++ but compiled with /clr). I found my application is leaking momory. I tried to track all new and delete pair but still there is memery leak exist.
I search for memory leak detector but most free tools are for native c++.
How can I delect the memery leak in managed form which are due to new and delete pair.
Any idea or links to right tool will be highly appreciated.
Thank you
|
|
|
|
|
Hai
I am using .net windows form application, richtextbox control for creating a text editor. I don't know how to get caret position. Is there any command available to get the caret position. Can you tell me & give example.
Thanks in advance
Mani.
|
|
|
|
|
|
Hai
Thanks for reply,
Here i am using .Net Framework 2.0,Mc++. Is here any command like caretposition.
can you tell me.
Thanks
modified on Thursday, May 15, 2008 10:58 PM
|
|
|
|
|
Did you have a look at the link I suggested?
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
Hai
Thanks for reply.
I saw that, actually what i want is i want to move the cursor position to the end of the file. while open the file. For that i want to know how to move the caret from one place to another place.
your attached document is very helpful for me.
Thanks again,
Mani,
|
|
|
|
|