Click here to Skip to main content
15,899,313 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
GeneralRe: Size of executable doubles since Windows Update on April 14, 2011 Pin
Big Art22-Apr-11 17:05
Big Art22-Apr-11 17:05 
AnswerRe: Size of executable doubles since Windows Update on April 14, 2011 Pin
Hans Dietrich26-Apr-11 8:06
mentorHans Dietrich26-Apr-11 8:06 
GeneralRe: Size of executable doubles since Windows Update on April 14, 2011 Pin
Big Art1-Jul-11 10:51
Big Art1-Jul-11 10:51 
AnswerRe: Size of executable doubles since Windows Update on April 14, 2011 Pin
Hans Dietrich1-Jul-11 14:25
mentorHans Dietrich1-Jul-11 14:25 
QuestionProblem creating instance using com smart pointer. Pin
Dhadhan13-Apr-11 18:35
Dhadhan13-Apr-11 18:35 
Questionhow can I draw one Line in different windows? Pin
caiguosen11-Apr-11 4:00
caiguosen11-Apr-11 4:00 
AnswerRe: how can I draw one Line in different windows? Pin
Richard MacCutchan11-Apr-11 4:20
mveRichard MacCutchan11-Apr-11 4:20 
QuestionWindows Media Player Plugin - Property Page Issue Pin
dexter7505-Apr-11 18:56
dexter7505-Apr-11 18:56 
I am developing a viz plugin for WMP and I'm having an issue with the property page "saving" the changes I make. I generated the plugin files from the wizard found in the latest Windows SDK - this is mainly straight from the wizard and doesn't work out of the box. Great job, Microsoft!

The plugin dumps out color values over a network socket. That part works fine and no issues. I have implemented a 'property page' dialog box that, in theory, lets you pick the color value that will be sent.

In my property page dialog box code, I am setting a pointer to the plugin class itself so I can access it's variables. After exiting the dialog box though, the vis plugin class' constructor gets called again, thereby re-initializing the variable i just modified. because of this, i am unable to change any variables and the property page dialog box is useless.

My plugin class is named <b>CWmpplugin1</b>

Here are the methods of the plugin I think are relevant to this issue:
/////////////////////////////////////////////////////////////////////////////
// CWmpplugin1::CWmpplugin1
// Constructor

CWmpplugin1::CWmpplugin1() :
m_hwndParent(NULL),
m_clrForeground(0x0000FF),
m_nPreset(0)
{
		 wcsncpy_s(m_wszPluginText, sizeof(m_wszPluginText) / sizeof(m_wszPluginText[0]), L"DEFAULT", sizeof(m_wszPluginText) / sizeof(m_wszPluginText[0]));
}

wcsncpy initializes the public variable m_wsxPluginText to "DEFAULT". Problem is, this gets called after leaving the property page dialog box, so that string is always set to "DEFAULT"

STDMETHODIMP CWmpplugin1::DisplayPropertyPage(HWND hwndOwner)
{
    CPropertyDialog dialog(this);
	
    dialog.DoModal(hwndOwner);

    return S_OK;
}


//////////////////////////////////////////////////////////////////////////////
// CWmpplugin1::GetCapabilities
// Returns the capabilities of this effect. Flags that can be returned are:
//  EFFECT_CANGOFULLSCREEN      -- effect supports full-screen rendering
//  EFFECT_HASPROPERTYPAGE      -- effect supports a property page
//////////////////////////////////////////////////////////////////////////////
STDMETHODIMP CWmpplugin1::GetCapabilities(DWORD * pdwCapabilities)
{
    if (NULL == pdwCapabilities)
    {
        return E_POINTER;
    }

    *pdwCapabilities = EFFECT_HASPROPERTYPAGE;
    return S_OK;
}


My dialog implementation (ATL):
#include "atlwin.h"

class CPropertyDialog : public CDialogImpl&lt;CPropertyDialog&gt;
{
public:
    enum { IDD = IDD_PROPERTYDIALOG };

    BEGIN_MSG_MAP(CPropertyDialog)
        MESSAGE_HANDLER( WM_INITDIALOG, OnInitDialog )
        COMMAND_ID_HANDLER( IDOK, OnOK )
        COMMAND_ID_HANDLER( IDCANCEL, OnCancel )
	END_MSG_MAP()

    CPropertyDialog(CWmpplugin1 *pPlugin)
    {
        m_pPlugin = pPlugin;
    }

private:
    CWmpplugin1  *m_pPlugin;  // pointer to plugin object


On constructor being called, I am getting the pointer to the plugin object.

LRESULT OnOK(WORD wNotifyCode, WORD wID, HWND hwndCtl, BOOL&amp; fHandled)
    {
        // save text
     	wcsncpy_s(m_pPlugin-&gt;m_wszPluginText, sizeof(m_pPlugin-&gt;m_wszPluginText) / sizeof(m_pPlugin-&gt;m_wszPluginText[0]), L"CHANGED!", sizeof(m_pPlugin-&gt;m_wszPluginText) / sizeof(m_pPlugin-&gt;m_wszPluginText[0]));

	EndDialog( IDOK );
		
        return 0;
    }


After you click the OK button on the dialog box, wcsncpy copies "CHANGED!" to mpPlugin-&gt;m_wszPluginText.

I attached a debugger and verified that the string is actually changing the value, but again, once the dialog exits, the plugin object constructor is called again and the string changes back to "DEFAULT" like before.

Anybody know what I'm doing wrong? Is the constructor getting called again normal operation? I thought once the DLL was loaded by WMP, it would create an instance of the plugin object that lasts for the entire time WMP is in memory.

Much thanks for any help!
QuestionHandling LVN_DELETEITEM in CListViewCtrl subclass Pin
Philipp Kursawe29-Mar-11 21:09
Philipp Kursawe29-Mar-11 21:09 
QuestionUsage of reference Pin
Krishnakumartg29-Mar-11 1:42
Krishnakumartg29-Mar-11 1:42 
AnswerRe: Usage of reference Pin
Richard MacCutchan29-Mar-11 3:22
mveRichard MacCutchan29-Mar-11 3:22 
GeneralRe: Usage of reference Pin
Krishnakumartg29-Mar-11 6:12
Krishnakumartg29-Mar-11 6:12 
GeneralRe: Usage of reference Pin
Richard MacCutchan29-Mar-11 6:25
mveRichard MacCutchan29-Mar-11 6:25 
GeneralRe: Usage of reference Pin
Krishnakumartg29-Mar-11 6:30
Krishnakumartg29-Mar-11 6:30 
GeneralRe: Usage of reference Pin
Richard MacCutchan29-Mar-11 6:54
mveRichard MacCutchan29-Mar-11 6:54 
QuestionWhy more than one picture added into .doc file can't be seen but single can? [modified] Pin
whiteclouds24-Mar-11 21:47
whiteclouds24-Mar-11 21:47 
QuestionHow to replace a '%' character in CComBSTR with "%%" Pin
narayanagvs23-Mar-11 0:31
narayanagvs23-Mar-11 0:31 
AnswerRe: How to replace a '%' character in CComBSTR with "%%" [modified] Pin
Cool_Dev24-Mar-11 2:18
Cool_Dev24-Mar-11 2:18 
GeneralRe: How to replace a '%' character in CComBSTR with "%%" Pin
barneyman22-Apr-11 0:08
barneyman22-Apr-11 0:08 
RantRe: How to replace a '%' character in CComBSTR with "%%" Pin
Cool_Dev22-Apr-11 0:41
Cool_Dev22-Apr-11 0:41 
GeneralRe: How to replace a '%' character in CComBSTR with "%%" Pin
barneyman22-Apr-11 0:50
barneyman22-Apr-11 0:50 
Questionget focus on ActiveX control in MFC Dialog Pin
MrKBA22-Mar-11 0:01
MrKBA22-Mar-11 0:01 
Questionaccessing ActiveX array Pin
opti99921-Mar-11 23:33
opti99921-Mar-11 23:33 
AnswerRe: accessing ActiveX array Pin
Michael Dunn22-Mar-11 20:47
sitebuilderMichael Dunn22-Mar-11 20:47 
QuestionSinging COM Object Pin
Anders Molin21-Mar-11 2:31
professionalAnders Molin21-Mar-11 2:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.