1. Daryl Foster
  2. PowerBuilder
  3. Thursday, 16 November 2017 06:24 AM UTC

Hi all, sorry but I've got another .Net Assembly target question.  If I have an NVO that I use in both a Powerbuilder Classic Windows application and also in a .Net Assembly, is there a way for that NVO to know whether it is being executed as a Win 32 application or as a .Net Assembly?

Accepted Answer
Bruce Armstrong Accepted Answer Pending Moderation
  1. Thursday, 16 November 2017 07:13 AM UTC
  2. PowerBuilder
  3. # Permalink

Look at the conditional compilation section of the documentation:

#IF PBDOTNET will tell you that the code is running in any of the .Net targets.

#IF PBNATIVE will tell you that's it's running from a Win32 target.

Comment
  1. Michael Jakobsen
  2. Thursday, 16 November 2017 11:12 AM UTC
A code snippet I have used:



// Instance variable

private boolean dotNetAssembly



// Constructor

#if defined PBDOTNET then

   dotNetAssembly= true

#end if



// Elsewhere in code

if not dotNetAssembly then

   MessageBox("Warning", "...", Exclamation!)

end if

return ll_errorCode

 

  1. Helpful
  1. Daryl Foster
  2. Friday, 17 November 2017 00:29 AM UTC
Perfect!  Thanks Bruce. For some silly reason I had thought the conditional compilation had been removed with the .Net WinForms target.

  1. Helpful
  1. Daryl Foster
  2. Friday, 17 November 2017 00:33 AM UTC
Thanks Michael, I think I will use similar code.

  1. Helpful
There are no comments made yet.


There are replies in this question but you are not allowed to view the replies from 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.