|
Try checking out the VFC library. It has both and makes porting to linux easy. It is in beta state but it is quite stable. It is on sourceforge. It has gui, threads, resources, and file io, and more. Web address http:\\vcf.sourceforge.net
|
|
|
|
|
Hi Guys,
I wish to get an alternative of CObject and Clist classes in MFC so that i can use it in my code for the Linux Platform.
Can any one suggest me !
Thanks !
|
|
|
|
|
If all you want is the functionality provided in those classes then for CList you could just use the STL list class. If you just want an MFC-like framework then your best bet is to try wxWidgets or Qt, both of which are cross-platform. I've not used either but presumambly they will have collection classes.
Kevin
|
|
|
|
|
Hi,
can you help me to add a System Menu (Minimize, Restore, Close icons on right corner up of a Window) into a rebar with inside a custom menu?
All application developed with C++ and Win 32 (without MFC).
Thanks.
Nando.
|
|
|
|
|
Hi,
I am using unmanaged c code from managed c++ 7 code.
I need to convert a managed c++ 7 code function pointer to a user defined fucntion pointer type which is defined in c code. For instance
I have
int CWrapper::functionA(int a, double b);
and I want to type cast it into MyFunctionPtr. where MyFunctionPtr is defined in unmanaged c code as
typedef int (*MyFunctionPtr)();
If this functionA was a c function then this typecast is valid and tested but if I do it from managed c++ 7 code, I get a linking error
Can some one help me in correcting this type cast?
Thanks
Bilal Farooq
|
|
|
|
|
Herb Sutter - Is C++ Relevant on Modern Environments?
http://www.accu.org/conference/presentations/[^]
Herb's answer...
Q: Which .NET language should you use?
Microsoft’s answer, in our Whidbey release:
• C++ is the recommended path to .NET and Longhorn.
• If you have an existing C++ code base:
Keep using C++.
• If you want to make frequent use of native code/libs:
Use C++. It’s far simpler (seamless) and faster.
• If you want to write brand-new pure-.NET apps that
rarely or never interop with native code:
Use whatever language you’re already comfortable with,
and pick based on language features. The .NET features
and Frameworks library are available equally through all
languages.
Kevin
Kevin
|
|
|
|
|
Herb says good things
And I think we actually support generics better than C# does for whidbey, but don't quote me on it.
|
|
|
|
|
I can comfirm that.
With VisualStudio 2005 (Whidbey) they will ship a whole new Version of C++, called C++/CLI.
I've seen a presentation of it at the TechEd last weekend and was simply blown away.
You get all the well known controll of C++ and all the features of C# ... like gc, ref, interfaces.
TechED Bloggers
- Newro
|
|
|
|
|
hello..
i'm not sure whether this is the right place to ask this question, sorry if i'm in the wrong place. here goes:
say i have a string, for example 'the code project'
i'd like to swap two characters at once.. for example i'd like to swap 'th' in 'the' with 'co' in 'code'.. how can i do that efficiently? i was thinking of collecting the letters into one variable: a = th and b = co and then swap them but i think it's ridiculous to do that.. can anyone give me any suggestions? i thank you in advance for your guidance
thanks!
~wilDcat~
|
|
|
|
|
Hello,
I have some troubles on writing my Managed C++ wrapper on the very good physics engine Tokamak.
To use Tokamak (simply), I have to create 1 simulator instance and several
bodies with Tokamak C++ interface :
class TOKAMAK_API neSimulator {
public:
// Static factory functions
static neSimulator * CreateSimulator(const neSimulatorSizeInfo & sizeInfo, const neV3 * gravity = NULL);
static void DestroySimulator(neSimulator * sim);
...
// Rigid body managment functions
neRigidBody * CreateRigidBody();
void FreeRigidBody(neRigidBody * body);
...
};
So my .NET Managed C++ wrapper is like this :
public __gc class Simulator {
private public:
neSimulator __nogc *_Simulator;
public:
Simulator() {
_Simulator = neSimulator::CreateSimulator(*(sizeInfo->_SimulatorSizeInfo),NULL,&V3_gravity);
}
~Simulator() {
neSimulator::DestroySimulator(_Simulator);
}
...
};
public __gc class RigidBody {
private public:
Simulator __gc *_Simulator;
neRigidBody __nogc *_RigidBody;
public:
RigidBody(Simulator __gc *simulator) {
_Simulator = simulator;
_RigidBody = _Simulator->_Simulator->CreateRigidBody();
}
private:
~RigidBody() {
if (_RigidBody != NULL)
if (_Simulator != NULL)
if (_Simulator->_Simulator != NULL)
_Simulator->_Simulator->FreeRigidBody(_RigidBody);
_RigidBody = NULL;
_Simulator = NULL;
}
...
};
All is OK at the beginning : 1 simulator instance, 5 rigid body instances
...
Problem appears when Garbage Collector calls finalizers at the end of my test, it calls for example :
~RigidBody() for body 1
~RigidBody() for body 2
~Simulator() !!!! Why is it freed ? There is yet 3 rigid body instances not freed which have reference on it !!!
~RigidBody() for body 3 -> Access to undefined object _Simulator !!!
Is there any solution to inform Garbage Collector about multiple _Simulator
references ?
Thanks
greg
|
|
|
|
|
I want to use a FileNameEditor in which you can select only bitmap files, so I overloaded FileNameEditor, and in the InitializeDialog function, I set the Filter member to only show bitmap files. But this doesn't work. It does work fine when I just specify FileNameEditor as editor, but even when I only overload the FileNameEditor into a new class, without even adding any members, it doesn't work. I have done this before, in c#, and there it worked perfectly, and the managed c++ version doesn't work. There just isn't an ellipses button in my property grid.
The c# class that worked fine:
class ImageFileEditor : FileNameEditor
{
public ImageFileEditor()
{
}
protected override void InitializeDialog(OpenFileDialog dlg)
{
dlg.Title = "Select Image";
dlg.Filter = "Bitmap Files (*.bmp)|*bmp";
}
}
and the managed c++ version that doesn't work:
__gc class ImageFileEditor : public FileNameEditor
{
public:
ImageFileEditor()
{
}
protected:
virtual void InitializeDialog(OpenFileDialog *pDlg)
{
pDlg->Title = S"Select Image";
pDlg->Filter = S"Bitmap Files (*.bmp)|*.bmp";
}
};
And this is the property that should use the ImageFileEditor. If I change ImageFileEditor to FileNameEditor it works fine though.
[Category(S"Base Texture"),
EditorAttribute(__typeof(ImageFileEditor),__typeof(UITypeEditor))]
__property String* get_BaseImageName()
{
return pBaseImageName;
}
__property void set_BaseImageName(String *value)
{
pBaseImageName = value;
}
How should I do this?
Thank you
|
|
|
|
|
Hi,
I am writting the Huffman code algorithm now, I have built the huffman tree and stored the
corresponding binary string for each character ( 0-255)into a string array named arr_code, and got a list of binary string for the input file. my question is how can I transfer the binary string into
bit size then get it compressed?
Thanks!
|
|
|
|
|
I would pad the string with zeros up to length which can be divided by 8. And then I would read each time 8 characters and convert it into byte let's say by multipling already calculated part and adding value of a new bit character or by using << operator.
I hope this helps
DavidR
|
|
|
|
|
Thanks so much for your reply. I already finished this program last week. Now I am reading the "rice coding" algorithm if I have any question, I will post the question here. Thank you again!
JJ
|
|
|
|
|
I am just beginning to get into designing (hand-coding) forms with .Net using C++. I am trying to write a very simple application that has buttons on it and draws a black ball every 10 milliseconds that bounces around the screen which I plan to use to learn more about programming in .Net and as a reference for future programs. I placed every function and variable in a single class (except the main() function) that extends the Form class. I placed a call to Invalidate(), Update(), and Sleep(10) (in that order) in an idle function which I then used as the function to handle the Application Class's Idle event. The program does draw the black ball properly and does call the idle function but it only calls it after another event occures (such as when the mouse is moved over the form). I was wondering whether anyone could either tell me a way to fix this problem so that the black ball is drawn and moved every 10 milliseconds or provide me with a better way to do this. Any help on this would be greatly appriciated.
|
|
|
|
|
You could use a high resolution timer to drive the animation if you have hardware that supports it. Otherwise you could use a secondary thread that calls ::Sleep(10)
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
Thank you very much for your prompt response but as I said, I am just getting started with .Net so could you please clarify exactly how I would do this. Thanks in advance for any help on this subject.
|
|
|
|
|
|
Thanks for the information and I tried implementing it in the paint event handler as shown below:
<br />
void formOn_Paint(Object* sender, PaintEventArgs* e)<br />
{<br />
...
Invalidate();
Update();
System::Threading::Thread::Sleep(10); Sleep for 10 milliseconds.<br />
}<br />
Unfortunately, this code makes the program run extremely sluggishly and I have a new computer with a Pentium 4 so I really doubt it is the hardware. I used to have this code done in the application's idle handler (the drawing and moving of the black ball was still handled in the Form's paint event handler) as shown below:
<br />
void onIdle(Object* sender, EventArgs* e)<br />
{<br />
Invalidate();<br />
Update();<br />
System::Threading::Thread::Sleep(10);<br />
}<br />
Both of these functions are members of the class that is used as the parameter to the Run() function of the Application class so the keyword 'this' is implied when referring to the functions Invalidate() and Update().
Thanks in advance for any help you can provide me with on this subject.
|
|
|
|
|
>> you could use a secondary thread that calls ::Sleep(10)
You are calling sleep in the primary or UI thread. That is NOT a secondary thread and it is just not going to work very well.
-pete
|
|
|
|
|
Thank you very much for your help, that solved my problem.
|
|
|
|
|
i need to know what the nFolder variable for the value "56" is in the function SHGetFolderPath
HRESULT SHGetFolderPath( HWND hwndOwner,
int nFolder,
HANDLE hToken,
DWORD dwFlags,
LPTSTR pszPath
);
i browsed msdn, but there was no variable with such value,
pls help
thanks in advance
|
|
|
|
|
from ShlObj.h
#define CSIDL_RESOURCES 0x0038 // Resource Direcotry
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
my problem is disassembling managed c++ assemblies, so that when i try to re-compile the IL i don't get errors for functions, containing 'modopt' in their name.
If you can, please tell me how to disassemble such .net assemblies.
Thanks in advance,
Stan
|
|
|
|
|
Do you have a code sample that reproduces the problem? It sounds like a possible ildasm bug.
Matt
Visual C++ FE
|
|
|
|