Creating OSD from an C# Application

Module API help / support section for programmers.

Moderators: Dreamer, FredB, X05

Isch
Just popping in
Posts: 4
Joined: Sun Jan 13, 2008 1:14 pm

Creating OSD from an C# Application

Postby Isch » Sun Mar 02, 2008 4:32 am

Hello,

i´m trying to create an OSD surface using an C++ DLL. Here is the code:

int OSDTEST(HWND DDHWND, DWORD dwHeight, DWORD dwWidth, DWORD dwLeft, DWORD dwTop, BYTE Transparency)
{

TOSDSurface osd;
osd.dwSize = sizeof(osd);
osd.dwHeight = dwHeight;
osd.dwWidth = dwWidth;
osd.dwTop = dwTop;
osd.dwLeft = dwLeft;
osd.Transparency = Transparency;
int hOSD = SendMessage(hAPP, WM_MODULE_MSG, DDMODAPI_OSD_CREATE_SURFACE, (LPARAM)&osd);
return hOSD;
//SendMessage(hAPP, WM_MODULE_MSG, DDMODAPI_OSD_SHOW_SURFACE, hOSD);

}

I call this function from my C# application. The code:

[DllImport("DDOSDHelper.dll")]
static extern int OSDTEST(IntPtr DDHWND, UInt32 dwHeight, UInt32 dwWidth, UInt32 dwLeft, UInt32 dwTop, byte Transparency);

...
OSDTEST(xxx, 50, 50, 10, 10, 1);
...

Evertime i call this code an error occurs in DD (see attached file).

Can anyone help?

Thanks
Isch
Attachments
DD_ERRORLOG.TXT
ERRORLOG
(36.31 KiB) Downloaded 477 times

TT-budget S2-3200
User avatar
rel
relocation
Posts: 2051
Joined: Fri Jun 16, 2006 9:50 am

Postby rel » Sun Mar 02, 2008 6:43 am

the parameter you send through SendMessage should be in the same memory space with DvbDream.

so you can call this function only from a module (*.mod placed into \modules) otherwise there will be access-violations. (different apps = different memory space = different addressing)
DVB Dream - because I have to dream about having time to code it
smarg
Just can't stay away
Posts: 35
Joined: Tue Apr 17, 2007 12:52 pm

Postby smarg » Wed Mar 05, 2008 7:39 am

You can do it with standalone app.

You need to allocate memory in DD process (with VirtualAllocEx API) of sizeof(TOSDSurface) size, fill local structure, copy the structure to the DD process with WriteProcessMemory API and then send message while passing the address of allocated memory in DD process.

Don forget to free DD memory when you finished, otherwise there will be memory leak in DD :)
DFI RS482 Mobo - AMD 3200 Venice core - SS2 2.6B - Vista Ultimate 32bit - DD 1.3c
Isch
Just popping in
Posts: 4
Joined: Sun Jan 13, 2008 1:14 pm

Postby Isch » Sat Mar 08, 2008 4:51 am

Thanks for your tip.

Creating the OSD is working now!

Now my problem is to read the bitmap from DD´s memspace.
I use ReadProcessMemory, but how can i get the size of the OSD bitmap?

Any ideas?
TT-budget S2-3200

Return to “Module / Plugin Programming”

Who is online

Users browsing this forum: No registered users and 1 guest