Pls help with embedding wmp in a non-dialog mfc view

Hi,

I'd like to add mpeg, avi, and wmv playback capability to my mfc app.  I
thought that this would be quite simple if I decide to use Windows Media
Player ActiveX instead of DirectShow filtergraph.  Unfortunately that did
not happen (i.e. the 'simple' part).  First I struggled with Visual Studio
..NET - inserting wmp into the project did not generate CWnd derived wrapper
class (as stated in sdk docs).  Instead it generated COleDispatchDriver
derived class.  I did not want to waste any time on typing (clsid, create,
etc.) so I decided to use VC6 and generated CWnd derived wrapper classes.
Does anyone know why VS .NET does not generate CWnd derived class for wmp?

But my biggest problem is that the player control occasionally hangs the
application.  When this happens the CPU usage stays at 100%.  I think that
the problem occurs mostly at the time when the player switches between
different file types (e.g. from mpg to wmv).

My application does not play media files continuously.  It is event driven
and might play few clips in a row and then no clips for few minutes.  When a
given clip is being played the app does not 'know' if another clip will
follow immediately or not.

All examples that I've seen so far for WMP and mfc were based on the player
control embedded in a dialog box.

Could anyone please give me an example of a working code or point me to a
proper documentation?

The code I use to control the player looks something like this:

// Setup/creation
m_wmpPlayer.Create(NULL, WS_VISIBLE, CRect(0, 0, 0, 0), m_pParentWnd,
m_nControlID);
m_wmpPlayer.SetEnableContextMenu(FALSE);
m_wmpPlayer.SetEnabled(TRUE);
m_wmpPlayer.SetFullScreen(FALSE);
m_wmpPlayer.SetWindowlessVideo(FALSE);
m_wmpPlayer.SetUiMode(L"none");
m_wmpPlayer.SetStretchToFit(TRUE);
CWMPSettings wmpSettings = m_wmpPlayer.GetSettings();
wmpSettings.SetAutoStart(FALSE);
wmpSettings.SetEnableErrorDialogs(FALSE);
wmpSettings.setMode(L"showFrame", TRUE);

.....

// Playback start
m_wmpPlayer.MoveWindow(rRect, FALSE);
m_wmpPlayer.SetEnabled(TRUE);
m_wmpPlayer.SetUrl(pszUrl);
m_wmpPlayer.GetControls().play();

....

// Playback stop
m_wmpPlayer.GetControls().stop();
m_wmpPlayer.DestroyWindow(); // will call site's DestroyControl()


Thanks,
Dan


0
1/30/2006 1:07:24 AM
vc.mfc 33608 articles. 0 followers. Follow

0 Replies
695 Views

Similar Articles

[PageSpeed] 5

Reply:

Similar Artilces:

Help
My organization has 4 entities with 4 domain names. I have created 4 recipient policies to assign the domain email address to users of each entity (1 email per user). However, there are certain users that need to have an email address other than the primary address that they receive. Without manually assiging this address, can I create a group, put users in that group, and have a recipient policy assign all necessary addresses based on this group membership? -- Richard Perry Systems Administrator/Programmer Shadow Mountain Ministries San Diego Christian College Southern California Semin...

"Last Dowloaded" column on the "view downloaded statements" screen
Microsoft Money 2005 Deluxe: I downloading the statements for the accounts defined as "You have set up online updates at these banks and brokerages:" on the "Manage online services" screen by clicking the "Online Updates" button to the upper right of the window and then, clicking the "Update Now" button. All new transactions downloaded into these respective accounts and all security prices updated to the current date (9/15/06), but, the dates listed under the "Last Downloaded" column vary greatly. The dates range from 3/4/2006 to 9/1...

