UI message

PDF-XChange Editor SDK for Developers

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
bifangdejingjie
User
Posts: 43
Joined: Thu Oct 25, 2018 2:42 am

UI message

Post by bifangdejingjie »

How to handle messages under C++ Demo, such as the message that the document opens to display
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: UI message

Post by Sasha - Tracker Dev Team »

Hello bifangdejingjie,

What C++ Demo are you referring to?

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
bifangdejingjie
User
Posts: 43
Joined: Thu Oct 25, 2018 2:42 am

Re: UI message

Post by bifangdejingjie »

Sasha - Tracker Dev Team wrote:Hello bifangdejingjie,

What C++ Demo are you referring to?

Cheers,
Alex
The ImportConverter sample of Editor SDK
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: UI message

Post by Sasha - Tracker Dev Team »

Hello bifangdejingjie,

Go to the main dialog editor in the Resource View. Select the added AXControl on the form and open it's properties. From the properties pane, you can choose the Control's events - there should be only one event - OnEvent. Click the dropdown and choose Add OnEventPxvControl. Then you will have the handler. To handle the needed event, you will have to register it with the IPXV_Control::EnableEventListening method. Then you can check whether the nEventID is equal to your's event id and act accordingly.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
bifangdejingjie
User
Posts: 43
Joined: Thu Oct 25, 2018 2:42 am

Re: UI message

Post by bifangdejingjie »

Sasha - Tracker Dev Team wrote:Hello bifangdejingjie,

Go to the main dialog editor in the Resource View. Select the added AXControl on the form and open it's properties. From the properties pane, you can choose the Control's events - there should be only one event - OnEvent. Click the dropdown and choose Add OnEventPxvControl. Then you will have the handler. To handle the needed event, you will have to register it with the IPXV_Control::EnableEventListening method. Then you can check whether the nEventID is equal to your's event id and act accordingly.

Cheers,
Alex
thanks,another question.If not using mfc but Win32,then how to have a handler?
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: UI message

Post by Sasha - Tracker Dev Team »

Hello bifangdejingjie,

Well we can't possibly know, how you are creating and using your control, thus we can't assist further without the more detailed explanation and code/project sample.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
bifangdejingjie
User
Posts: 43
Joined: Thu Oct 25, 2018 2:42 am

Re: UI message

Post by bifangdejingjie »

Sasha - Tracker Dev Team wrote:Hello bifangdejingjie,

Well we can't possibly know, how you are creating and using your control, thus we can't assist further without the more detailed explanation and code/project sample.

Cheers,
Alex
Hello Alex,
Don't know if you know duilib? I use the CActiveXUI class of this library to create and call IPXV_Control via CActiveXUI.Just like this:
CMainWindow::CActiveXUI *m_pPDFEditControlAx = NULL;
CMainWindow::IPXV_Control *m_pIPXV = NULL;

bool CMainWindow::CreatePXVCtl()
{
#define CLSID_CPXVCONTROL (_T("{A1149909-4EDC-4421-B9E5-E93C25A000A1}"))
#define IID_IPXVCONTROL (_T("{71300d43-687f-436a-a699-2b37448d0803}"))

HRESULT hr = S_FALSE;
CLSID CLSID_Fun = { 0 };
IID IID_IFun = { 0 };

if (m_pPDFEditControlAx)
{
if (m_pIPXV)
{
return true;
}
SUCCEEDED(hr = CLSIDFromString(CLSID_CPXVCONTROL, &CLSID_Fun));
SUCCEEDED(hr = IIDFromString(IID_IPXVCONTROL, &IID_IFun));

OutputDebugString(CLSID_CPXVCONTROL);
m_pPDFEditControlAx->SetDelayCreate(false);
m_pPDFEditControlAx->CreateControl(CLSID_Fun);
m_pPDFEditControlAx->GetControl(IID_IFun, (void**)&m_pIPXV);


IDispatch * pDisp = NULL;
CLSID CLSID_UIEvent = { 0 };
SUCCEEDED(hr = CLSIDFromString(CLSID_UIEVENTCONTROL, &CLSID_UIEvent));

if (m_pIPXV)
{
return true;
}
}
return fale;
}
bifangdejingjie
User
Posts: 43
Joined: Thu Oct 25, 2018 2:42 am

Re: UI message

Post by bifangdejingjie »

Sasha - Tracker Dev Team wrote:Hello bifangdejingjie,

Well we can't possibly know, how you are creating and using your control, thus we can't assist further without the more detailed explanation and code/project sample.

Cheers,
Alex
Hello Alex,
I use the COM event sink to handle the event, but in fact I can't handle the event.
My code

Code: Select all

#pragma once

#include "PXVCommonData.h"

using namespace PXV;

class CEventHandle;
const int ID_EVENT = 1;
extern _ATL_FUNC_INFO info1;

const GUID  LIBID_Event = { 0x8d00937c, 0x06b9, 0x4b5c,{ 0x9a, 0x94, 0xa7, 0xe0, 0x46, 0x33, 0x6b, 0x01 } };

typedef IDispEventImpl<ID_EVENT,
	CEventHandle,
	&__uuidof(PXV::_IPXV_ControlEvents),
	&GUID_NULL,
	1,
	0> MyPXVEvents;

class CEventHandle : public MyPXVEvents
{
public:
	// constructor/destructor
	CEventHandle();
	virtual ~CEventHandle();

	// set Monitor
	void SetEventMonitor(PXV::IPXV_ControlPtr v_pEvent);

/*
	// pure virtual functions
	virtual LRESULT OnEvent(/ *[in]* / long nEventID,
		/ *[in]* / struct IEvent * pEvent,
		/ *[in]* / IUnknown * pFrom) = 0;*/

	// Sink interface declaration
	BEGIN_SINK_MAP(CEventHandle)
		SINK_ENTRY_INFO(ID_EVENT, __uuidof(PXV::_IPXV_ControlEvents), IDS::e_activeDocChanged, __OnEvent, &info1)
	END_SINK_MAP()

	// COM event hookup
	STDMETHOD_(LRESULT, __OnEvent)(/*[in]*/ long nEventID,
		/*[in]*/ struct IEvent * pEvent,
		/*[in]*/ IUnknown * pFrom);
	
private:
	PXV::IPXV_ControlPtr m_pCtrlEvent;

	void _Release();
};

Code: Select all

#include "stdafx.h"
#include "EventHandle.h"

_ATL_FUNC_INFO info1 = { CC_STDCALL, VT_HRESULT, 3,{ VT_I4, VT_DISPATCH, VT_UNKNOWN } };

CEventHandle::CEventHandle()
{
}


CEventHandle::~CEventHandle()
{
	_Release();
}

HRESULT CEventHandle::__OnEvent(long nEventID, IEvent * pEvent, IUnknown * pFrom)
{
//	return OnEvent(nEventID, pEvent, pFrom);
	OutputDebugString(_T("Hello~"));
	return 0;
}

void CEventHandle::_Release()
{
	if (m_pCtrlEvent != NULL)
	{
		MyPXVEvents::DispEventUnadvise(m_pCtrlEvent);
		m_pCtrlEvent = NULL;
	}
}

void CEventHandle::SetEventMonitor(PXV::IPXV_ControlPtr v_pEvent)
{
	HRESULT hr = NULL;

	_Release();

	if (v_pEvent != NULL)
	{
		hr = MyPXVEvents::DispEventAdvise(v_pEvent, &__uuidof(PXV::_IPXV_ControlEvents));
		if (FAILED(hr))
		{
			_com_raise_error(hr);
		}

		m_pCtrlEvent = v_pEvent;
	}
}
m_pIPXV->EnableEventListening(_T("e.activeDocChanged"), TRUE);
m_pMyEvent = new CEventHandle;
m_pMyEvent->SetEventMonitor(m_pIPXV);
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: UI message

Post by Sasha - Tracker Dev Team »

Hello bifangdejingjie,

We've investigated the issue and here's a solution - change this line of code:

Code: Select all

_ATL_FUNC_INFO info1 = { CC_STDCALL, VT_HRESULT, 3,{ VT_I4, VT_DISPATCH, VT_UNKNOWN } };
to this

Code: Select all

_ATL_FUNC_INFO info1 = { CC_STDCALL, VT_EMPTY, 3,{ VT_I4, VT_DISPATCH, VT_UNKNOWN} };
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
bifangdejingjie
User
Posts: 43
Joined: Thu Oct 25, 2018 2:42 am

Re: UI message

Post by bifangdejingjie »

Sasha - Tracker Dev Team wrote:Hello bifangdejingjie,

We've investigated the issue and here's a solution - change this line of code:

Code: Select all

_ATL_FUNC_INFO info1 = { CC_STDCALL, VT_HRESULT, 3,{ VT_I4, VT_DISPATCH, VT_UNKNOWN } };
to this

Code: Select all

_ATL_FUNC_INFO info1 = { CC_STDCALL, VT_EMPTY, 3,{ VT_I4, VT_DISPATCH, VT_UNKNOWN} };
Cheers,
Alex
Although I have solved the problem ahead of time, thank you very much.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: UI message

Post by Sasha - Tracker Dev Team »

:)
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
bifangdejingjie
User
Posts: 43
Joined: Thu Oct 25, 2018 2:42 am

Re: UI message

Post by bifangdejingjie »

Sasha - Tracker Dev Team wrote::)
Hello Alex,
I want to get the save button click message, how to do it?
The function I want to achieve is that make a conditional judgment when get the message.
If true do operation A ,do not save the doc changed.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: UI message

Post by Sasha - Tracker Dev Team »

Hello bifangdejingjie,

Please make sure to check the forum search and see if the same has not already been answered:
viewtopic.php?f=66&t=25912&p=101251&hil ... er#p101251

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
bifangdejingjie
User
Posts: 43
Joined: Thu Oct 25, 2018 2:42 am

Re: UI message

Post by bifangdejingjie »

Sasha - Tracker Dev Team wrote:Hello bifangdejingjie,

Please make sure to check the forum search and see if the same has not already been answered:
viewtopic.php?f=66&t=25912&p=101251&hil ... er#p101251

Cheers,
Alex
Hello Alex,
I visited the link you gave, but I am using the C++ language, so I still don't quite understand what to do.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: UI message

Post by Sasha - Tracker Dev Team »

Hello bifangdejingjie,

If you are using the C++ language, then you can easily understand the C# language. Basically, what you need to do is to create your class implementation of the IUIX_CmdHandler interface and then set is as a handler of the needed command. This sample shows how to do it in C#:
https://gist.github.com/Polaringu/ad31ad433401c1c004d0

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
bifangdejingjie
User
Posts: 43
Joined: Thu Oct 25, 2018 2:42 am

Re: UI message

Post by bifangdejingjie »

Sasha - Tracker Dev Team wrote:Hello bifangdejingjie,

If you are using the C++ language, then you can easily understand the C# language. Basically, what you need to do is to create your class implementation of the IUIX_CmdHandler interface and then set is as a handler of the needed command. This sample shows how to do it in C#:
https://gist.github.com/Polaringu/ad31ad433401c1c004d0

Cheers,
Alex
Hello,Alex
I did what you said.Just like this, but it did'n work.

Code: Select all

#pragma once

#include "stdafx.h"

class CPXVCmdHandler : public PXV::IUIX_CmdHandler
{
public:
	CPXVCmdHandler(PXV::IPXV_Inst *pInst);
	virtual ~CPXVCmdHandler();

	virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppvObject);
	virtual ULONG STDMETHODCALLTYPE AddRef(void);
	virtual	ULONG STDMETHODCALLTYPE Release(void);

	virtual HRESULT STDMETHODCALLTYPE OnCreateNewCtl(PXV::IUIX_Cmd *pCmd, PXV::IUIX_CmdBar *pParent, PXV::IUIX_Obj **ppCtrl);
	virtual HRESULT STDMETHODCALLTYPE OnGetCtlSizes(PXV::IUIX_CmdItem *pItem, tagSIZE *pSize, tagSIZE *pMinSize, tagSIZE *piMaxSize);
	virtual HRESULT STDMETHODCALLTYPE OnGetItemState(PXV::IUIX_Cmd *pCmd, PXV::IUIX_CmdItem *pItem, PXV::IUIX_Obj *pOwner, long *pState);
	virtual HRESULT STDMETHODCALLTYPE OnGetItemSubMenu(PXV::IUIX_CmdItem *pItem, PXV::IUIX_CmdMenu **ppSubMenu);
	virtual HRESULT STDMETHODCALLTYPE OnNotify(long lCode, PXV::IUIX_Cmd *pCmd, PXV::IUIX_CmdItem *pItem, PXV::IUIX_Obj *pOwner, ULONG_PTR puiNotifyData);
	virtual HRESULT STDMETHODCALLTYPE OnDrawItemIcon(PXV::IUIX_RenderContext *pRC, PXV::IUIX_CmdItem *pItem, tagRECT *pstIconRect, tagRECT *pstClip);

	PXV::IPXV_Inst *m_pInst;
	LONG m_cRef = 0;
	PXV::IUIX_CmdHandler *m_pOldSaveHandler;
	PXV::IUIX_CmdHandler *m_pOldSaveAsHandler;

private:
	long m_lSaveID;
	long m_lSaveAsID;

};

Code: Select all

#include "stdafx.h"
#include "PXVCmdHandler.h"

CPXVCmdHandler::CPXVCmdHandler(PXV::IPXV_Inst *pInst)
{
	m_pInst = pInst;
	HRESULT hRes;
	hRes = m_pInst->Str2ID(_T("cmd.save"), VARIANT_TRUE, &m_lSaveID);
	hRes = m_pInst->Str2ID(_T("cmd.saveAs"), VARIANT_TRUE, &m_lSaveAsID);
}

CPXVCmdHandler::~CPXVCmdHandler()
{

}

HRESULT STDMETHODCALLTYPE CPXVCmdHandler::QueryInterface(REFIID riid, void **ppvObject)
{
	// Always set out parameter to NULL, validating it first.
	if (!ppvObject)
		return E_INVALIDARG;
	*ppvObject = NULL;
	IID IID_IFun = { 0 };
	IIDFromString(_T("{157ca85b-4378-4a20-b060-37c61ded02a9}"), &IID_IFun);
	if (riid == IID_IFun)
	{
		// Increment the reference count and return the pointer.
		*ppvObject = (LPVOID)this;
		AddRef();
		return NOERROR;
	}
	return E_NOINTERFACE;
}


ULONG STDMETHODCALLTYPE CPXVCmdHandler::AddRef(void)
{
	InterlockedIncrement(&m_cRef);
	return m_cRef;
}


ULONG STDMETHODCALLTYPE CPXVCmdHandler::Release(void)
{
	// Decrement the object's internal counter.
	ULONG ulRefCount = InterlockedDecrement(&m_cRef);
	if (0 == m_cRef)
	{
		delete this;
	}
	return ulRefCount;
}

HRESULT STDMETHODCALLTYPE CPXVCmdHandler::OnCreateNewCtl(PXV::IUIX_Cmd *pCmd, PXV::IUIX_CmdBar *pParent, PXV::IUIX_Obj **ppCtrl)
{
	long lTmpID = 0;
	do
	{
		if (nullptr == pCmd) break;
		pCmd->get_ID(&lTmpID);
		if (lTmpID == m_lSaveID)
		{
			if (nullptr == m_pOldSaveHandler) break;
			m_pOldSaveHandler->OnCreateNewCtl(pCmd, pParent, ppCtrl);
		}
		else if (lTmpID == m_lSaveAsID)
		{
			if (nullptr == m_pOldSaveAsHandler) break;
			m_pOldSaveAsHandler->OnCreateNewCtl(pCmd, pParent, ppCtrl);
		}
		else *ppCtrl = nullptr;

	} while (false);

	return S_OK;
}

HRESULT STDMETHODCALLTYPE CPXVCmdHandler::OnGetCtlSizes(PXV::IUIX_CmdItem *pItem, tagSIZE *pSize, tagSIZE *pMinSize, tagSIZE *pMaxSize)
{
	PXV::IUIX_Cmd *pCmd = nullptr;
	long lTmpID = 0;
	do
	{
		if (nullptr == pItem) break;
		pItem->get_Cmd(&pCmd);
		if (nullptr == pCmd) break;
		pCmd->get_ID(&lTmpID);
		if (lTmpID == m_lSaveID)
		{
			if (nullptr == m_pOldSaveHandler) break;
			m_pOldSaveHandler->OnGetCtlSizes(pItem, pSize, pMinSize, pMaxSize);
		}
		else if (lTmpID == m_lSaveAsID)
		{
			if (nullptr == m_pOldSaveAsHandler) break;
			m_pOldSaveAsHandler->OnGetCtlSizes(pItem, pSize, pMinSize, pMaxSize);
		}

	} while (false);

	return S_OK;
}

HRESULT STDMETHODCALLTYPE CPXVCmdHandler::OnGetItemState(PXV::IUIX_Cmd *pCmd, PXV::IUIX_CmdItem *pItem, PXV::IUIX_Obj *pOwner, long *pState)
{
	long lTmpID = 0;
	do
	{
		if (nullptr == pCmd) break;
		pCmd->get_ID(&lTmpID);
		if (lTmpID == m_lSaveID)
		{
			if (nullptr == m_pOldSaveHandler) break;
			m_pOldSaveHandler->OnGetItemState(pCmd, pItem, pOwner, pState);
		}
		else if (lTmpID == m_lSaveAsID)
		{
			if (nullptr == m_pOldSaveAsHandler) break;
			m_pOldSaveAsHandler->OnGetItemState(pCmd, pItem, pOwner, pState);
		}
		else
			*pState = (long)PXV::UIX_CmdItemState::UIX_CmdItemState_Unknown;
	} while (false);

	return S_OK;
}

HRESULT STDMETHODCALLTYPE CPXVCmdHandler::OnGetItemSubMenu(PXV::IUIX_CmdItem *pItem, PXV::IUIX_CmdMenu **ppSubMenu)
{
	long lTmpID = 0;
	PXV::IUIX_Cmd *pCmd = nullptr;
	do
	{
		if (nullptr == pItem) break;
		pItem->get_Cmd(&pCmd);
		if (nullptr == pCmd) break;
		pCmd->get_ID(&lTmpID);

		if (lTmpID == m_lSaveID)
		{
			if (nullptr == m_pOldSaveHandler) break;
			m_pOldSaveHandler->OnGetItemSubMenu(pItem, ppSubMenu);
		}
		else if (lTmpID == m_lSaveAsID)
		{
			if (nullptr == m_pOldSaveAsHandler) break;
			m_pOldSaveAsHandler->OnGetItemSubMenu(pItem, ppSubMenu);
		}
		else
			pItem->get_SubMenu(ppSubMenu);

	} while (false);

	return S_OK;
}

HRESULT STDMETHODCALLTYPE CPXVCmdHandler::OnNotify(long lCode, PXV::IUIX_Cmd *pCmd, PXV::IUIX_CmdItem *pItem, PXV::IUIX_Obj *pOwner, ULONG_PTR puiNotifyData)
{
	long lTmpID = 0;
	do
	{
		if (nullptr == pCmd) break;
		pCmd->get_ID(&lTmpID);
		if (lTmpID == m_lSaveID)
		{
			if (nullptr == m_pOldSaveHandler) break;
			m_pOldSaveHandler->OnNotify(lCode, pCmd, pItem, pOwner, puiNotifyData);
		}
		else if (lTmpID == m_lSaveAsID)
		{
			if (nullptr == m_pOldSaveAsHandler) break;
			m_pOldSaveAsHandler->OnNotify(lCode, pCmd, pItem, pOwner, puiNotifyData);
		}
	} while (false);

	return S_OK;
}

HRESULT STDMETHODCALLTYPE CPXVCmdHandler::OnDrawItemIcon(PXV::IUIX_RenderContext *pRC, PXV::IUIX_CmdItem *pItem, tagRECT *pstIconRect, tagRECT *pstClip)
{
	long lTmpID = 0;
	PXV::IUIX_Cmd *pCmd = nullptr;
	do
	{
		if (nullptr == pItem) break;
		pItem->get_Cmd(&pCmd);
		if (nullptr == pCmd) break;
		pCmd->get_ID(&lTmpID);

		if (lTmpID == m_lSaveID)
		{
			if (nullptr == m_pOldSaveHandler) break;
			m_pOldSaveHandler->OnDrawItemIcon(pRC, pItem, pstIconRect, pstClip);
		}
		else if (lTmpID == m_lSaveAsID)
		{
			if (nullptr == m_pOldSaveAsHandler) break;
			m_pOldSaveAsHandler->OnDrawItemIcon(pRC, pItem, pstIconRect, pstClip);
		}

	} while (false);

	return S_OK;
}

Code: Select all

void CMainWindow::CustomSaveCmd()
{
	do 
	{
		IPXV_InstPtr pInst = nullptr;
		m_pIPXV->get_Inst(&pInst);
		if (nullptr == pInst) break;

		IUIX_InstPtr pIuiInst = nullptr;
		m_pMyCmdHandler = new CPXVCmdHandler(pInst);
		pInst->GetExtension(_T("UIX"), (IUnknown**)(&pIuiInst));
		if (nullptr == pIuiInst) break;
		
		IUIX_CmdManagerPtr pCmdManager = nullptr;
		pIuiInst->get_CmdManager(&pCmdManager);
		if (nullptr == pCmdManager) break;

		IUIX_CmdCollectionPtr pCmds = nullptr;
		pCmdManager->get_Cmds(&pCmds);
		if (nullptr == pCmds) break;

		IUIX_CmdPtr pCmd = nullptr;
		pCmds->Find(_T("cmd.save"), &pCmd);
		if (nullptr == pCmd) break;

		IUIX_CmdHandlerPtr pHandler = nullptr;
		pCmd->get_Handler(&pHandler);
		m_pMyCmdHandler->m_pOldSaveHandler = pHandler;
		pHandler = m_pMyCmdHandler;


		/*		pCmds->Find(_T("cmd.saveAs"), &pCmd);
		pCmd->get_Handler(&pHandler);
		m_pMyCmdHandler->m_pOldSaveAsHandler = pHandler;
		pHandler = m_pMyCmdHandler;*/

	} while (false);
	
}
bifangdejingjie
User
Posts: 43
Joined: Thu Oct 25, 2018 2:42 am

Re: UI message

Post by bifangdejingjie »

Sasha - Tracker Dev Team wrote:Hello bifangdejingjie,

If you are using the C++ language, then you can easily understand the C# language. Basically, what you need to do is to create your class implementation of the IUIX_CmdHandler interface and then set is as a handler of the needed command. This sample shows how to do it in C#:
https://gist.github.com/Polaringu/ad31ad433401c1c004d0

Cheers,
Alex
I need your help~
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: UI message

Post by Sasha - Tracker Dev Team »

Hello bifangdejingjie,

What didn't work exactly? Also, we will need a working sample project that we can try and recreate the problem (do not forget the problem description and steps to reproduce).

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
bifangdejingjie
User
Posts: 43
Joined: Thu Oct 25, 2018 2:42 am

Re: UI message

Post by bifangdejingjie »

Sasha - Tracker Dev Team wrote:Hello bifangdejingjie,

What didn't work exactly? Also, we will need a working sample project that we can try and recreate the problem (do not forget the problem description and steps to reproduce).

Cheers,
Alex
Hello,Alex
It’s my own problem,I am so stupid to call get_Handler instead of put_Handler in "CustomSaveCmd" function.
Thank you for you help~
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: UI message

Post by Sasha - Tracker Dev Team »

:)
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
bifangdejingjie
User
Posts: 43
Joined: Thu Oct 25, 2018 2:42 am

Re: UI message

Post by bifangdejingjie »

Sasha - Tracker Dev Team wrote::)
Hello,Alex
Where do I know that there are other message like “cmd.save” and "cmd.saveAs"?
Because I have to deal with other message.
Just like "saveto",Is there the "cmd.saveTo" message?
bifangdejingjie
User
Posts: 43
Joined: Thu Oct 25, 2018 2:42 am

Re: UI message

Post by bifangdejingjie »

Sasha - Tracker Dev Team wrote::)
Hello,Alex
I have solved the last problem.By the way,is there a axample for custom watermark?
Where I can get it? I have to learning it for I need.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: UI message

Post by Sasha - Tracker Dev Team »

Hello bifangdejingjie,

Here's a link to the operation that you can use:
https://sdkhelp.pdf-xchange.com/vi ... Watermarks

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
bifangdejingjie
User
Posts: 43
Joined: Thu Oct 25, 2018 2:42 am

Re: UI message

Post by bifangdejingjie »

Sasha - Tracker Dev Team wrote:Hello bifangdejingjie,

Here's a link to the operation that you can use:
https://sdkhelp.pdf-xchange.com/vi ... Watermarks

Cheers,
Alex
Hello Alex,
Thank you for your help.Now I have a problem that I can't solve.
When I handle the “cmd.saveTo” command,find that he mouse hovers over the menuitem "saveto" also get the "cmd.saveTo" command.
But In fact,The time I need to deal with "cmd.saveTo" command is when I click menuitem.Just like to deal with "saveToComp" command,this is what need.
What should I do? Please give me a hand~
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: UI message

Post by Sasha - Tracker Dev Team »

Hello bifangdejingjie,

I do not quite understand what you want. Basically, if you want to handle the command - you will have to make the custom command handler for it - that's all that is to it.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
bifangdejingjie
User
Posts: 43
Joined: Thu Oct 25, 2018 2:42 am

Re: UI message

Post by bifangdejingjie »

Sasha - Tracker Dev Team wrote:Hello bifangdejingjie,

I do not quite understand what you want. Basically, if you want to handle the command - you will have to make the custom command handler for it - that's all that is to it.

Cheers,
Alex
Hello Alex,
What is the “select folder for new palce” command and "save to custom place"?
bifangdejingjie
User
Posts: 43
Joined: Thu Oct 25, 2018 2:42 am

Re: UI message

Post by bifangdejingjie »

bifangdejingjie wrote:
Sasha - Tracker Dev Team wrote:Hello bifangdejingjie,

I do not quite understand what you want. Basically, if you want to handle the command - you will have to make the custom command handler for it - that's all that is to it.

Cheers,
Alex
Hello Alex,
What is the command name of “select folder for new palce” command and "save to custom place" command?
Just like "cmd.saveTo".Where may I know about these command name.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: UI message

Post by Sasha - Tracker Dev Team »

Hello bifangdejingjie,

To know the command ID - launch Customize Commands (Right Click on any command bar -> Customize Commands) and then right click the command that you need and selecte Properties. There you can see it's ID.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
bifangdejingjie
User
Posts: 43
Joined: Thu Oct 25, 2018 2:42 am

Re: UI message

Post by bifangdejingjie »

Sasha - Tracker Dev Team wrote:Hello bifangdejingjie,

To know the command ID - launch Customize Commands (Right Click on any command bar -> Customize Commands) and then right click the command that you need and selecte Properties. There you can see it's ID.

Cheers,
Alex
Hello Alex,
I don't know where to do the operation what your said.
May you elaborate on that?
bifangdejingjie
User
Posts: 43
Joined: Thu Oct 25, 2018 2:42 am

Re: UI message

Post by bifangdejingjie »

bifangdejingjie wrote:
Sasha - Tracker Dev Team wrote:Hello bifangdejingjie,

To know the command ID - launch Customize Commands (Right Click on any command bar -> Customize Commands) and then right click the command that you need and selecte Properties. There you can see it's ID.

Cheers,
Alex
Hello Alex,
I don't know where to do the operation what your said.
May you elaborate on that?
Such as,which demo to do the operation and?
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: UI message

Post by Sasha - Tracker Dev Team »

That should be done in the End-User Editor as this KB article suggests:
https://www.pdf-xchange.com/knowle ... nge-Editor

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
bifangdejingjie
User
Posts: 43
Joined: Thu Oct 25, 2018 2:42 am

Re: UI message

Post by bifangdejingjie »

Sasha - Tracker Dev Team wrote:That should be done in the End-User Editor as this KB article suggests:
https://www.pdf-xchange.com/knowle ... nge-Editor

Cheers,
Alex
Hello Alex,
For example
Image
After I executed the “Add a Place” command and add the “My Files’” folder,how can I handle the “My Files” Item's click command?
If I deal with "placesListSave" or "saveTo", not only mouse click it ,but also mouse hover it will get the hanlder. But I need to deal with click command but not hover.
bifangdejingjie
User
Posts: 43
Joined: Thu Oct 25, 2018 2:42 am

Re: UI message

Post by bifangdejingjie »

Sasha - Tracker Dev Team wrote:That should be done in the End-User Editor as this KB article suggests:
https://www.pdf-xchange.com/knowle ... nge-Editor

Cheers,
Alex
Hello Alex,
Used Registration-Free(Click-Once) Method(PDFXEditCore.x86.X.manifest and PDFXEditCore.x86.DLL) can works well in Windows XP,but can't work in others x64 system.
I don't know how to do.Please help me,thank you.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: UI message

Post by Sasha - Tracker Dev Team »

Hello bifangdejingjie,

Are you using Any CPU configuration to build your project?

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
bifangdejingjie
User
Posts: 43
Joined: Thu Oct 25, 2018 2:42 am

Re: UI message

Post by bifangdejingjie »

Sasha - Tracker Dev Team wrote:Hello bifangdejingjie,

Are you using Any CPU configuration to build your project?

Cheers,
Alex
Hello Alex,
I am used Win 32 CPU configuration to build.
bifangdejingjie
User
Posts: 43
Joined: Thu Oct 25, 2018 2:42 am

Re: UI message

Post by bifangdejingjie »

Sasha - Tracker Dev Team wrote:Hello bifangdejingjie,

Here's a link to the operation that you can use:
https://sdkhelp.pdf-xchange.com/vi ... Watermarks

Cheers,
Alex
Hello Alex,
Another question that I used "PlaceWatermark" instead of “op.document.addWatermarks” operation to add watermark ,what's the difference between both?
Is there any difference in execution speed?
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: UI message

Post by Sasha - Tracker Dev Team »

Hello bifangdejingjie,

If you are using the Editor SDK - then it's better to use the operation - it's more optimized.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
bifangdejingjie
User
Posts: 43
Joined: Thu Oct 25, 2018 2:42 am

Re: UI message

Post by bifangdejingjie »

Sasha - Tracker Dev Team wrote:Hello bifangdejingjie,

If you are using the Editor SDK - then it's better to use the operation - it's more optimized.

Cheers,
Alex
Hello Alex,
I have a issue when using the operation,I don't know how to get PXV::ICabNode's subnode and do next.
Below is the code i am tried.

Code: Select all

		if (nullptr == pParams) break;
		PXV::ICabNodePtr pRoot = nullptr;
		pParams->get_Root(&pRoot);

		if (nullptr == pRoot) break;
		pRoot->SetUnknown(_T("Input"), pCoreDoc);
		PXV::ICabNodePtr pOptions = nullptr;
		pOptions = (ICabNodePtr)pRoot["Options"];
		pOptions->SetString(_T("PagesRange.Type"), _T("All"));
		pOptions->SetString(_T("Text"), _T("Hi, I am watermark."));
		pOptions->SetInt(_T("Rotation"), 33);
// 		((ICabNodePtr)pOptions["PagesRange.Type"])->put_String(_T("All"));
// 		((ICabNodePtr)pOptions["Text"])->put_String(_T("Hi, I am watermark."));
// 		((ICabNodePtr)pOptions["Rotation"])->put_Int(33);
		pInst->AsyncDoAndWaitForFinish(pOp, 0);
bifangdejingjie
User
Posts: 43
Joined: Thu Oct 25, 2018 2:42 am

Re: UI message

Post by bifangdejingjie »

Sasha - Tracker Dev Team wrote:Hello bifangdejingjie,

Are you using Any CPU configuration to build your project?

Cheers,
Alex
Hello Alex,
I am used Win 32 CPU configuration to build.In 64-bit system, it is not successful to load "PDFXEditCore.x86.dll" or "PDFXEditCore.x64.dll" through manifest.
But In 32-bit system,it is works well.Below is the manifest I am used.Please help me,thank you.
PdfDemo.exe.manifest:

Code: Select all

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<assembly manifestVersion="1.0"
    xmlns="urn:schemas-microsoft-com:asm.v1"
    xmlns:asmv2="urn:schemas-microsoft-com:asm.v2"
    xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" >
 
    <assemblyIdentity version="1.0.0.0" name="PdfDemo" />
 
    <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
        <security>
            <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
                <requestedExecutionLevel level="asInvoker" uiAccess="false" />
            </requestedPrivileges>
        </security>
    </trustInfo>
 
    <!-- Registration-Free Redistribution part -->
    <dependency>
        <dependentAssembly>
            <assemblyIdentity type="win32" name="PDFXEditCore.x86.X" version="1.0.0.0" />
        </dependentAssembly>
    </dependency>
 
    <!-- Optional: enable themes for Windows common controls and dialogs (Windows XP and later) -->
    <dependency>
        <dependentAssembly>
            <assemblyIdentity
                type="win32"
                name="Microsoft.Windows.Common-Controls"
                version="6.0.0.0"
                processorArchitecture="*"
                publicKeyToken="6595b64144ccf1df"
                language="*" />
        </dependentAssembly>
    </dependency>
 
    <!-- Optional: enable DPI-Aware mode to prevent automatical DPI-scaling to avoid 'blurring' of UI -->
    <asmv3:application>
        <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
            <dpiAware>true</dpiAware>
        </asmv3:windowsSettings>
    </asmv3:application>
 
</assembly>
PDFEditCore.x86.X.manifest:

