当前位置: 首页>>代码示例>>C++>>正文


C++ LPDIRECTDRAWSURFACE7::FreePrivateData方法代码示例

本文整理汇总了C++中LPDIRECTDRAWSURFACE7::FreePrivateData方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDIRECTDRAWSURFACE7::FreePrivateData方法的具体用法?C++ LPDIRECTDRAWSURFACE7::FreePrivateData怎么用?C++ LPDIRECTDRAWSURFACE7::FreePrivateData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LPDIRECTDRAWSURFACE7的用法示例。


在下文中一共展示了LPDIRECTDRAWSURFACE7::FreePrivateData方法的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;
}
开发者ID:GYGit,项目名称:reactos,代码行数:47,代码来源:private_data.cpp


注:本文中的LPDIRECTDRAWSURFACE7::FreePrivateData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。