本文整理汇总了C++中LPDIRECTDRAWSURFACE7::GetPrivateData方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDIRECTDRAWSURFACE7::GetPrivateData方法的具体用法?C++ LPDIRECTDRAWSURFACE7::GetPrivateData怎么用?C++ LPDIRECTDRAWSURFACE7::GetPrivateData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPDIRECTDRAWSURFACE7
的用法示例。
在下文中一共展示了LPDIRECTDRAWSURFACE7::GetPrivateData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Test_PrivateData
BOOL Test_PrivateData (INT* passed, INT* failed)
{
LPDIRECTDRAWSURFACE7 Surface;
DWORD size, dummy = 0xBAADF00D;
GUID guid = { 0 };
GUID guid2 = { 0x1 };
if(!CreateSurface(&Surface))
return FALSE;
// General test
TEST(Surface->SetPrivateData(guid, NULL, 0, 0) == DDERR_INVALIDPARAMS);
TEST(Surface->SetPrivateData(guid, (LPVOID)&dummy, 0, 0) == DDERR_INVALIDPARAMS);
TEST(Surface->SetPrivateData(guid, (LPVOID)0xdeadbeef, sizeof(DWORD), 0) == DDERR_INVALIDPARAMS);
TEST(Surface->SetPrivateData(guid, (LPVOID)&dummy, sizeof(DWORD), 0) == DD_OK);
TEST(Surface->GetPrivateData(guid, NULL, 0) == DDERR_INVALIDPARAMS);
TEST(Surface->GetPrivateData(guid, &dummy, 0) == DDERR_INVALIDPARAMS);
size = 0;
TEST(Surface->GetPrivateData(guid, &dummy, &size) == DDERR_MOREDATA && size == sizeof(DWORD));
size = 2;
TEST(Surface->GetPrivateData(guid, NULL, &size) == DDERR_MOREDATA && size == sizeof(DWORD));
TEST(Surface->GetPrivateData(guid, NULL, &size) == DDERR_INVALIDPARAMS);
TEST(Surface->GetPrivateData(guid, &dummy, &size) == DD_OK && dummy == 0xBAADF00D);
TEST(Surface->GetPrivateData(guid2, NULL, 0) == DDERR_NOTFOUND);
TEST(Surface->FreePrivateData(guid) == DD_OK);
TEST(Surface->FreePrivateData(guid) == DDERR_NOTFOUND);
// Test for DDSPD_VOLATILE flag
TEST(Surface->SetPrivateData(guid, (LPVOID)&dummy, sizeof(DWORD), DDSPD_VOLATILE) == DD_OK);
size = 0;
TEST(Surface->GetPrivateData(guid, NULL, &size) == DDERR_MOREDATA && size == sizeof(DWORD));
TEST(Surface->GetPrivateData(guid, &dummy, &size) == DD_OK && dummy == 0xBAADF00D);
DDBLTFX bltfx;
bltfx.dwSize = sizeof(DDBLTFX);
bltfx.dwFillColor = RGB(0, 0, 0);
if(Surface->Blt(NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &bltfx) != DD_OK)
printf("ERROR: Failed to draw to surface !");
TEST(Surface->GetPrivateData(guid, &dummy, &size) == DDERR_EXPIRED);
// TODO: Test for DDSPD_IUNKNOWNPOINTER (see http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/ddraw7/directdraw7/ddref_5qyf.asp)
Surface->Release();
return TRUE;
}