Code: Select all

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
 
    <assemblyIdentity
        type="win32"
        name="PDFXEditCore.x86.X"
        version="1.0.0.0" />
 
    <file name = "PDFXEditCore.x86.dll">
        <typelib
            tlbid="{0AAFF38C-CB91-4424-A8B9-F8B504ACBE0C}"
            version="1.0"
            helpdir=""/>
          
        <comClass
            clsid="{973BF60B-4CC6-4be0-B408-3D80E07FC2E6}"
            threadingModel="Apartment" />
         
        <comClass
            clsid="{A1149909-4EDC-4421-B9E5-E93C25A000A1}"
            threadingModel="Apartment" />
    </file>
 
    <comInterfaceExternalProxyStub
        name="IPXV_Inst"
        iid="{D726366D-34D6-49fc-A341-7B84C54CCA3E}"
        proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"
        baseInterface="{00000000-0000-0000-C000-000000000046}"
        tlbid="{0AAFF38C-CB91-4424-A8B9-F8B504ACBE0C}" />
     
    <comInterfaceExternalProxyStub
        name="IPXV_Control"
        iid="{71300D43-687F-436A-A699-2B37448D0803}"
        proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"
        baseInterface="{00000000-0000-0000-C000-000000000046}"
        tlbid="{0AAFF38C-CB91-4424-A8B9-F8B504ACBE0C}" />
     
</assembly>
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: UI message

Post by Sasha - Tracker Dev Team »

Hello bifangdejingjie,

I think here's the problem:

Code: Select all

<assemblyIdentity type="win32"  
It's being used in several places - so do take that into an account.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
bifangdejingjie
User
Posts: 43
Joined: Thu Oct 25, 2018 2:42 am

Re: UI message

Post by bifangdejingjie »

Sasha - Tracker Dev Team wrote:Hello bifangdejingjie,

I think here's the problem:

Code: Select all

<assemblyIdentity type="win32"  
It's being used in several places - so do take that into an account.

Cheers,
Alex
Hello Alex,
I am sorry that I can't understand what you said.Does that mean use 'type="win32"' instead of 'type="x64"'?
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: UI message

Post by Sasha - Tracker Dev Team »

Hello bifangdejingjie,

If you want to build for x64 - you should use type="x64".

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
bifangdejingjie
User
Posts: 43
Joined: Thu Oct 25, 2018 2:42 am

Re: UI message

Post by bifangdejingjie »

Sasha - Tracker Dev Team wrote:Hello bifangdejingjie,

If you want to build for x64 - you should use type="x64".

Cheers,
Alex
Hello Alex,
If I want to build for "32-bit" and "64-bit" both system,what shall I do?
bifangdejingjie
User
Posts: 43
Joined: Thu Oct 25, 2018 2:42 am

Re: UI message

Post by bifangdejingjie »

Sasha - Tracker Dev Team wrote:Hello bifangdejingjie,

If you want to build for x64 - you should use type="x64".

Cheers,
Alex
Hello Alex,
The problem I encountered was that manifest worked well on 32-bit systems, but not on 64-bit systems.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: UI message

Post by Sasha - Tracker Dev Team »

Hello bifangdejingjie,

Maybe you are using the x64 dlls when installing on the x86 machine?
Can you provide us with those installs so we can test them?

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
bifangdejingjie
User
Posts: 43
Joined: Thu Oct 25, 2018 2:42 am

Re: UI message

Post by bifangdejingjie »

Sasha - Tracker Dev Team wrote:Hello bifangdejingjie,

If you want to build for x64 - you should use type="x64".

Cheers,
Alex
Hello Alex,
May you give me a x64 manifest example,I can't find about it and I've tried many ways but failed.Thank you.
bifangdejingjie
User
Posts: 43
Joined: Thu Oct 25, 2018 2:42 am

Re: UI message

Post by bifangdejingjie »

[quote="Sasha - Tracker Dev Team"]Hello bifangdejingjie,

Maybe you are using the x64 dlls when installing on the x86 machine?
Can you provide us with those installs so we can test them?

Cheers,
Alex
Hello Alex,
I'm sure I use x86 dll.It can work well in 32-bit system when I use “PDFXEditCore.x86.dll” and "Resources.dat" and “PDFXEditCore.x86.X.manifest” and “PDFDemo.exe.manifest”,but not in 64-bit system.
Attachments
manifest.zip
(1.45 KiB) Downloaded 121 times
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: UI message

Post by Sasha - Tracker Dev Team »

Hello bifangdejingjie,

1) Do not paste quote at the start of each message.
2) As we said before, we will need both of your installs that work and do not work that's all that we need for now.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
bifangdejingjie
User
Posts: 43
Joined: Thu Oct 25, 2018 2:42 am

Re: UI message

Post by bifangdejingjie »

Sasha - Tracker Dev Team wrote:Hello bifangdejingjie,

1) Do not paste quote at the start of each message.
2) As we said before, we will need both of your installs that work and do not work that's all that we need for now.

Cheers,
Alex
Hello Alex,

Okay, this the sample demo。It can works in Win XP but not in 64-bit system.
The maximum limit is not more than 5 MB.So Just Attach these.
Attachments
Bin.7z
(1.97 MiB) Downloaded 117 times
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: UI message

Post by Sasha - Tracker Dev Team »

Hello bifangdejingjie,

Your manifest does not work at all. What we suspect is that you have the dll registered via the regsvr32 and thus the program uses it. You can see that by using the Process Explorer for example. Make sure that you have unregistered the dll and then try launching your project and it should fail. If it does fail then everything is OK now, and you can add the PDFXEditCore.x86.dll and Resources.dat file to the folder where the exe and manifest files are.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply