1. Miguel Leeuwe
  2. PowerBuilder
  3. Thursday, 26 May 2022 20:07 PM UTC

Hi, 

I'd like to have a look at PBNI.

From the pb help:

 

I'm using VS Studio 2022 Community edition. No PBNI template / wizard seems to be available when creating a new C++ project. What am I missing? Do I need to install something? Is maybe the community edition not fit for this?

Then also, does anyone have some good documentation / examples on how to use PBNI?

TIA,

MiguelL

 

Accepted Answer
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Friday, 27 May 2022 11:30 AM UTC
  2. PowerBuilder
  3. # Permalink
Hi Chris, That would explain it, lol. Once again (maybe) outdated information in the pb help. Let's see if anyone else can give me some information. Thanks!
Comment
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Friday, 27 May 2022 18:34 PM UTC
  2. PowerBuilder
  3. # 1

Hi, Miguel - 

I didn't want to leave my promise to help you hanging over the weekend.

I've attached three small zip files:

  1. PBNI API Callbacks PB.zip is a PB test app that uses the PBNI extension, n_pbni_api_callbacks.pbx. 
  2. PBNI.zip contains the PBNI source code files. I place this folder in my Visual Studio development folder at the same level as the VS project/solution folder. In this way I have a single development copy of the PBNI source files that can be easily attached to this and other PBNI projects I might be working on.
  3. PBNI_API_Callbacks VS.zip is the Visual Studio development folder that contains the VS solution (.sln) file and related source code files.

I have the VS project configured to produce the DLL with the .pbx extension, even though this is not necessary (as Roland has indicated).

This PBNI example was created as a way to obtain the hMonitor (Windows handle to a monitor) values for every monitor in use on a PC. The technique prescribed to accomplish this is by using a callback function, which PB does not support. There are other ways you can obtain the handles to all monitors, but utilizing a callback function is a much simpler approach.

The PBNI example also contains functions for peeking into a PB structure from within PBNI. This was something I was interested in learning about recently. These functions illustrate how to access PB function argument values that are passed into a PBNI method, so that is why I selected this PBNI example to give to you.

John

Attachments (3)
Comment
  1. Miguel Leeuwe
  2. Friday, 27 May 2022 23:52 PM UTC
Wow John, Thank you so much!
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Thursday, 26 May 2022 20:32 PM UTC
  2. PowerBuilder
  3. # 2

Hi Miguel;

  I believe that the VS wizard for PBNI is no longer part of the latest PB installations. I also believe that the last wizard produced was either for VS2002 and/or VS2015. So I think that you will not find that VS add-in any longer. Maybe Bruce or Roland might know for sure.

Regards .. Chris

Comment
  1. Roland Smith
  2. Friday, 27 May 2022 12:59 PM UTC
Something good to know: a PBX is really a DLL with a different name. You don't have to name it PBX, you can use DLL and it will work fine.
  1. Helpful 3
  1. Miguel Leeuwe
  2. Saturday, 28 May 2022 08:16 AM UTC
Finally! After 3 hours I figured out how to even get the examples to compile. My main problem was the setting in VS for precompiled headers, but it's working now and my little journey can begin.

Thanks again John and Roland!
  1. Helpful
  1. Miguel Leeuwe
  2. Saturday, 28 May 2022 08:20 AM UTC
(as an explanation: after VS2017, stdafx.h is now to be pch.h. I tried but it still gave me loads of problems, so the solution was to OFF the precompiled header. That's the setting Roland was already using anyway, but was not the case in John's example).
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.