CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 1999
    Posts
    121

    Multimedia Control

    I have incorporated a Multimedia Control into the toolbar. Does anyone know how I can now make it work? Here is some of my code.

    Thanks

    int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
    {
    if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
    return -1;

    if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
    | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
    !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
    {
    TRACE0("Failed to create toolbar\n");
    return -1; // fail to create
    }
    m_filtertab.Create(this,IDD_Filtertab,CBRS_TOP,1111);


    if (!m_wndStatusBar.Create(this) ||
    !m_wndStatusBar.SetIndicators(indicators,
    sizeof(indicators)/sizeof(UINT)))
    {
    TRACE0("Failed to create status bar\n");
    return -1; // fail to create
    }

    // TODO: Delete these three lines if you don't want the toolbar to
    // be dockable
    m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
    m_filtertab.EnableDocking(CBRS_ALIGN_ANY);
    EnableDocking(CBRS_ALIGN_ANY);
    DockControlBar(&m_wndToolBar);
    DockControlBar(&m_filtertab);
    ///Added code


    #define SNAP_WIDTH 389 //the width of the Multimedia
    //set up the Multimedia control as a snap mode select box //
    //First get the index of the placeholder's position in the toolbar
    int index = 0;
    CRect rect;
    while(m_wndToolBar.GetItemID(index)!=IDP_PLACEHOLDER2) index++;
    //next convert that button to a seperator and get its position
    m_wndToolBar.SetButtonInfo(index, IDP_PLACEHOLDER2, TBBS_SEPARATOR, SNAP_WIDTH);
    m_wndToolBar.GetItemRect(index, &rect);

    // then .Create the multimedia control and show it
    if (!m_wndToolBar.m_wndSnap.Create(NULL,WS_CHILD|WS_VISIBLE,rect, &m_wndToolBar, IDC_WAVE))
    {
    TRACE0("Failed to create Multimedia Control\n");
    return FALSE;
    }
    m_wndToolBar.m_wndSnap.ShowWindow(SW_SHOW);
    m_wndToolBar.m_wndSnap.SetEjectVisible(FALSE);
    m_wndToolBar.m_wndSnap.SetRecordVisible(FALSE);
    m_wndToolBar.m_wndSnap.SetPrevVisible(FALSE);
    m_wndToolBar.m_wndSnap.SetNextVisible(FALSE);
    m_wndToolBar.m_wndSnap.SetEnabled(TRUE);
    m_wndToolBar.m_wndSnap.SetAutoEnable(TRUE);
    //m_wndToolBar.m_wndSnap.SetCanPlay(TRUE);
    m_wndToolBar.m_wndSnap.SetNotify(TRUE);
    m_wndToolBar.m_wndSnap.SetWait(TRUE);
    m_wndToolBar.m_wndSnap.SetShareable(FALSE);
    m_wndToolBar.m_wndSnap.SetCommand("close");
    m_wndToolBar.m_wndSnap.SetDeviceType("WaveAudio");
    m_wndToolBar.m_wndSnap.SetFileName("C:\\Lavac\\record.sav\\Yves\\1999.04.13(Tuesday)\\10h 48m 11s (Lesson1)\\r0000003.wav");
    m_wndToolBar.m_wndSnap.SetCommand("open");



    return 0;
    }


    #include "mci1.h"
    class CMainToolBar : public CToolBar
    {
    // Construction
    public:
    CMainToolBar();

    // Attributes
    public:
    Cmci m_wndSnap;
    // Operations
    public:

    // Overrides
    // ClassWizard generated virtual function overrides
    //{{AFX_VIRTUAL(CMainToolBar)
    //}}AFX_VIRTUAL

    // Implementation
    public:
    virtual ~CMainToolBar();

    // Generated message map functions
    protected:
    //{{AFX_MSG(CMainToolBar)
    // NOTE - the ClassWizard will add and remove member functions here.
    //}}AFX_MSG

    DECLARE_MESSAGE_MAP()
    };


    class Cmci : public CWnd
    {
    protected:
    DECLARE_DYNCREATE(Cmci)
    public:
    CLSID const& GetClsid()
    {
    static CLSID const clsid
    = { 0xc1a8af25, 0x1257, 0x101b, { 0x8f, 0xb0, 0x0, 0x20, 0xaf, 0x3, 0x9c, 0xa3 } };
    return clsid;
    }
    virtual BOOL Create(LPCTSTR lpszClassName,
    LPCTSTR lpszWindowName, DWORD dwStyle,
    const RECT& rect,
    CWnd* pParentWnd, UINT nID,
    CCreateContext* pContext = NULL)
    { return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID); }

    BOOL Create(LPCTSTR lpszWindowName, DWORD dwStyle,
    const RECT& rect, CWnd* pParentWnd, UINT nID,
    CFile* pPersist = NULL, BOOL bStorage = FALSE,
    BSTR bstrLicKey = NULL)
    { return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID,
    pPersist, bStorage, bstrLicKey); }

    // Attributes
    public:

    // Operations
    public:
    CString GetDeviceType();
    void SetDeviceType(LPCTSTR lpszNewValue);
    BOOL GetAutoEnable();
    void SetAutoEnable(BOOL bNewValue);
    BOOL GetPrevVisible();
    void SetPrevVisible(BOOL bNewValue);
    BOOL GetNextVisible();
    void SetNextVisible(BOOL bNewValue);
    BOOL GetPlayVisible();
    void SetPlayVisible(BOOL bNewValue);
    BOOL GetPauseVisible();
    void SetPauseVisible(BOOL bNewValue);
    BOOL GetBackVisible();
    void SetBackVisible(BOOL bNewValue);
    BOOL GetStepVisible();
    void SetStepVisible(BOOL bNewValue);
    BOOL GetStopVisible();
    void SetStopVisible(BOOL bNewValue);
    BOOL GetRecordVisible();
    void SetRecordVisible(BOOL bNewValue);
    BOOL GetEjectVisible();
    void SetEjectVisible(BOOL bNewValue);
    BOOL GetPrevEnabled();
    void SetPrevEnabled(BOOL bNewValue);
    BOOL GetNextEnabled();
    void SetNextEnabled(BOOL bNewValue);
    BOOL GetPlayEnabled();
    void SetPlayEnabled(BOOL bNewValue);
    BOOL GetPauseEnabled();
    void SetPauseEnabled(BOOL bNewValue);
    BOOL GetBackEnabled();
    void SetBackEnabled(BOOL bNewValue);
    BOOL GetStepEnabled();
    void SetStepEnabled(BOOL bNewValue);
    BOOL GetStopEnabled();
    void SetStopEnabled(BOOL bNewValue);
    BOOL GetRecordEnabled();
    void SetRecordEnabled(BOOL bNewValue);
    BOOL GetEjectEnabled();
    void SetEjectEnabled(BOOL bNewValue);
    CString GetFileName();
    void SetFileName(LPCTSTR lpszNewValue);
    CString GetCommand();
    void SetCommand(LPCTSTR lpszNewValue);
    BOOL GetNotify();
    void SetNotify(BOOL bNewValue);
    BOOL GetWait();
    void SetWait(BOOL bNewValue);
    BOOL GetShareable();
    void SetShareable(BOOL bNewValue);
    long GetOrientation();
    void SetOrientation(long nNewValue);
    CString GetErrorMessage();
    void SetErrorMessage(LPCTSTR lpszNewValue);
    long GetFrom();
    void SetFrom(long nNewValue);
    long GetTo();
    void SetTo(long nNewValue);
    BOOL GetCanEject();
    void SetCanEject(BOOL bNewValue);
    BOOL GetCanPlay();
    void SetCanPlay(BOOL bNewValue);
    BOOL GetCanRecord();
    void SetCanRecord(BOOL bNewValue);
    BOOL GetCanStep();
    void SetCanStep(BOOL bNewValue);
    long GetMode();
    void SetMode(long nNewValue);
    long GetLength();
    void SetLength(long nNewValue);
    long GetPosition();
    void SetPosition(long nNewValue);
    long GetStart();
    void SetStart(long nNewValue);
    long GetTimeFormat();
    void SetTimeFormat(long nNewValue);
    BOOL GetSilent();
    void SetSilent(BOOL bNewValue);
    long GetTrack();
    void SetTrack(long nNewValue);
    long GetTracks();
    void SetTracks(long nNewValue);
    long GetTrackLength();
    void SetTrackLength(long nNewValue);
    long GetTrackPosition();
    void SetTrackPosition(long nNewValue);
    short GetUpdateInterval();
    void SetUpdateInterval(short nNewValue);
    BOOL GetUsesWindows();
    void SetUsesWindows(BOOL bNewValue);
    long GetFrames();
    void SetFrames(long nNewValue);
    long GetRecordMode();
    void SetRecordMode(long nNewValue);
    long GetHWndDisplay();
    void SetHWndDisplay(long nNewValue);
    short GetNotifyValue();
    void SetNotifyValue(short nNewValue);
    CString GetNotifyMessage();
    void SetNotifyMessage(LPCTSTR lpszNewValue);
    BOOL GetEnabled();
    void SetEnabled(BOOL bNewValue);
    long GetBorderStyle();
    void SetBorderStyle(long nNewValue);
    short GetError();
    void SetError(short nNewValue);
    short GetDeviceID();
    void SetDeviceID(short nNewValue);
    long GetMousePointer();
    void SetMousePointer(long nNewValue);
    CPicture GetMouseIcon();
    void SetRefMouseIcon(LPDISPATCH newValue);
    long GetHWnd();
    void SetHWnd(long nNewValue);
    long GetOLEDropMode();
    void SetOLEDropMode(long nNewValue);
    void Refresh();
    void OLEDrag();
    };



  2. #2
    Join Date
    May 1999
    Location
    Atlanta, GA, USA
    Posts
    443

    Re: Multimedia Control

    Hi, Sophie.

    What errors message did you get?

    1) Did you succeed to put ActiveX control on tool bar?
    2) Did you make Multimedia control on Dialog work well?

    Regards.
    -Masaaki Onishi-


  3. #3
    Join Date
    Apr 1999
    Posts
    121

    Re: Multimedia Control

    Yes I got it into the toolbar ok. I don't get error messages I just can't play my wave files. Le t me rephrase that I don't know how to. I've created a dialog application with a multimedia control ok but it seems by having it into the toolbar I have to code everything for it to work and am just a beginner at this C++ so any help would be appreciated.

    Thanks


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured