After doing a lot of fruitless playing with this I sent Lee Bamber an Email and this is his response:
Quote: "
Unfortunately I implemented mOcean in the Goals app (which is C++ with DarkGDK). The component itself needs around 20-30 lines of code to set-up and have in your app, and towards the end of the work I did mOcean sent me an example which sends the advert to a texture, which works out much better for potential DBP users
I think at some point a third party module which can accept the mOcean developer profile (zone id, app id, site id) and spit out an image so the user can place it anywhere (paste it, put it on a 3D object, e.t.c.) would be the best way to go.
I have copied the code I used below in case you want to expand on the DarkGDK approach (or to suggest someone write a small module for DBP which embodies the code)...
"
// prepare ATL
HRESULT hRes = ::CoInitialize(NULL);
ATLASSERT(SUCCEEDED(hRes));
::DefWindowProc(NULL, 0, 0, 0L);
AtlInitCommonControls(ICC_BAR_CLASSES);
AtlAxWinInit();
// init ad engine
BOOL bInitAdOkay = FALSE;
#ifdef DEBUG
bInitAdOkay = InitializeEngine(NULL);
#else
bInitAdOkay = InitializeEngine(&id);
#endif
if ( bInitAdOkay==FALSE )
return;
// create a dbanner
m_hWnd = pGlob->hWnd;
m_ad = CreateBanner( m_hWnd, -50000, 50000, 1, 1 );
if (m_ad)
{
m_ad->ZoneId = _T("TGCzoneID");
m_ad->SiteId = _T("TGCsiteID");
m_ad->Mode = CAdViewControl::MODE_ADS_ONLY;
m_ad->Type = CAdViewControl::ADS_TYPE_TEXT_AND_IMAGES;
m_ad->ReloadPeriod = 30000;
m_ad->AppId = _T("0xB0BLAHEE,0x50BLAHF5,0x92BLAH6A,0x34BLAH16");
m_ad->ImageMaxWidth = dbDesktopWidth();
m_ad->ImageMaxHeight = dbDesktopHeight();
m_ad->ImageMinWidth = 0;
m_ad->ImageMinHeight = 0;
m_ad->set_BackgroundColor( _T("#000000"));
m_ad->set_HorizontalAlignment(CAdViewControl::HORZ_CENTER);
m_ad->set_VerticalAlignment(CAdViewControl::VERT_CENTER);
#ifdef DEBUG
m_ad->TestModeEnabled = true;
#endif
// go advert!
m_ad->Run();
// cut hole in render (DirectX should not 'present' a render OVER the ad area)
g_pRectHole = new RECT[1];
pGlob->dwSafeRectMax = 1;
pGlob->pSafeRects = g_pRectHole;
pGlob->pSafeRects->left=0;
pGlob->pSafeRects->right=640;
pGlob->pSafeRects->top=405;
pGlob->pSafeRects->bottom=480;
// initially hide ad area (bring back if get ad size call)
m_ad->MoveWindow( 0, -50000, 1, 1 );
pGlob->dwSafeRectMax = 0;
}
// release fix ad at base of screen (force at 320x100 - ads streamed inwill change this)
CSize testchange = CSize( 320, 100 );
OnAdImageSize(testchange);
// your app main loop
while ( LoopGDK ( ) )
{
// game code here
}
// free ad engine
UninitializeEngine();
::CoUninitialize();
Quote: "
And you will also need this function:
"
void OnAdImageSize(CSize sz)
{
// math to cut correct size hole into DirectX present render layer
int iWidth = sz.cx;
int iBottomMargin = (sz.cy + 4);
if ( sz.cy>0 )
{
RECT rc;
GetClientRect(m_hWnd,&rc);
int iWindowPixelY = rc.bottom - iBottomMargin;
m_ad->MoveWindow( 0, iWindowPixelY, (rc.right-rc.left)+20, iBottomMargin );
int iScreenToSurface = (float)iBottomMargin / ( (float)rc.bottom / 480.0f );
float fRatio = 1.0f;
pGlob->pSafeRects->top=480-((float)iScreenToSurface*fRatio);
bGotAdvert = true;
pGlob->dwSafeRectMax = 1;
}
else
{
m_ad->MoveWindow( 0, -50000, 1, 1 );
pGlob->dwSafeRectMax = 0;
}
}
Quote: "
As I say, mOcean have an example which streams the ad to a texture instead of an ATL window (which is a thousand times better as you don't need to cut a hole in the present layer. Hopefully the above is some help (for someone)
If I get strong interest from the AppUp community, and from mOcean and Intel, I might spend a few days creating an extension to the AppUp DLL to include this ad component.
Best Regards,
Lee.
"
If anyone
can help get this into some kind of simple dll I (and the community) would be really greatfull! My efforts at making dlls have been pretty poor.
Frankly if someone could make me a template for a DBP project solution in Visual Studio 2008 that would be enough for me to at least try to get this working as I seem to have some kind of block getting any kind of DBP dll (made by me) to work.
It's crazy that I write C# dlls every day at work and yet for some reason I can't seem to wrap my head around the C++ setup for DBP...