combo box and subform help
In my subform for each seperate order, I want to beable to select a descripton name from the combo box. When the description name is selected, the price associated with that name should come up in the subform. I have tried to put the combo box in the table for description and make a query but, the information associated with the description name will not come up. Create the combo box cboItem with the RowSource something like: SELECT tblItem.ItemKey, tblItem.ItemDescription, tblItem.SellPrice FROM tblItem; Set the number of columns to 3 Set the column widths to 0;2;0 or something e...

urgent help to find out why
Hi all, windows 2003 /exchange 2003 SP2 with FE and BE Users are complaining that they do not receive messages timely. I check the BE's queues and find out over 5000 mesages in the local delivery queue about the 1.7 GB size(no limit set up here and is not allowed to do it. If I do a search, I can not find out the messages which have large sizes. What's the log to track own who send large attachment? tracking log. Also, any other ways to make queue go down quickly? To rebboot the server? Can we set up the alert if messages queued up in the local delivery queue? O...

Viewing schedule details
We have upgraded from Novell Groupwise to Exchange and Outlook. I have figured out how to look at other's schedules, but noticed that details about the scheduled time is not currently available. For instance if I place in my calender an item that states that I am away in California on business Monday and Tuesday, when someone looks at my schedule all they'll see is that I am out of the office. Is there a way, through Exchange rights or whatever, to allow people to see the detail for a calendar item? Thanks for the info! ...

Non taxable exchange of mutual funds
What is the preferred manner of making and accounting for the non taxable exchange of mutual funds in ms money? In microsoft.public.money, Fred Kennedy wrote: >What is the preferred manner of making and accounting for the non taxable >exchange of mutual funds in ms money? > Handling a Mutual Fund Reorg or conversion from B to A shares. If your mutual fund is involved in a tax-free reorganization, your "B" shares are being converted to [fewer generally] "A" shares, or a merger where you don't originally hold both funds: 1. Do an appropriate split of the...

comdlg32.ocx
I have used an application developed in Access 2003 very well. I bought a new machine with Windows 7 and reloaded Access 2003 (Office 2003). It now does not run a function within the application. I believe comdlg32.ocx is the problem. I unselected Microsoft Common Dialog Control 3.0 (SP3) and it has disappeared as well. Error Run time error 438 - Object does not support this property or object Function Private Function fileName() As String Me.CommandOpenFileDialogue.Filter = "Text|*.txt|All|*.*" Me.CommandOpenFileDialogue.ShowOpen fileName = Me.CommandOpenFil...

Viewing and listening to Notebook notes on PC Word 2007
Version: 2008 Operating System: Mac OS X 10.5 (Leopard) Processor: Intel I created a .docx document in Word 2008 for the Mac and now i want to open the document in Word 2007 in windows and play the audio. Is this possible. <br><br>Michael No. Sorry... Well... "Sort of..." :-) Since it is a .docx, you can actually dig the audio out by unzipping. Make a copy of the document and change the file extension to .zip. Open the zip file and you will see a set of folders. In the Media folder you will see one or more .mp3 files. That's your audio: copy it out...

Two Day view in Calendar
Today my calendar popped up showing a view of Wed and Thurs only w/a generous amount of space allocated to each day. This is w/the taskpad checked. Yet this view goes away and I would like to get it back. Can anyone tell me how. Schematic - Outlook 2003 Navigation Pane - Day 1 (current day) - Day 2 (following day) - Task List How? Hold your control key and click on any selected days in the Date Navigator - you can select non-sequential days for instance. --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. All unsolicited mail sent to my...

