开发者

Windows Controls or .NET objects as Global Variable in Visual C++

I'm Writing a C++ Class. I want to keep a global variable in System::Windows::Form::Control type or a .NET managed objects. I want to process something on this global variable. But Visual C++ is not allowed this.

Returning Error is: "global or static variable may not have managed type"

May be this error in开发者_JAVA百科terest Garbage Collector.

How I solve this problem?


use a non managed type like std::string


For a control, you could store the Handle (HWND) in your global variable and get the control back when you need it. For other managed objects, I don't know. Do they have an identifier that allows doing the same thing ?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