Official BS.Player forums  

Go Back   Official BS.Player forums > Main forum > General Talk And Support

General Talk And Support General talk and peer-to-peer support about BS.Player and other video and audio multimedia players.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 22nd July 2004
Junior Member
BS.Player Newbie
 
Join Date: Jul 2004
Posts: 5
Rep Power: 0
cb4zztn is an unknown quantity at this point
Default 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
Reply With Quote
  #2 (permalink)  
Old 23rd July 2004
Senior Member
BS.Player Power User
 
Join Date: Feb 2004
Posts: 126
Rep Power: 0
RafkeP is an unknown quantity at this point
Default

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.
Reply With Quote
  #3 (permalink)  
Old 23rd July 2004
Junior Member
BS.Player Newbie
 
Join Date: Jul 2004
Posts: 5
Rep Power: 0
cb4zztn is an unknown quantity at this point
Default

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
Reply With Quote
  #4 (permalink)  
Old 23rd July 2004
Senior Member
BS.Player Power User
 
Join Date: Feb 2004
Posts: 126
Rep Power: 0
RafkeP is an unknown quantity at this point
Default

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.
Reply With Quote
  #5 (permalink)  
Old 23rd July 2004
Junior Member
BS.Player Newbie
 
Join Date: Jul 2004
Posts: 5
Rep Power: 0
cb4zztn is an unknown quantity at this point
Default

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
Reply With Quote
  #6 (permalink)  
Old 26th July 2004
Member
BS.player Regular User
 
Join Date: May 2003
Posts: 38
Rep Power: 0
Halle is an unknown quantity at this point
Default

try typecasting the 3rd parameter, i.e. SendMessage(bsp_hand,WM_COPYDATA,(unsigned int*)mWnd,(LPARAM)&cds);
Reply With Quote
  #7 (permalink)  
Old 30th July 2004
Junior Member
BS.Player Newbie
 
Join Date: Jul 2004
Posts: 5
Rep Power: 0
cb4zztn is an unknown quantity at this point
Default

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...
Reply With Quote
  #8 (permalink)  
Old 31st July 2004
bst's Avatar
bst bst is offline
BS.Developer
BS.Player Power User
 
Join Date: Jun 2002
Posts: 181
Rep Power: 10
bst will become famous soon enoughbst will become famous soon enough
Default

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;

}
Reply With Quote
  #9 (permalink)  
Old 20th August 2004
Junior Member
BS.Player Newbie
 
Join Date: Jul 2004
Posts: 5
Rep Power: 0
cb4zztn is an unknown quantity at this point
Default

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

Tags
bspgetfilename, osd

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules


All times are GMT +1. The time now is 02:33 PM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2019, 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