Author Topic: PBWin10 and COM  (Read 6357 times)

0 Members and 1 Guest are viewing this topic.

Offline Dominic Mitchell

  • Jr. Member
  • **
  • Posts: 64
  • User-Rate: +11/-5
    • Prometheus Software
PBWin10 and COM
« on: March 29, 2011, 10:02:40 PM »
Finding out what is different between 9 and 10 should be interesting.
My Component Object Model SDK class successfully compiles on both version 9 and 10, but
the exe produced by version 10 GPF's.
Dominic Mitchell
Phoenix Visual Designer
http://www.phnxthunder.com

Offline José Roca

  • Administrator
  • Hero Member
  • *****
  • Posts: 2481
  • User-Rate: +204/-0
Re: PBWin10 and COM
« Reply #1 on: March 29, 2011, 10:11:30 PM »
Regarding COM, the major change is native Unicode support.

Also, if you use internal callback classes that are called by an external application, you must declare them as COMMON to avoid code removal.
« Last Edit: March 29, 2011, 10:14:28 PM by José Roca »

Offline José Roca

  • Administrator
  • Hero Member
  • *****
  • Posts: 2481
  • User-Rate: +204/-0
Re: PBWin10 and COM
« Reply #2 on: March 29, 2011, 10:30:26 PM »
 
Another change is that VARIANT$ is now for VARIANTs containing an ANSI string. For VARIANTs containing an Unicode string you must use VARIANT$$.

Offline Dominic Mitchell

  • Jr. Member
  • **
  • Posts: 64
  • User-Rate: +11/-5
    • Prometheus Software
Re: PBWin10 and COM
« Reply #3 on: March 29, 2011, 10:45:51 PM »
#OPTIMIZE CODE OFF does not solve the problem.

I will check Unicode/Variant$ later.
Dominic Mitchell
Phoenix Visual Designer
http://www.phnxthunder.com

Offline Eros Olmi

  • Full Member
  • ***
  • Posts: 243
  • User-Rate: +18/-7
    • thinBasic
Re: PBWin10 and COM
« Reply #4 on: March 29, 2011, 11:02:02 PM »
Maybe

#OPTION ANSIAPI
thinBasic Script Interpreter - www.thinbasic.com | www.thinbasic.com/community
Win7Pro 64bit - 8GB Ram - Intel i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

Offline José Roca

  • Administrator
  • Hero Member
  • *****
  • Posts: 2481
  • User-Rate: +204/-0
Re: PBWin10 and COM
« Reply #5 on: March 29, 2011, 11:25:52 PM »
Quote
I will check Unicode/Variant$ later.

Got it working just changing three VARIANT$ to VARIANT$$ in SDK_Class.bas.

Offline Dominic Mitchell

  • Jr. Member
  • **
  • Posts: 64
  • User-Rate: +11/-5
    • Prometheus Software
Re: PBWin10 and COM
« Reply #6 on: March 29, 2011, 11:42:58 PM »
Thanks.
The utility I use to track down GPFs does not handle PowerBASIC COM syntax. I was in the process of modifying it.
If PB 10 handles calculated references, I will just specify that the SDK class must be used with
version 10 or higher of the compiler.
On second thought, I will not bother supporting version 9 for this class.
Dominic Mitchell
Phoenix Visual Designer
http://www.phnxthunder.com

Offline José Roca

  • Administrator
  • Hero Member
  • *****
  • Posts: 2481
  • User-Rate: +204/-0
Re: PBWin10 and COM
« Reply #7 on: March 30, 2011, 12:02:29 AM »
Quote
If PB 10 handles calculated references [...]

Unfortunately, it does not.

The two features I was most interested and that I have checked thoroughly during the beta testing, are unicode support and dead code removal.

No more need for ACODE$/UCODE$ and USEMACROS, and no more need for workarounds such declaring a null terminated string parameter as DWORD, using an ansi string with UCODE$ and passing it with STRPTR. Now, these parameters are declared as BYREF WSTRINGZ.

Dead code removal is allowing me to write classes and tons of wrapper functions that don't add bloat. It's a great way of extending the language.

Your ListView example for the SDK_Class compiled to 199 KB using PB9 and now compiles to 97 KB using PB 10 and my new headers.


« Last Edit: March 30, 2011, 12:42:47 AM by José Roca »

Offline Dominic Mitchell

  • Jr. Member
  • **
  • Posts: 64
  • User-Rate: +11/-5
    • Prometheus Software
Re: PBWin10 and COM
« Reply #8 on: March 30, 2011, 12:15:08 AM »
Thanks again, you just saved me a lot of trouble.

The size reduction is very impressive.  It means I can add functionality to the class with total abandon.
Dominic Mitchell
Phoenix Visual Designer
http://www.phnxthunder.com

Offline Jean-Pierre Leroy

  • Newbie
  • *
  • Posts: 6
  • User-Rate: +1/-1
Re: PBWin10 and COM
« Reply #9 on: March 30, 2011, 12:16:24 PM »
Quote
No more need for ACODE$/UCODE$ and USEMACROS, and no more need for workarounds such declaring a null terminated string parameter as DWORD, using an ansi string with UCODE$ and passing it with STRPTR. Now, these parameters are declared as BYREF WSTRINGZ.

Hi José,

Some times ago you wrote some codes to retrieve the date and time when the original image data was generated; it was in this thread (http://www.powerbasic.com/support/pbforums/showthread.php?t=43429)

Following your advices, I adapted the code with the new WSTRINGZ string data type and everything works fine now; thanks.

With PB9
Code: [Select]
Local lPictureFileName As String   
lPictureFileName = UCode$(pPictureFileName)
hStatus = GdipLoadImageFromFile(StrPtr(lPictureFileName), pImage)

With PB10
Code: [Select]
Local lPictureFileName As WSTRINGZ*%MAX_PATH 
lPictureFileName = pPictureFileName
hStatus = GdipLoadImageFromFile(lPictureFileName, pImage)

Thanks,
Jean-Pierre