[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ms-wmtalk
Subject:    NetShow on-Demand player .OCX and MSVC++
From:       Stan Williams <tech () IMAGEMIND ! COM>
Date:       1997-02-27 17:30:43
[Download RAW message or body]


I am having the following problems with the NSOPlay OCX and/or the
Visual C/C++ 4.0 development enviornment.

Backround Information:
======================

1. NSOPlay.ocx version 1.0.0.627

2. I used the component gallery to add the wrapper files to my project
        and placed the control on a standard dialog box form.
3. Programming in MSVC++ in MSDEV ver 4.0

Questions & problems
====================

****KEY ISSUE
1. How do I get the event messages from the player?  (Done playing, size
change
            etc.)
        Do you use callback fcns, windows messages or some other method?

****KEY ISSUE
2. I can call any of the functions provided by the wrapper class BUT after
calling
        Play(), trying to call ANY other function ( including pause and stop )
        causes the program to crash.

        The only message that I have been able to get from debugging is that
        there is some kind of access violation.  These errors occur even AFTER
        any video is done playing.

3. In Visual C 4.0, I can not edit the OCX properties on my dialog box or
run in
        debug mode.  MSDEV crashes with the following information:

        MSDEV - This program has performed and illegal operation and will be shut
            down.
        Under details, I get the following info:
                MSDEV caused and invalid page fault in module MSVCSHL.DLL at
                014F:5006A5DC.  Note that there are other messages after this,
                the error box pops about 3 or 4 times before Vis C finally terminates
                but I have a hard time getting these messages because my PC
                frequently locks.

4. NOTE:  When I use my personal copy of Visual C 4.2, I can run in debug
mode
            AND edit the OCX properties without problems.  However, the 4.2
version of
            my program still has the same "can not use any fcns after
calling play" bug.

5. I would like some sample code (if possible) of how to use this OCX
without having                         to use the class wizard or placing
it in a dialog box.  If you could refer me to
        the appropriate areas of the help files, that would also be great.


SAMPLE CODE:
============
/*  This is the class that contains the NSOPlayer and dialog box that was
created in
        the dialog resource editor.  NOTE:  NONMODAL dialog box
*/
class CViewDialog : public CDialog
{
public:
        CViewDialog(CWnd * pParentWnd = NULL) :
                CDialog( IDD_VIEWER, pParentWnd ) {}

        virtual BOOL OnInitDialog();
        CNSOPlay        *m_nsoPlayer;

        /*      The ID of the player control is:
                IDC_NSOPLAYCTL1
        */
private:


protected:
        /* buttons */
        afx_msg void OnTest();

        /* Proper shutdown */
        virtual void PostNcDestroy();
        virtual void OnExit();

        DECLARE_MESSAGE_MAP()
};



BOOL CViewDialog::OnInitDialog()
{
        CDialog::OnInitDialog();
        SetWindowSizeAndPos("VIEWWINDOW", (void *)this);

        /* This is how I gain access to the NSOPlay OCX that was placed in
the
                dialog box in the resource editor
        */
        m_nsoPlayer = (CNSOPlay *)GetDlgItem(IDC_NSOPLAYCTL1);

        return TRUE;
}


/* This is a sample of how I display the dialog box and use the OCX */
void CRemoteCtrlDialog::OnPlay()
{
        long lWidth, lHeight;

        if ( m_dlgView != NULL )
        {
                m_dlgView->SetFocus();
                return;
        }
        m_dlgView = new CViewDialog;
        m_dlgView->Create(IDD_VIEWER, this);
        m_dlgView->ShowWindow(SW_NORMAL);

        // This line runs fine
        m_dlgView->m_nsoPlayer->SetFileName("d:\\video.asf");

        // This line runs fine
        lWidth = m_dlgView->m_nsoPlayer->GetImageSourceWidth();

        // This line runs fine
        lHeight = m_dlgView->m_nsoPlayer->GetImageSourceHeight();

        // This line runs fine
        m_dlgView->m_nsoPlayer->Play();

        // Anything after the Play() will FAIL!
        m_dlgView->m_nsoPlayer->YouPickTheFunction()
}




/* This is how I start my program.  Note the call to
AfxEnableControlContainer */
BOOL CApp::InitInstance()
{
    /* If using OCX controls, then uncomment the following line */
    AfxEnableControlContainer();

    /* Create main xphone window */
        m_pMainWnd = new CRemoteCtrlDialog;
        m_pMainWnd->ShowWindow(m_nCmdShow);
        m_pMainWnd->UpdateWindow();

        return TRUE;
}


________________________________________
Stan Williams
ImageMind Software, Inc.
Salt Lake City, Utah 84180
801-350-9464 ex 3
Tech@imagemind.com
www.imagemind.com

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic