Page 12 of 39
					
				
				Posted: Sun Sep 21, 2008 12:00 pm
				by srod
				ts-soft wrote:Little John wrote:
With all three programs, I get the error message:
Couldn't create the ActiveX control!
Any ideas?
 
Register a ActiveX requires Admin privilege!
 
Good point. The fact that the MSComCtrlTree seems to work okay for Little John would indeed suggest that this is the problem.  
 
Should XP not throw up some kind of message in this situation though?
 
			 
			
					
				
				Posted: Sun Sep 21, 2008 1:20 pm
				by Little John
				That solved the problem, thanks Thomas! The demos are impressive. And thanks again to srod!
Is there a way to register ActiveX controls with Admin privileges permanently, so that afterwards any normal user with restricted privileges can use them, too?
Regards, Little John
//edit
I'm too slow ...
Yes, there's no problem here with the MSComCtrlTree.
			 
			
					
				
				Posted: Sun Sep 21, 2008 1:28 pm
				by ts-soft
				Little John wrote:
Is there a way to register ActiveX controls with Admin privileges permanently, so that afterwards any normal user with restricted privileges can use them, too?
Remove the unregisterfunction in the demo code  

 
			 
			
					
				
				Posted: Sun Sep 21, 2008 2:03 pm
				by Little John
				Thanks again! As you already might have guessed 

, I really don't know much about all this COM stuff.
Regards, Little John
 
			 
			
					
				
				Posted: Sun Sep 21, 2008 2:09 pm
				by ts-soft
				you're welcome
			 
			
					
				
				Posted: Sun Sep 21, 2008 3:44 pm
				by srod
				@LittleJohn, the ActiveX demos will unregister a control only if they themselves had to register it in the first place; that is a demo will not unregister the control if it was already registered before the demo started.  
So run the demo once with the unregisterfunction commented out and then you can uncomment it because the demo will not attempt to unregister the control from that point on.
			 
			
					
				
				Posted: Sun Sep 21, 2008 3:53 pm
				by Little John
				I see. Thanks for the explanation!
Regards, Little John
			 
			
					
				
				Posted: Sun Sep 21, 2008 5:08 pm
				by byo
				Great work as usual. 

 
			 
			
					
				
				Posted: Wed Sep 24, 2008 6:47 pm
				by Xombie
				jpd wrote:Hi,
I search to use the methode EnableStatic for change the IPAddress
on the  NetAdapter..
using the class Win32_NetworkAdapterConfiguration 
this error appair 
-2147024809
One or more arguments are invalid. Possibly a numerical overflow or too many nested objects, -if so, try splitting your method call into two or more subcalls.
any idea ?
Code: Select all
;/////////////////////////////////////////////////////////////////////////////////
;***COMate***  COM automation through iDispatch.
;*===========
;*
;*WMI demo - renew IP addresses. By SFSxOI.
;/////////////////////////////////////////////////////////////////////////////////
IncludePath "..\.."
XIncludeFile "COMate.pbi"
XIncludeFile "VariantHelper_Include.pb"
Define.COMateObject objWMIService, objNetCard 
colNetCards.COMateEnumObject 
Define *IPAddress.VARIANT,*ConnectID.VARIANT, *varIP.VARIANT
  *sa.SafeArray
