|
Vinod CS wrote: People are keeping the destructor of singleton class in 'Public' Section of class.
When they do it is an error.
Normaly it is a static const object living in a global function.
Also, its c'tors and d'tors can be protected and construction made by a friend -factory class.
Or, the access is not on the whole class-interface, but only an Interface-pointer.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
Hello,
I create a "MFC application" project in MSVC 2005.
But I want to add a class ref from tThread.
For example,
public ref class tThread
{
public:
XXXXXXXXXXXXX
};
I add this code in the Form1.h.
But it has a default class From1.
I create a new header file to include.
#include "mythread.h"
But it come some errors.
This is mythread.h
///////////////////////////
#ifndef MYTHREAD_H
#define MYTHREAD_H
public ref class tThread
{
public:
static void Threadsend();
}
#endif
/////////////////////////////
This is mythread.cpp
#include "mythread"
using namespace System::Threading;
static void Threadsend(){
Thread::Sleep( 0 );
}
What's wrong with my code or are there better method to do it?
Appreciate your reply.
Thank you.
Jane
|
|
|
|
|
Hi,
i never heared about a "ref class", but google lists some sites about it.
What do you like to do exactly?
Greetz
|
|
|
|
|
We have ref class and value class (on the CLI/C++) its better I write of MSDN
A ref class or ref struct can inherit from zero or more managed interfaces and zero or one ref types. A value class or value struct can only inherit from zero or more managed interfaces.
public ref class Items
{
private : int size;
....
};
public value class differ
{
private:
String^ str;
....
};
|
|
|
|
|
Hamid. wrote: We have ref class and value class (on the CLI/C++)
Seems as if you are in the wrong Forum...
Try your question in theManaged C++-Forum[^]
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
But I dont have any question.
|
|
|
|
|
There is no problem@@.
It works.
|
|
|
|
|
Hello,
I am confused about the type of vc++ .NET.
I want to use the string typed in the Textbox.
The property "Text" of Textbox has the type "string^".
I want to change it to char*.
I use the TextBox->Text->ToCharArray, but it is not char* type.
It is wchar_t type.
How could I convert the string^ type to char*?
Appreciate your reply.
Thank you.
Jane
|
|
|
|
|
|
|
Hamid. wrote: You asked on the wrong forum it was better you asked (Managed) C++/CLI[^].
i just going to do same.. you beat me this time!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Do you want to learning C++.Net?
|
|
|
|
|
Hamid. wrote: Do you want to learning C++.Net
yea want to.. any online tutor
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
If you remember we have a member on the codeproject Mr Nishant Sivakumar it has a good site see C++/CLI [^] for start.;)
|
|
|
|
|
Hamid. wrote: If you remember we have a member on the codeproject Mr Nishant Sivakumar it has a good site see C++/CLI [^] for start.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Thx
|
|
|
|
|
|
Hello again.
Hope someone can help me with this.
The program will form the whole picture by dragging small images and auto snapping.
Do you have any idea how to do this?
Or even a link to a sample program with the same function.
Thank you.
|
|
|
|
|
Hello.
I have a buncha files that were written in C in unix. It uses a few libraries that I don't have using Visual Studio 2005 (Win). How do I compile the files into a .dll under VC++ in Win?
|
|
|
|
|
If these files use unix libraries, then there is no way to port them for windows, unless you rewrite the parts which are system dependant.
|
|
|
|
|
Cedric Moonen wrote: If these files use unix libraries, then there is no way to port them for windows, unless you rewrite the parts which are system dependant
i have heard of some minigw type stuff who could compile library written in unix for windows enviornment!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
ThatsAlok wrote: i have heard of some minigw
Yes, but he asked specifically for VC++2005.
*Probably* he can compile and run his Unix-code with Mingw. It then remains a Unix-Program on a Wrapper around Windows.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
Hi, i have an SDI App, and i want to add some buttons dynamically(by NEW operator) to CFormView based Form. I don't know how to add my code to those buttons.
|
|
|
|
|
zarraza wrote: don't know how to add my code to those buttons.
When a button is clicked the button will send a WM_COMMAND message to the parent and the wparam of that message will be having BN_CLICKED.
Suppose you created the button with id 1234, do the processing as follows
overied the oncommand function of the CFormview through class wizard. Then inside that function check whether the HIWORD is BN_CLICKED and LOWORD is 1234..
<br />
if( HIWORD( wParam ) == BN_CLICKED && LOWORD(wParam) == 1234 )<br />
{<br />
AfxMessageBox( "Buttom is clicked" );<br />
}
|
|
|
|
|
Further to this you can utilise the MFC MessageMap to do this. Just add the ON_BN_CLICKED manually outside of the AFX_MSG_MAP comments. To keep things neat I always place my manual stuff relative to the MFC Wizard stuff here shown in italics
in the class declaration
//}AFX_MSG
void OnMyDynamicButton();
DECLARE_MESSAGE_MAP()
in the message map
//}}AFX_MSG_MAP
ON_BN_CLICKED(1234, OnMyDynamicButton)
END_MESSAGE_MAP()
void CMyFormView::OnMyDynamicButton()
{
// your button code
}
|
|
|
|