Highlighted

gHINSTANCE is undefined ERROR when trying to have a custom icon for a toolbar button

Explorer ,
Jun 06, 2020

Copy link to clipboard

Copied

Hello everyone 

 

I am trying to add a button to a toolbar using plugins and I want it to have a custom icon.

I found in the SDK the following code snippet:

 

//Declare an AVToolButton object

AVToolButton MyButton = NULL;

 

//Create an AVIcon object

AVIcon myIcon = (AVCursor)LoadBitmap(gHINSTANCE, MAKEINTRESOURCE(IDB_BITMAP1));

 

//Create a new button

MyButton = AVToolButtonNew(ASAtomFromString("MyExtn:MyButton"), myIcon, false, false);

 

 

When I try using this in visual studio, it shows me the error "identifier gHINSTANCE is undefined"

I have included the "PIMain.c" file as well , and as the SDK says that gHINSTANCE is an instance of object HINSTANCE, I can also see this object declaration in PIMain.c file.

 

 

 

Can anyone suggest what could be going wrong here?

Thanks

 

Most Valuable Participant
Correct answer by Test Screen Name | Most Valuable Participant

This is defined in one of the header files. Perhaps you did not keep all the original #include lines. Or maybe you need to add another one - search the SDK and API headers to find the definition and any comments.

TOPICS
Acrobat SDK and JavaScript

Views

281

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

gHINSTANCE is undefined ERROR when trying to have a custom icon for a toolbar button

Explorer ,
Jun 06, 2020

Copy link to clipboard

Copied

Hello everyone 

 

I am trying to add a button to a toolbar using plugins and I want it to have a custom icon.

I found in the SDK the following code snippet:

 

//Declare an AVToolButton object

AVToolButton MyButton = NULL;

 

//Create an AVIcon object

AVIcon myIcon = (AVCursor)LoadBitmap(gHINSTANCE, MAKEINTRESOURCE(IDB_BITMAP1));

 

//Create a new button

MyButton = AVToolButtonNew(ASAtomFromString("MyExtn:MyButton"), myIcon, false, false);

 

 

When I try using this in visual studio, it shows me the error "identifier gHINSTANCE is undefined"

I have included the "PIMain.c" file as well , and as the SDK says that gHINSTANCE is an instance of object HINSTANCE, I can also see this object declaration in PIMain.c file.

 

 

 

Can anyone suggest what could be going wrong here?

Thanks

 

Most Valuable Participant
Correct answer by Test Screen Name | Most Valuable Participant

This is defined in one of the header files. Perhaps you did not keep all the original #include lines. Or maybe you need to add another one - search the SDK and API headers to find the definition and any comments.

TOPICS
Acrobat SDK and JavaScript

Views

282

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jun 06, 2020 0
Adobe Community Professional ,
Jun 06, 2020

Copy link to clipboard

Copied

You need more then this snippet.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 06, 2020 1
Most Valuable Participant ,
Jun 06, 2020

Copy link to clipboard

Copied

You haven't included the needed header files. Don't try to make a plug-in from scratch, I have been working with plug-ins for more than 20 years and would never try this. Use the sample starter plug-in, understand what it does, then add your code.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 06, 2020 1
Explorer ,
Jun 06, 2020

Copy link to clipboard

Copied

Yes , I have actually started by setting up the BasicPlugin sample that comes with Acrobat SDK, I am successfully able to add the button with the default icon. Initially I was not much interested in getting a custom icon as I was not familiar with the LoadBitmap function , but now I have understood LoadBitmap, have a bitmap file in my resources as well, but  unfortunately this error popped up. Please help 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 06, 2020 0
Most Valuable Participant ,
Jun 06, 2020

Copy link to clipboard

Copied

This is defined in one of the header files. Perhaps you did not keep all the original #include lines. Or maybe you need to add another one - search the SDK and API headers to find the definition and any comments.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 06, 2020 1
Explorer ,
Jun 06, 2020

Copy link to clipboard

Copied

Thanks a lot for the guidance, Actually I was missing the "PIMain.h" header file.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 06, 2020 0