Skip to main content
Participating Frequently
August 8, 2017
Question

Hi, i want to add a button into a toolbar adobe with c++ , any help please

  • August 8, 2017
  • 6 replies
  • 1582 views

I've writted some code but it show me this erreur

(m_lpDispatch == NULL); : app.exe has trigged a breakpoint

but I think that I've do mistake into my code please really I need your help , I want to no how to step

This topic has been closed for replies.

6 replies

Legend
August 9, 2017

To program with the SDK you have to study the documentation. Many people try to, instead, copy and paste little pieces they found on the internet. This will not work, extensive study is needed.

The short answer is you CANNOT mix these two kinds of thing in one app. You cannot use anything from the plug-in API in your app AT ALL, not by any trick or study.

Legend
August 8, 2017

See this thread for some important hints about writing plug-ins: plugin creation

lrosenth
Adobe Employee
Adobe Employee
August 8, 2017

And be sure to read the documentation in the SDK as well as the sample code that comes with it…

lrosenth
Adobe Employee
Adobe Employee
August 9, 2017

hello,

thank you all for your help , I'm gonna show you some code but I have a lot of error

I've followed the link http://wwwimages.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/plugin_apps_developer_guide.pdf

Page :47

my code :

Buff[256];

int i;

bool b;

CAcroPDDoc pddoc;

CAcroPDPage pdpage;

PDEContent pdecontent;

//FixedRect mediabox;


PDSysFont pdefont;

PDEText pdetext;

//FixedMatrix textmatrix;


PDEColorSpace pdecolorspace;

//PDEGraphicstate pdegraphicstate;


char *Hellowordstr = "hello PDF !";


MAC_ENV

// create doc, Page, Content


PDDocCreate();

fixedZero;

Int16ToFixed(4 * 72);

Int16ToFixed(5 * 72);

fixedZero;

PDPage = PDDocCreatePage(pddoc, PDBeforeFirstPage, mediaBox);

NULL);

// Acquire Font, add Text, and insert into page content container //


sizeof(pdeFontAttrs));

ASAtomFromString("CourierStd");

ASAtomFromString("Type1");

sizeof(PDEFontAttrs), 0);

PDEColorSpace = PDEColorSpaceCreateFromName(ASAtomFromString("DeviceGray"));

sizeof(PDEGraphicState));

fixedTen;

fixedOne;

fixedOne;

// Create ASFixedMatrix object


sizeof(textMatrix));

Int16ToFixed(24);

Int16ToFixed(24);

Int16ToFixed(1 * 72);

Int16ToFixed(2 * 72);

// Create a PDEtext object


sizeof(gstate), NULL, 0, &textMatrix, null);

// Insert text into the page content


PDEElement)pdeText);

// Convert to objects, add to page, and release resources //


//set the PDEContent for the page


// save document to a file


if (!IMAC_ENV)

PDSaveFull | PDSaveLinearized, ASPathFromPlatformPath("out.pdf"), null, null, null);

else


//macPath = GetMacPath("out.pdf");


PDSaveFull | PDSaveLinearized, macPath, null, null, null);

// Release all objects


PDEObject)pdeFont);

PDEObject)pdeText);

PDEObject)pdeColorSpace);

return 0;

and my goal is to add a button on the toolbar adobe

thank you all


You are mixing IAC and Plugin stuff.

For example – CAcroPDDoc is IAC and PDEContent is plugin.

Legend
August 8, 2017

I do agree though, there seems to be some code from a plugin dropped into an IAC app. You can't do that.

Legend
August 8, 2017

Sorry that seems to be an entirely different error.

Legend
August 8, 2017

Thank you. Which line of your code is producing the error? Unfortunately parts of it are missing in your post.

Participating Frequently
August 8, 2017

thanks for your response.

the errue is in oledisp2.cpp a file don't exist in my project

Legend
August 8, 2017

You will have to tell us what your code is.

Participating Frequently
August 8, 2017

RemoteControlAcrobatView.cpp :

CRemoteControlAcrobatView::OnAcrobatLaunch()


if(m_pAcroApp) return;


COleException e;

new CAcroApp;

"AcroExch.App", &e);

if(!m_pAcroApp)

"Can not get Acrobat IAC Object!");

else

if(m_pAcroApp->GetNumAVDocs()>0) {

new CAcroAVDoc;

TRUE);

the goal of this code is to lunch a new document pdf

--------------------------------------------------------------------

CRemoteControlAcrobatView::OnEditviewAddbutton()

CString m_strDescription;

COleException e;

try {

if (!m_pAcroApp->CreateDispatch("AcroExch.App", &e))

"Can not get Acrobat IAC Object!");

else


TRUE);

AVToolBar *toolbar;

AVToolBarPosition avtoolbarposition;

sizeof(avtoolbarposition), 0);

sizeof(avtoolbarposition);

false;

//avtoolbarposition.dockPosition = kAVToolBarDockTop;


"test";

//avtoolbarposition.layout = kAVToolBarFloating;


false;

false;

AVToolBarAddButton((toolbar, avtoolbarposition, FALSE, NULL));

//AVAppRegisterToolBarPosition("SaveToolBar_Dafolo", false, &avtoolbarposition); // also tried true as the 2nd parameter


if (toolbar)

/*if (!AfxOleInit()) // Your addition starts here

/*AVIcon*  myIcon;





catch (COleDispatchException & e) {

this is the wrong code thanks a lot

Bernd Alheit
Community Expert
Community Expert
August 8, 2017

Your code looks a mix of IAC and plugin.