DirectDrawCreate/SetCooperativeMode problems
- Posted by animeshk at yahoo.com Apr 12, 2003
- 521 views
I tried using EuCOM & TBrowser to create a wrapper for dx7vb.dll. My first attempt to use this failed: I used create_com_object to create the DirectX7 object, but when I tried to use call_interface to call the DirectX7 objects "DirectDrawCreate" method. This didn't work: the VB docs show that the "DirectDrawCreate" method is supposed to return a DirectDraw object, but call_interface only returns an HResult. Okay. Next attempt! This time, I followed what the EuCOM Direct3d demo did. I opened the "ddraw.dll" .dll. I used the following to define the DirectDrawCreate fcn: ddrawc = define_c_func(ddrawdll, "DirectDrawCreate", {C_POINTER, C_POINTER, C_POINTER}, C_UINT ) to define the fcn. First param is a ptr to a GUID, in my case null. The second is where they will return the pointer to the DirectDraw object. The third is that "unknown" param, also always set to null. To call this, I defined a ddraw_ptr object, and I used acquire_mem to initialize it. I called the fcn with res = c_func( ddrawc, {NULL, ddraw_ptr, NULL}) Afterwards, I initialized the ddraw object by doing a peek4u on the ddraw_ptr. Finally, I called ref_com_object: ddraw = ref_com_object( DirectDraw7_clsid_ix, ddraw ) So far, so good. Problem is when I call SetCooperativeLevel: res = call_interface( ddraw, DirectDraw7_disp, DirectDraw7_SetCooperativeLevel, { getHandle(MainWin), DDSCL_NORMAL } ) Now, I keep getting a return value of 2147500034, which is the error code DIERR_NOAGGREGATION. I think this means that it thinks, in the call to DirectDrawCreate, I didn't set the third param to null . . . but I did. Has anyone else seen this? Does anyone have a solution for this? Thanks! --Animesh