strComputer.s = "." 
objWMIService = COMate_GetObject("winmgmts:\" + strComputer + "\root\cimv2", "") 
If objWMIService 
  colNetCards = objWMIService\CreateEnumeration("ExecQuery('Select IPAddress from Win32_NetworkAdapterConfiguration')")  
  If colNetCards 
  
    objNetCard = colNetCards\GetNextObject() 
    While objNetCard 
    ;Debug objNetCard\GetstringProperty("IPAddress")
    *IPAddress= objNetCard\GetvariantProperty("IPAddress") 
        If *IPAddress\vt <> #VT_NULL
          *sa = *IPAddress\parray
          For i = saLBound(*sa) To saUBound(*sa)
            *varIP = SA_VARIANT(*sa, i)
            If *varIP\vt <> #VT_BSTR
              VariantChangeType_(*varIP, *varIP, 0, #VT_BSTR)
            EndIf
            sIPAddress.s= PeekS(*varIP\bstrVal, -1, #PB_Unicode)
            If sIPAddress="192.168.65.5"
            ;objNetCard\SetProperty("EnableStatic'(192.168.66.5,255.255.255.0)'") 
            objNetCard\SetProperty("EnableStatic($0027"+"192.168.66.5,255.255.255.0"+"$0027)") 
           Debug  COMate_GetLastErrorCode() 
           Debug COMate_GetLastErrorDescription() 
          EndIf
            VariantClear_(*varIP)
            
          Next
          saFreeSafeArray(*sa)
        EndIf
        VariantClear_(*IPAddress) : FreeMemory(*IPAddress)
        
      objNetCard\Invoke("RenewDHCPLease()") 
      objNetCard\Release() 
      objNetCard = colNetCards\GetNextObject() 
    Wend 
    colNetCards\Release() 
  EndIf 
  objWMIService\Release()  
Else
  MessageRequester("COMate - WMI demo", "Couldn't create the WMI scripting object!")
EndIf 
Thanks
jpd
 
I had this problem and solved it by enclosing multiple parameters with a parenthesis.
Code: Select all
Series\Invoke("Add(100, 'Europe', 255)")
Rather than
Code: Select all
Series\Invoke("Add 100, 'Europe', 255")
 
			 
			
					
				
				Posted: Thu Sep 25, 2008 3:50 pm
				by jpd
				Hi Xombie,
thanks for interest on my call!
but this methode not Help, or I'm use it not in the right manner 
I think that the right methode is the indicated from srod.
thanks srod!
at this time I'm to busy with another project and can spend anymore time on this problem.
But if I find in the future a solution I will post this.
Thank again
jpd
 
			 
			
					
				
				Posted: Thu Sep 25, 2008 4:36 pm
				by srod
				Actually jpd, Xombie has a point when I look at the following :
Code: Select all
objNetCard\SetProperty("EnableStatic($0027"+"192.168.66.5,255.255.255.0"+"$0027)")
a SetProperty should have an '=' in it!!!
There is definitely something wrong here!
 
			 
			
					
				
				Posted: Thu Sep 25, 2008 11:02 pm
				by X
				Any possibility of having a 64bit version?
			 
			
					
				
				Posted: Thu Sep 25, 2008 11:27 pm
				by srod
				I am told that COMate generates an ASM error on PB 64.  I should have a 64-bit OS up and running by the weekend and so should be able to take a look - although I'd be tempted to await the release version of PB 4.3 before attempting to resolve any issues.
			 
			
					
				
				Posted: Thu Sep 25, 2008 11:56 pm
				by X
				Thanks for the news 

 
			 
			
					
				
				Posted: Fri Sep 26, 2008 9:00 pm
				by SFSxOI
				I'm not sure if there is something wrong here or not. If I have this code:
Code: Select all
XIncludeFile "COMate.pbi"
XIncludeFile "VariantHelper_Include.pbi"
Procedure OS_Version()
Define.COMateObject objWMIService, Version
colOS.COMateEnumObject
strComputer.s = "." 
objWMIService = COMate_GetObject("winmgmts:\\" + strComputer + "\root\cimv2", "") 
If objWMIService 
  colOS = objWMIService\CreateEnumeration("ExecQuery('Select * from Win32_OperatingSystem')")
  If colOS 
    Version = colOS\GetNextObject() 
    While Version
      
      Debug Version\GetStringProperty("OSLanguage")
            
      Version\Release() 
      Version = colOS\GetNextObject()
    Wend
    colOS\Release() 
  EndIf
  objWMIService\Release()  
EndIf
EndProcedure
The language version code is returned properly, however, the issue i'm not sure about is the use of GetStringProperty for this. Heres why; The MSDN at 
http://msdn.microsoft.com/en-us/library/aa394239.aspx for the Win32_OperatingSystem class says that OSLanguage is listed As:
Data type: uint32
Access type: Read-only
In this case both GetIntegerProperty AND GetStringProperty work to retrieve the unit32 property and both return the correct value.
Why are both of them working to retrieve this property value with the latest version of Comate ? Is this a bug with Comate? Should it not be one or the other but not both?
I came across this accidently during a copy and paste when changing from GetStringProperty to GetIntegerProperty for something else and left the OSLanguage in place by accident.