none
Error 0x80048010 while accessing MediaFormat property of a shape in PPT presentation. RRS feed

  • Question

  • Greetings,

    I have a weird problem. I've created a PPT presentation with couple of slides. I also placed a media file at the first page (mp3 song). When I'm iterating all the slides and all the shapes at the slide in my application, I find this media shape, i.e. expression "pShape->Type == Office::MsoShapeType::msoMedia" is true. After this check I try to get MediaFormat to change the volume of playing audio later: "PowerPoint::MediaFormatPtr pMedia = pShape->MediaFormat;". And this expression generates me an error 0x80048010. Any advice? What am I doing wrong?

    Tuesday, July 11, 2017 1:56 PM

All replies

  • Hi Dima Kostenich,

    you had mentioned that,"After this check I try to get MediaFormat to change the volume of playing audio later: "PowerPoint::MediaFormatPtr pMedia = pShape->MediaFormat;". And this expression generates me an error 0x80048010. "

    I try to make a test using code below to change the volume of media file. I find that it works without any error.

    you can try to test it on your side.

    using PowerPoint = Microsoft.Office.Interop.PowerPoint;
    using Office = Microsoft.Office.Core;
    
    
     private void Form1_Load(object sender, EventArgs e)
            {
                PowerPoint.Application app = new PowerPoint.Application();
                app.Visible = Office.MsoTriState.msoTrue;
               
                app.Presentations.Open(@"C:\Users\v-padee\Desktop\demo.pptx");
    
                foreach (PowerPoint.Slide slide in app.ActivePresentation.Slides)
                {
                    PowerPoint.Shapes slideShapes = slide.Shapes;
                    foreach (PowerPoint.Shape shape in slideShapes)
                    {
                        if (shape.Type == Office.MsoShapeType.msoMedia &&
                            shape.MediaType == PowerPoint.PpMediaType.ppMediaTypeSound)
                        {
                           
                            MessageBox.Show(shape.MediaFormat.Volume.ToString());
                            shape.MediaFormat.Volume = 1;
                            MessageBox.Show(shape.MediaFormat.Volume.ToString());
                           
                        }
                    }
                }
    
            }

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, July 12, 2017 1:41 AM
    Moderator