Dialog and asserts
Hi, I have a dialog based application and I want to open another dialog. I have a function int CMyDialog::Execute { // CMyDialog::Execute int ret_code; CNewDialog m_NewDialog(this); ret_code = m_NewDialog.DoModal(); return ret_code; } // CMyDialog::Execute that opens this dialog but this fail :( I got at assert on this line BOOL CWnd::Attach(HWND hWndNew) { ---> ASSERT(m_hWnd == NULL); // only attach once, detach on I have realized my application with the Wizard so I am not very expert about this stuff. Can someone tell me what's happening ? Stefano Malavasi __...

Focus to Modeless dialog
Hi, I called modeless dialog box in initdialog(). Whenever the app starts the modeless dialog starts but the focus is returned to the main app and not the modeless dialog. How can I set focus to the modeless dialog instead of the main app. My code looks like this : BOOL CMyDlg::OnInitDialog() { CDialog::OnInitDialog(); CModeless *mode; mode = new CModeless; mode->Create(IDD_DIALOG,this); } Thanks Ravi > BOOL CMyDlg::OnInitDialog() > { > > CDialog::OnInitDialog(); > CModeless *mode...

Help with graph
Hello, I am having trouble representing this data in a graph Column A = 17 Items Column B = September Reported Column C = September Actual Column D = October Reported Column E = October Actual .... to the end of the year I want to show each item with the numbers reported in contrast to the acutal. I can't get it into a format that is easily represented in a graph. Am I arranging my data incorrectly? What kind of graph should I use? Hi, You could create a (say Bar) chart from your data by selecting B1 and D1 (select B1, CTRL-click D1) and Insert Chart. On the Series tab, add a Series...

Find and Replace Dialog
In AC 2007, is there a way to change the default Match from Whole Field to Start of Field?? I've looked through Access Options but didn't find any setting for this. James Go to: Office Button | Access Options | Advanced Under Editing, set Default Find/Replace Behavior to: Start of field search -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "JamesJ" <jjy@adelphia_darwin.net> wrote in message news:uS9J0sCRIHA.6036@TK2MSFTNGP03.phx.gb...

FRX help #2
I was wondering if there was any way to run a report in Frx by vendor name. So if I wanted to see what I paid ABC Company for the month by G/L code, it would show me. If so, how would you do it. Any help would be appreciated thanks Barb Can get everything except the GL code through a smart list : Payables Transactions Search Doc type = payment Doc Date between... Vendor ID = But getting to the GL account is beyond me (newbie) "BK" wrote: > I was wondering if there was any way to run a report in Frx by vendor name. > So if I wanted to see what I paid ABC Company for the...

keystroke in MFC(Dialog app)
hi I am trying to capture the keyboard input user press in my application i have declared the message WM_KEYUP and WM_KEYDOWN and their correspoding function also get declared void CTeestDlg::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) { MessageBox("Key Presses"); CDialog::OnKeyDown(nChar, nRepCnt, nFlags); } now when user press any key in my dialog application message box should be displayed but nothing happend no message box displayed I also used the break point in side this function but no break point is called .... please let me know how to solve this problem T...

Display time in dialog box
Hi All, I am currently trying to display the time in a dialog box application. It is been displayed in a Static box when the program loads but then I don't seem to be able to refresh it every second. The code I am using is shown below: Any help would be very much appreciated. Cheers Fabrice void CMyDlg::OnTimer(UINT nIDEvent) { if (nIDEvent == m_nTimer) { CTime ct = CTime::GetCurrentTime(); CString Temp; Temp.Format("%02d:%02d:%02d", ct.GetHour(), ct.GetMinute(), ct.GetSecond()); } } void CMyDlg::PreSub...

HELP!!! Nothings happening....
I have installed MS CRM 1.2 and everything apparently went fine but nothing happens. I cant get the website open or connect via Outlook... you really need to be more specific............. in the browser when you try to access CRM, what exactly happens? Is it just closing? Do you get any error message? If its the latter, try disabling all pop up blockers............ -Gary "Michael" <dont@spam.me> wrote in message news:qe5ec056hbaanuum3vdefjjmak8ck8vrig@4ax.com... > I have installed MS CRM 1.2 and everything apparently went fine but > nothing happens. I cant get the we...

Re: Median of differences of columns, with embedded "if"
Jmay and Otto- Thanks very much for your quick replies, but I'm not sure now to appl that here, since the median of differences formula applies to a range. The forumla I am using (referring to the array in my original question is MEDIAN(B1:B4-A1:A4). (Of course, there are many more rows than 4). How do I modify it so that it takes the median of only those rows wher C=1? Thanks again, Kat -- Message posted from http://www.ExcelForum.com Hi Kate see my response in your original thread -- Regards Frank Kabel Frankfurt, Germany > Jmay and Otto- > > Thanks very much for you...

Formula Help 03-02-10
HI, worksheet formulas are not one of my best, so I need a little help once again from the forum. Here is a if formula that I started with, but it does not suit my needs, I also looked at or ways beside the If. IF(AH10>=1,(BB1=" ")) What I' trying to do is say the if AH10 >=1 then I want cell BB1 to be blank. I need the formula to be in cell BB2. Thanks for any help. On Mar 2, 3:29=A0pm, Charles <harm.char...@gmail.com> wrote: > HI, worksheet formulas are not one of my best, so I need a little help > once again from the forum. > Here is a if...

Data Migration Error
Hi All, Im having trouble importing email activites into MS CRM. When running the migration tool , Im getting the following error in the logs for every email I've set up as an activity. I've checked the guids for the owninguser and the objectid (contact), and they all exist. Im not creating any associated records in the cdf_ActivityParty table, as I only want to store the link for the "regarding" item so to speak. Thoughts anyone? - Its my last issue to resolve before I can put this out to production. Regards, Cameron 21/10/2004 - 8:43:18 AM -- [ERROR] Failed to...

Restoring Prod Database to New Server/Domain
I have a client who has quite a bit of data to import into CRM 4.0, however they are using a hosted solution and I will not have access to the database, web services, plugins, code, scribe. etc. The hosting company will however allow us to provide them a database to restore. I have an environment I can use for this effort. The hosting company warns us that this hasn't gone so well. What is your opinion on restoring the DB to their environment? Are there any known issues, problems that would cause you to suggest another method? Thanks! sounds ok to me - not too sure what the hosting c...

How do I see a new view in SmartList Builder?
I created a SQL view in Management Studio in SQL 2005 so I could pull it into a SmartList in SLB. I'll be darned if I can figure out how to see the view in the 'SQL Server Table' window when trying to add the view to my SmartList. Do I need to grant permission to the view somewhere? I'm logged in as 'sa' in GP. I don't remember ever having this issue before when creating a view. Thanks much, Frank Hamelly MCP-GP, MCT East Coast Dynamics www.eastcoast-dynamics.com Frank, you don't mention what version of GP.... For 9.0, you first need to set permissions to...

my file using one note cannot be viewed completely if i e-mail it
i created a file with some pictures and handwriting, and e-mailed to friends who are using different e-mail servers, however the complete file cannot be viewed by friends who are using yahoo or hotmail accounts. some are broken up and some must save it on desktop and open to view. do recipients have to have one note program built in their computer? it will be waste of money if it only works with having one note program..... They need OneNote to open the *.one files, but the text of the message body should be viewable in any mail program that accepts HTML and doesn't block images...

Restore files only view the last month emails
I have outlook 2003 i added mi windows XP Pro to Domain then Xp create a new profile. I try to restore files from old user profile, but when i made it Only e-mails from last month and past appears !!! Please if somebody have any answer for this problem Please Help me After to made it i clean a virus called BackDoor.Berbew.F but i don't know if this was the problem. I search for All Pst files and any have mails from this month June ...

Return from Modal Dialog ( via EndDialog ) and App hangs
Using VC++ 6.0, if you use the wizard to make a Win32 Exe Program ( Dialog ) you'll see in "C< project name >App" class, method InitInstance, there is a call to "C< project name >Dlg" where the object is instantiated, ran ( DoModal ) and then the program exits. Okay, I have a program with many classes, controls, COM resources, etc. and the Dlg does still return from DoModal, BUT it never exits the program. It's like it's hung in InitInstance. I'm returning FALSE from it to not enter the pump ( default ). Any ideas on how I can debug this? I...