|
Hi, I am using Visual Studio C++/CLI. I am now playing around with the System::Drawing::Font class and I have seen Microsoft examples that use Dispose() but when I try to invoke the System::Drawing::Font::Dispose() function the compiler gives me an "error C2039: 'Dispose' : is not a member of 'System::Drawing::Font'". Does anyone know why this happens? The intellisense shows that the Dispose() method is a member of the Font class (as well as the Microsoft docs).
Thanks
Buck
|
|
|
|
|
Dispose() is a function inherited from the IDisposable interface. Its meant to implement the "Dispose pattern" to enable some form of immediate destructors in managed code. In C# you can call Dispose() on objects that will perform some clean up functions (like closing streams and such). In C++/CLI Dispose() is mapped to the class destructor by the compiler. You can't explicitly invoke Dispose() (nor write one). Instead, if an object encapsulating a resource needs some clean up done immediately (rather than waiting for the garbage collector) call either a Close() type function (which itself should only call the destructor I believe) or use delete (or declare the variable with stack semantics and have the destructor called automatically when the variable goes out of scope).
|
|
|
|
|
|
This bit me a bit when I recently migrated to VS 2005.
Here's an article that may help (even though the article is about porting to 2005, it contains relevant info about destructors and Dispose):
Changes in Destructor Semantics[^]
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
|
please reply to my question atleast
|
|
|
|
|
What question? Forum rules say post your question and wait for an answer. Posting another message about it is considered rude.
_____________________________________________
Flea Market! It's just like...it's just like...A MINI-MALL!
|
|
|
|
|
dona jain wrote: tell me the steps which should be followed to create a simple dialog box in Win32 programming using API.
Step 1: Post your question on the correct board. This is a good start since it puts your
question in the place where the correct persons that can help you will see it.
Step 2: Do a little research. Everything you need to know to create a working dialog is at the
core of Windows UI programming.
Windowing[^]
Dialog Boxes[^]
Step 3: If you run into a specific problem, return here and ask for help (on the correct message board, of course).
Bonus Step: Have a little respect for the people who give their time FOR FREE to help others on this site.
Try waiting a little longer than 1-2 hours for a reply. We are not all from India.
Good luck,
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
dona jain wrote: please reply to my question atleast
poor kid
|
|
|
|
|
Hello friends,
I’m going to develop some application using C++, Linux platform. I need information about mathematics libraries which have following features –
1) Matrix manipulation –
a) It should support Matrix multiplication, Inverse, Transpose, etc functionality on large data set say 1 million rows and columns.
b) Finding Min or Max element by row or column.
2) Providing sort function which would sort matrix.
3) Algorithm used for sorting of matrix is most important because as per my knowledge Heap sort gives the best performance over larger dataset.
4) Any functionality to sort a data set which accepts a row / column from a matrix. i.e. Sorting function receives row / column of a matrix as parameter & returns sorted set of elements or sorted set of indices of that matrix.
Thnx & regards,
Shashikant
|
|
|
|
|
Shashi.Shinde wrote: Linux platform.
I'm guessing you're not using C++/CLI then. Try the Visual C++ forum.
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
Look for Numerical Recipies !
There you can find many algorithm, and the C function implementation.
Russell
|
|
|
|
|
Hi ,
Can anybody tell me how to Copy a WinForm from One project to another in VC++ 2005?
I tried including all files(.h, .resx, .cpp) but it gets included like source files. I dont get a designer view option for Form.h.
Any help/url is highly appreciated.
Thanks a lot!
art
|
|
|
|
|
tell me the steps which should be followed to create a simple dialog box in Win32 programming using API..i m trying to make a single and simple dialog window..please help me out...
-- modified at 8:57 Wednesday 1st August, 2007
|
|
|
|
|
Yesterday, you said C++ .NET, and I suggested that you needed to work out if you meant .NET, or if you wanted to use MFC or Win32. I also said C# is a better language than C++/CLI for Winforms ( forms with .NET ). So, now you're in the C++/CLI forum, and you're saying Win32. I'm sorry, but this question is in the wrong forum, yesterday you said .NET in the Visual C++ forum, and today you say 'Win32' in the C++/CLI forum. I recommend doing some reading to make sure you get your terminology right.
Programming Windows by Charles Petzold is THE book on Win32 programming, although I cannot imagine why anyone would want to use Win32 today. MFC is a far better option.
If you're using the C++ Express Edition, MFC is not an option, which may be why you're asking about Win32. Really, it's a bad idea. Learn C# instead, Win32 is too much like hard work, and Winforms is better supported in C#. You already found out how few people read this forum, compared to the other ones.
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
Hi,
I would create a table who every cas was : array < String ^, 2 > ^ tab=gcnew array < String ^, 2 > (20, 200);
i try for array < String ^, 3 > ^ tab=gcnew array < String ^, 3 > (20, 200);, i can't make : tab[1][2]= subItems when array<string^>^ subItems=gcnew array<string^>(16);
Thank you verry mutch
|
|
|
|
|
I don't understand what you're trying to do, but I see right away that you're trying to create a 3 dimension array
with only two arguments in the constructor.
What happened to our previous thread? I thought you needed an array of arrays...
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
they are always an exception, how i can add in table of arrays, i do : tab[i][j]=Subitem;
Thank you verry mutch
|
|
|
|
|
tab needs to be defined to hold the type that subitem is. You didn't show what subitem is in your first post.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
the definition of subItem was array^ subItems=gcnew array(16);,
|
|
|
|
|
That's not valid. Your arrays need to have a type.
What do you want to do?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
abbd wrote: array < String ^, 3 > ^ sub2=gcnew array < String ^, 3 > (20,100,200);
array^ subItems=gcnew array(16);
sub2[0,0] = subItems
You have a bunch of things wrong here. Do you have an understanding of C++ arrays?
They are strongly typed, like the whole language is.
To define an array you have to specify a type - this won't work:
array^ subItems=gcnew array(16);
Now to add this array type to your multi-dimension array, that multidimensioned array must be defined to hold an array type -
the type of subItems, which you haven't defined.
If you have an array with three dimensions then you must access members of the array using three arguments.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
you've created a rectangular multidimensional array rather than a jagged one. As such, you need to access elements like this tab[i,j] rather than tab[i][j] (which you would do for a jagged array in C++/CLI)
|
|
|
|
|
i try for :
array < String ^, 3 > ^ sub2=gcnew array < String ^, 3 > (20,100,200);
array<string^>^ subItems=gcnew array<string^>(16);
subItems[0]="1";
subItems[1]="2";
.
.
subItems[15]="14";
sub2[0,0] = subItems
but they are an error : Error 80 error C3262: invalid array indexing: 1 dimension(s) specified for 3-dimensional 'cli::array<type,dimension> ^'
Thank's
|
|
|
|