Hello world.
I had a bug in my program, so I did some experiments and found the following code ends up
throws an exception after running for a while.
while ( 1 )
{
System::Drawing::Bitmap^ pBitmap = gcnew System::Drawing::Bitmap( 500, 500 );
this->Cursor = gcnew System::Windows::Forms::Cursor(pBitmap->GetHicon());
}
I can't find any clue to that exception.
What's wrong?
So I change the code to this
while ( 1 )
{
System::Drawing::Bitmap^ pBitmap = gcnew System::Drawing::Bitmap(500,500);
System::Windows::Forms::Cursor^ pCursor = gcnew System::Windows::Forms::Cursor(pBitmap->GetHicon());
delete pBitmap;
delete pCursor;
}
The same exception still gets thrown.
Any clue will be thankful.