Official BS.Player forums

Official BS.Player forums (http://forum.bsplayer.com/)
-   General Talk And Support (http://forum.bsplayer.com/general-talk-support/)
-   -   BSP_GetFileName and the OSD (http://forum.bsplayer.com/general-talk-support/5067-bsp_getfilename-osd.html)

cb4zztn 22nd July 2004 03:17 PM

BSP_GetFileName and the OSD
 
Hi,

first of all great player!

I'm currently trying to write a little BSPlayer2Mirc-thingie for myself and so far displaying movielength, current position and player-version is working but getting the filename still doesn't somehow. I've looked through the forum but didn't find a solution.

I mainly used the code from the SDK:

----
HWND bsp_hand = FindWindow("BSPlayer",NULL);

COPYDATASTRUCT cds;

char buf[MAX_PATH];
void *adr;
adr=&buf;

cds.dwData=BSP_GetFileName;
cds.lpData=&adr;
cds.cbData=4;
SendMessage(bsp_hand,WM_COPYDATA,0,(LPARAM)&cds);

strcpy(data, buf);
---

Problem is all I get in buf (and data) are strange I-like chars as if buf would still be uninitialized. The whole thing is a function within a DLL.
Any ideas what could be wrong? :/

And there's something else: is it possible to message the OSD any text to display? I'd like to display lines from an IRC-chan in the player so watching in fullscreen wouldn't result in missing stuff. ;) I already did that with DScaler an got kinda used to it. ;)

//Sebastian

RafkeP 23rd July 2004 07:25 AM

Sebastian,

The command to get the filename is indeed :
SendMessage(bsp_hand,WM_COPYDATA,appHWND,(LPARAM)& cds);

Are you sure the handle to your application = 0 ?

If you want to know how to write text to the OSD, take a look at the sampleplugin.c file in the SDK subdirectory.
I'm sure you'll find all the info you need in there.

Good luck,
Rafke P.

cb4zztn 23rd July 2004 11:35 AM

Thanks Rafke!
Well I actually get the application handle from MIRC, in fact 2 , but whenever I try to use either of them in SendMessage the compiler says

---
error C2664: 'SendMessageA' : cannot convert parameter 3 from 'struct HWND__ *' to 'unsigned int'
---

The function gets HWND mWnd, HWND aWnd as parameters and

---
SendMessage(bsp_hand,WM_COPYDATA,mWnd,(LPARAM)&cds );
---

... and with aWnd, gives me that error. I was looking for a way to maybe get the handle of that DLL but I don't know if DLL's even got handles, I'm not used to those things yet. :/
All other SendMessage-calls without using WM_COPY don't seem to need any specific application handle, they're working. It's just that Filename-thingie...


That sampleplugin.c looks interesting, thanks for the hint!

//Sebastian

RafkeP 23rd July 2004 01:20 PM

To be honest : I'm new to this dll thing myself and I'm not so good a coder.
Fortunately for me BSPlayer is well documented, so I managed to get my things working.

I have the feeling that you are writing a plugin for Mirc.
(unlike me : I wrote a plugin for BSplayer)
So the answer will be in the Mirc documentation.

I suppose both Mirc and your plugin will have a (different) handle.

I'll explain you how I did mine, maybe that will help you in a way.
Take another look at the sampleplugin.

In the bspplg.h you will notice there is a structure called pluginInfo.
In that structure there is a HWND called hwndParent and that is the one I need. So to get the name of the file I call :

SendMessage(bsp_hand,WM_COPYDATA, pInfo->hwndParent,(LPARAM)&cds)

Try and see if you find something similar in the Mirc SDK.

cb4zztn 23rd July 2004 08:33 PM

Yeah it's a mirc-plugin, sorry I missed to mention it.

Hmm seems like the right application handle would be really important. Confusing stuff... :roll: :lol:

Thanks for your help Rafke. Maybe I find a solution then I'll post it here.

If anybody else has any idea please post it, thanks. :)

Sebastian

Halle 26th July 2004 08:50 PM

try typecasting the 3rd parameter, i.e. SendMessage(bsp_hand,WM_COPYDATA,(unsigned int*)mWnd,(LPARAM)&cds);

cb4zztn 30th July 2004 03:21 PM

Thanks Halle. Hmm yeah I tried that and as it didn't work "(WPARAM)(HWND) mWnd" as third parameter. SendMessage returns TRUE so it should be processed by BSPlayer but somehow the text in buf doesn't change at all.

I wonder what the application handle as third parameter is good for anyway, it seems to me as if the function in the BSPlayer source dealing with the sent messages is only supposed to change stuff, like the content of buf, in the COPYDATASTRUCT using the pointer...

bst 31st July 2004 07:52 AM

This should work.
You can call it
$dll(DLLNAME.dll, GetBSPMovieName, 0) and you will get full path
or
$dll(DLLNAME.dll, GetBSPMovieName, 1) for filename without path.

Code:

int __stdcall GetBSPMovieName(HWND mWnd, HWND aWnd, char *data, char *parms, BOOL show, BOOL nopause)
{

        HWND bsp_hand;
        if ( (bsp_hand = FindWindow("BSPlayer",NULL)) !=0 ) {
                COPYDATASTRUCT cds;

                char buf[MAX_PATH];
                void *adr;
                adr=&buf;

                cds.dwData=BSP_GetFileName;
                cds.lpData=&adr;
                cds.cbData=4;
                SendMessage(bsp_hand,WM_COPYDATA,(WPARAM)aWnd,(LPARAM)&cds);

                if (strcmp(data,"0")==0)
                        strcpy(data, buf);
                else
                {
                        char *p=strrchr(buf,'\\');
                        strcpy(data, ++p);
                }

                return 3;
        }

        return 1;

}


cb4zztn 20th August 2004 10:58 AM

GREAT! Thanks a lot!! It's workin. :D :D


All times are GMT +1. The time now is 11:42 AM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
Ad Management plugin by RedTyger


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20