|
Here is a *fun* problem:
How do you prototype a derived class?
To add some code to the situation:
This is what I want to do:
namespace ManagedConsoleXPControls
{
public __gc __abstract class ConsoleControlBase : public CollectionBase;
}
However, good 'ol VS 2003 gives me a nasty error:
c:\Projects\Windows Forms\Managed Console\MC - Console XP\MCXP-Prototypes.h(20): error C2143: syntax error : missing ',' before ';'
I'm quite certain that this error pertains to this single line in the code.
Does anyone have any bright ideas?
|
|
|
|
|
Anonymous wrote:
namespace ManagedConsoleXPControls
{
public __gc __abstract class ConsoleControlBase : public CollectionBase;
}
namespace ManagedConsoleXPControls
{
public __gc __abstract class ConsoleControlBase : public CollectionBase{};
}
leppie::AllocCPArticle(Generic DFA State Machine for .NET);
|
|
|
|
|
Let me try it, but I have the feeling it will cause a "Symbol redefinition" type error.
Even if it doesn't work, thank you dearly for replying
|
|
|
|
|
Yep, it causes a "'class' type redefinition error" due to the fact that declaring it that way is basically saying ConsoleControlBase is an empty class. Humbug.
Thanks anyway.
Anyone else know how to do this? There has to be some way....
|
|
|
|
|
Why do you insist on including the inheritance in the prototype? In C++ you don't do that.
--
You know me. I sure know you.. Everyone of you!
|
|
|
|
|
is there any chance to writ apps for win98 with C++.NET and win2000pro?
thanks.
|
|
|
|
|
Yes, there is. As long as you don't use external technologies that need OS's higher than Windows 98, you'll be alright. The .NET Framework works with Windows 98 and up.
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
I have some problems whith the splitters. In design time it's O.K. But the problems start at run time, when I create some child Forms by code and I try to dock them inside a new splitter but it's impossible, the splitter ignores the correct order (it´ss been generated later than the Form child) and does not include the new child form inside. It's like the Form child is not treated like another design control inside the main Form.
Please, can anybody help me about the treatment and placement of splitters controls in run time with Windows Forms?
Thank you.
Raf.
|
|
|
|
|
Hi
I am looking for a free library that can skin my Form and buttons and everything. I have found some options for MFC and other things but want something for forms. Is it even possible?
thanks
|
|
|
|
|
It is possible. Take a look at this[^]. It's a project we are doing to make skinnable GUI components and controls for .NET and Win32.
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
I'm a newbie on the "managed" topic. Has anybody an experience on sending a gdiplus::Image reference to a managed function ?
My unmanaged function would look like that:
void foo( gdiplus::Image& image_);
Jonathan de Halleux.
|
|
|
|
|
Hello.
I'm a beginner in working with Managed C++ and I have a question.
I have read that it's possible to mix managed and unmanaged code in the same application, and I have been testing this.
I have created a simple Windows Form application and do some little things.
Then I have tryed to use a class that's its written in unmanaged C++ that make some things with CStrings.
After I have compiled this file ( I only added some includes to make it work ) I tried to use some functions of this class in my form file.
So when I added the include to this class, and build the application some error messages appear like this:
" error C2039: 'GetObjectA' : is not a member of 'System::Resources::ResourceManager'
stdafx.cpp(0) : see declaration of 'System::Resources::ResourceManager' "
In the error line the code that the Visual Studio wizard wrote it's this :
"this->imageList1->ImageStream = (__try_cast<system::windows::forms::imageliststreamer *="">(resources->GetObject(S"imageList1.ImageStream")));"
As you can see there is not GetObjetA call, instead its GetObject.
Any idea ? Thanks.
|
|
|
|
|
Hi
I had this same question earlier and someone told me that linkers are stupid. That's what I'll tell you because I am a newbie. The solution to your question is to undefine GetObject like so:
#undef GetObject
If you use System::Windows::Forms::MessageBox you will also need to undefine it.
Hope that helped and if anyone could explain why this is that would be great.
|
|
|
|
|
|
Since you're using CString in your umanaged project you're using MFC. Throught the MFC library there are many #defines in order for code to be compiled using either Ascii characters or Wide characters. When you complie your code the library will check what type of strings you should be compiling for and will then use the appropriate function. For you it was "GetObjectA" meaning your code was trying to compile using 16bit characters. You have to do it for the message box as well because it has both MessageBoxA and MessageBoxW functions so it can complie using either Ascii or Wide strings.
I hope that made some sense.
I'm not sure if that's completely right, as I'm not a pro programmer or anything.
- monrobot13
|
|
|
|
|
I'm not sure on the .net stuff still learning it myself. But from an MFC perspective xxxA is ascii ie 8bit chars whilst xxxW is unicode ucs16 ie 16bit characters. The normal way to control this is with a preprocessor define of MBCS or UNICODE. (MultiByteCharSet is just ascii 8bit characters with an escape character defined to encode further characters with a second 8bit character)
|
|
|
|
|
Slaru wrote:
someone
Me
Slaru wrote:
told me that linkers are stupid
No, I told you preprocessors are stupid. Somewhere in windows.h there is a preprocessor directive to turn every MessageBox into MessageBoxA or MessageBoxW, depending on whether it is a Unicode or non-Unicode build. Now, the *stupid* preprocessor does not know that your MessageBox is .NET MessageBox and not Win32 API MessageBox, and it turns System::Windows::Forms::MessageBox to System::Windows::Forms::MessageBoxA.
|
|
|
|
|
Here's the scenario:
// MyUnmanagedDll.dll
__declspec(dllexport) bool MyDll::Go(unsigned char *ptr){
// read from ptr and print out ptr's contents
MyPrint("During MyDll, ptr contains\n", ptr);
return true;
}
// MyManaged.cpp
namespace A{
[DllImportAttribute("MyDll.dll", EntryPoint="Go")]
extern "C" __declspec(dllimport) bool Go (unsigned char *ptr);
}
main(){
unsigned char* myPtr = new unsigned char(200);
for(int i=0; i<200; i++){
myPtr[i] = '0';
}
MyPrint("Before calling MyDll, ptr contains\n", myPtr);
MyDll::Go(myPtr);
MyPrint("The ptr now contains after call from MyDll\n", myPtr);
}
Output:
Before calling MyDll, ptr contains
00000000...(200 times)
During MyDll, ptr contains
00000008072000...(rest 0)
After MyDll, ptr contains
00000008072a0710000...(rest 0)
What is going on here? I tried marshaling the data from "unsigned char gcPtr __gc[]" into a LPArray, and same thing! I've also tried casting into an IntPtr, and same results, and also tried GC::KeepAlive(gcPtr), and no luck.
The corrupt data are 4 consecutive bytes during the Dll call, and 8 consecutive bytes when it returns. They range from 150th - 180th, depends (not sure why)
Any help would be greatly appreciated. Thanks much in advance!!
Cal
|
|
|
|
|
>unsigned char* myPtr = new unsigned char(200);
This line allocates only a single character, not an array. To allocate an array, call new unsigned char[200];
READIN writin rhythmetic
|
|
|
|
|
Hi All,
I'm using the magic Library in my MC++ app, but I'm running across a problem trying to access one of it's emums. The enum is declared like this in the source for the library:
public enum DisplayTabModes
{
HideAll,
ShowAll,
ShowActiveLeaf,
ShowMouseOver,
ShowActiveAndMouseOver
} and the property is declared like this:
public DisplayTabModes DisplayTabMode
{
get { return _displayTabMode; }
set
{
if (_displayTabMode != value)
{
_displayTabMode = value;
Notify(TabGroupBase.NotifyCode.DisplayTabMode);
}
}
} when I try to change the property using this code:
tabGroup->DisplayTabMode = TabbedGroups::DisplayTabModes::HideAll; I get this error:
error C2248: 'HideAll' : cannot access protected enumerator declared in class 'Crownwood::Magic::Controls::TabbedGroups::DisplayTabModes' Maybe I'm missing something, but it looks like "HideAll" is public. Anyone know what I'm doing wrong? Any help is much appreciated.
- monrobot13
|
|
|
|
|
Shouldn't your code be like this
Notify(TabGroupBase::NotifyCode::DisplayTabMode);
instead of
Notify(TabGroupBase.NotifyCode.DisplayTabMode);
A wild guess.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Anthony_Yio wrote:
instead of
// Propogate to all children
Notify(TabGroupBase.NotifyCode.DisplayTabMode);
This code is in the library which is written in C# so the .'s are correct.
|
|
|
|
|
Yes, the magic library is written in C# but when you are using MC++ syntax
You need to call using :: instead of .
the . mean different thing in MC++.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Hi all
i am writing a Managed C++ class which internally using unmanaged classes.
For my class to work,i need to pass the callback function pointer to one of my unmanaged class as shown below
__gc class MyClass : System::Object
{
UnmanagedClass* pUMClass;
static MyStatic(void*,unsigned long,unsigned long);
MyClass(void)
{
pUMClass = new UnmanagedClass();
pUMClass->SetCallback(&MyClass::MyStatic);
}
}
is it possible pass Managed method pointer to unmanaged class?
if possible how can i type cast void* parameter to my class type(which i'm setting as client data).
Thanks in advance
|
|
|
|
|
hi,
I want to redirect the windows telnet.exe to a MFC GUI (CRichEditCtrl).
I have manged to redirect cmd.exe but not the telnet.exe and the ftp.exe can someone help me. please E-mail me at
lior_zar@hotmail.com
|
|
|
|