public value struct ListOfWindows
{
HWND hWindow;
int winID;
String^ capName;
};
现在这就是我的结构我已经创造了他们的数组:阵列结构CLI的
array<ListOfWindows ^>^MyArray = gcnew array<ListOfWindows ^>(5);
现在来测试其是否正常工作我做了一个简单的函数:
void AddStruct()
{
HWND temp = ::FindWindow(NULL, "Test");
if(temp == NULL) return;
MyArray[0]->hWindow = temp; // debug time error..
return;
}
错误: An unhandled exception of type 'System.NullReferenceException' occurred in Window.exe
Additional information: Object reference not set to an instance of an object.
不知道该干什么d o ..有点新的CLI,所以如果你能帮助请做.. 谢谢。
你不分配数组元素,你刚才分配阵列 – 2010-04-06 10:43:41