Announcement

Collapse
No announcement yet.

Problem with Call DWord assignment to Class/Property

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with Call DWord assignment to Class/Property

    I get a Syntax Error during compiling when using Call DWord to assign the result directly to a Class Property. Maybe such a thing was never intended to be allowed but I thought that I would report it just in case.

    Code:
    #Compile Exe
    
    #Include "win32api.inc"
    
    Declare Function IsXPThemeActive() As Long
    
    
    ''
    ''  clsApplication
    ''    (Main class that controls all other classes)
    ''
    Class clsApplication
       Instance m_IsXPThemeActive As Long
    
       '//
       '//
       Interface ApplicationInterface: Inherit IUnknown     
    
          Property Get IsXPThemeActive() As Long
             Property = m_IsXPThemeActive 
          End Property
    
          Property Set IsXPThemeActive( ByVal nValue As Long )
             m_IsXPThemeActive = nValue
          End Property
          
       End Interface
    
    End Class
    
    Global gclsApp As ApplicationInterface
    
    
    
    ''
    '' Main program entry point
    ''
    Function PBMain() As Long
    
       Local hLib  As Dword
       Local pProc As Dword
       Local nTemp As Long
    
       Let gclsApp = Class "clsApplication"
    
       hLib = LoadLibrary("UxTheme.dll")
       If hLib Then
          pProc = GetProcAddress(hLib, "IsThemeActive")
          If pProc Then
             
             ' Assigning to a temporary variable works perfectly
             Call Dword pProc Using IsXPThemeActive To nTemp
             gclsApp.IsXPThemeActive = nTemp
             
             ' Trying to assign directly to the Class Property
             ' causes a Syntax error.
             Call Dword pProc Using IsXPThemeActive To gclsApp.IsXPThemeActive
             
          End If
          FreeLibrary hLib
       End If      
       
       
       MsgBox "Complete."
       
    End Function
    Paul Squires
    FireFly Visual Designer (for PowerBASIC Windows 10+)
    Version 3 now available.
    http://www.planetsquires.com

  • #2
    It won't also work if gclsApp.IsXPThemeActive was a function. The target of the TO clause must be a variable.
    Forum: http://www.jose.it-berater.org/smfforum/index.php

    Comment


    • #3
      I experianced a few of 'shortcommings' like ObjPtr( cls.property )
      Obvious though.
      hellobasic

      Comment

      Working...
      X