COMate - control COM objects via automation - OBSOLETE!

Developed or developing a new product in PureBasic? Tell the world about it.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Well I was hoping for the site where you got the original VBS from in the hope that there would be some more background info etc. Unless you got it from a scripting tool etc?

Your original postings were dealing with safearrays! Is using 'SpawnInstance' a way of avoiding the safearrays?
I may look like a mule, but I'm not a complete ass.
jpd
Enthusiast
Enthusiast
Posts: 167
Joined: Fri May 21, 2004 3:31 pm

Post by jpd »

Hi Srod,

the first time that I'm have see the using of "SpawnInstance"
was a sample on c++ I have translated this using wmi api
I will look later to posting a code sample that can help to understand

at this moment I can see that after "SpawnInstance"

is used 'put' with 4 params 1 is the item name "IPAddress"
and another is the "safe-array"

like that:


Code: Select all


hr = pNamespace\GetObject(className, 0, #Null, @pClass, #Null); "Win32_NetworkAdapterConfiguration"

;// Get the method we want To use in this class 
;hr = pClass->GetMethod(methodName, 0, &pMethod, NULL); 
hr = pClass\GetMethod(methodName, 0, @pMethod, #Null); "EnableStatic"

;// Spawn an instance of the method so we can set it up (parameters) 
;hr = pMethod->SpawnInstance(0, &pInInst); 
hr = pMethod\SpawnInstance(0, @pInInst); 
hr = pInInst\Put(ArgNameSM, 0, var2, 0);  

on this case is var2 the safearray

Thanks
jpd
PB 5.10 Windows 7 x64 SP1
KIKI
Enthusiast
Enthusiast
Posts: 145
Joined: Thu Dec 28, 2006 11:49 am
Location: FRANCE

Post by KIKI »

srod wrote:What error are you getting?

**EDIT : wait I see what the problem is - or at least one problem. Checking... yes it is the safe array of iDispatch objects... COMate is not set up to return such objects from the GetObjectProperty() method (this returns a COMate object which itself contains an iDispatch object!)

Thinking...

***EDIT : okay the following untested workaround allows the MakePropertyValue() function to return an iDispatch pointer directly. It works by retrieving the Bridge_GetStruct('com.sun.star.beans.PropertyValue') property object as a variant from which the iDispatch object can easily be retrieved without any hacks! :) We then temporarily wrap this object within a COMate automation object so that you can set the two properties. Note that this COMate object is released so that the reference counting is kept in order. Note also that the iDisp object which we return has had it's reference count increased and so you will eventually need to destroy the safe array in order to set this right.

You will need to make similar adjustments to the MakePropertyValue1() function.

Code: Select all

Procedure MakePropertyValue(cName.s, uValue.b) 
Define.COMateObject oServiceManager,oStruct 
Define *ret.VARIANT, iDisp.IDISPATCH
oServiceManager = COMate_CreateObject("com.sun.star.ServiceManager") 
If oServiceManager 
  *ret = oServiceManager\GetVariantProperty("Bridge_GetStruct('com.sun.star.beans.PropertyValue')")
  If *ret
    If *ret\vt <> #VT_DISPATCH
      VariantChangeType_(*ret, *ret, 0, #VT_DISPATCH)
    EndIf
    If *ret\vt = #VT_DISPATCH
      iDisp = *ret\pdispVal
      oStruct = COMate_WrapCOMObject(iDisp)
      If oStruct
        oStruct\SetProperty("Name = " + cName) 
        oStruct\SetProperty("Value = " + Str(uValue)) 
        oStruct\Release() ;Required to keep the reference count in check.
      EndIf
    Else
      VariantClear_(*ret)
    EndIf
    FreeMemory(*ret) ;We do not use VariantClear_() as we do not wish to release the iDisp object which we are returning from this function.
  EndIf
EndIf 
ProcedureReturn iDisp
EndProcedure 
I can apply what you write but i don't understand and i dont know how to do with thzt's line

Code: Select all

*openpar = saCreateSafeArray(#VT_DISPATCH, 0, 3) 
SA_DISPATCH(*openpar, 0) = MakePropertyValue("ReadOnly", #True) 
SA_DISPATCH(*openpar, 1) = MakePropertyValue1("Password", "ISABELLE") 
SA_DISPATCH(*openpar, 2) = MakePropertyValue("Hidden", #True) 

V_ARRAY_DISP(openarray) = *openpar 

    ;'Instancie OOo : ces deux lignes sont obligatoires avec VB dans tout code !
FILE.S= ConvertToUrl("C:\Documents and Settings\Administrateur\Bureau\essaicomate\travail.ots")
oSM = COMate_CreateObject("com.sun.star.ServiceManager") 
If oSM 
  ;Creating instance of Desktop 
    oDesk = oSM\GetObjectProperty("CreateInstance('com.sun.star.frame.Desktop')") 
    If oDesk 
      ;Opening a new writer Document    
    ;   oDoc = oDesk\GetObjectProperty("loadComponentFromURL('private:factory/scalc', '_blank', 0, " + Str(openarray) + " As variant)")      
     
     oDoc = oDesk\GetObjectProperty("loadComponentFromURL("+"'"+ file+ "'" +", '_blank', 0, " + Str(openarray) + " As variant)" )   
endif 
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Sorry, I do not know what you are asking?
I may look like a mule, but I'm not a complete ass.
KIKI
Enthusiast
Enthusiast
Posts: 145
Joined: Thu Dec 28, 2006 11:49 am
Location: FRANCE

Post by KIKI »

srod wrote:Sorry, I do not know what you are asking?
I don't speak english very well.
My problem is because i don't know how to pass the result of the property when launching open office that's while i present the first line because i hope that someone can correct them to be good
jpd
Enthusiast
Enthusiast
Posts: 167
Joined: Fri May 21, 2004 3:31 pm

Post by jpd »

Hi Srod,

here a wmi example that works with variant and safearray

I hope that can help to find a way for using with COMate.

if use this code the networkadapter with index 4 change from
dhcp to static adress and as result you have 2 adress the recieved over
dhcp and the new.

the code is not really complete but demonstrate the way for pasing the right parameter.

thanks
jpd

Code: Select all


 IncludePath "..\..\"
; EnableExplicit



IncludeFile "VariantHelper_Include.pb"

#COINIT_MULTITHREAD = 0 
#RPC_C_AUTHN_LEVEL_DEFAULT = 0
#RPC_C_AUTHN_LEVEL_CONNECT = 2 
#RPC_C_IMP_LEVEL_IDENTIFY = 2 
#EOAC_NONE = 0 
#RPC_C_AUTHN_WINNT = 10 
#RPC_C_AUTHZ_NONE = 0 
#RPC_C_AUTHN_LEVEL_CALL = 3 
#RPC_C_IMP_LEVEL_IMPERSONATE = 3 
#CLSCTX_INPROC_SERVER = 1 
#wbemFlagReturnImmediately = 16 
#wbemFlagForwardOnly = 32 
#IFlags = #wbemFlagReturnImmediately + #wbemFlagForwardOnly 
#WBEM_INFINITE = $FFFFFFFF 
#WMISeparator = "," 

Global pLocator.IWbemLocator=#Null
;IWbemLocator *pLocator = NULL; 
Global pNamespace.IWbemServices=0
;IWbemServices *pNamespace = 0; 
Global pClass.IWbemClassObject=#Null
;IWbemClassObject *pClass = NULL; 
Global pMethod.IWbemClassObject=#Null
;IWbemClassObject *pMethod = NULL; 
;IWbemClassObject *pInInst = NULL; 
Global pInInst.IWbemClassObject=#Null
;IWbemClassObject *pOutInst = NULL; 
Global pOutInst.IWbemClassObject=#Null

Procedure StringToBStr(string$) 
  Protected Unicode$ = Space(StringByteLength(string$, #PB_Unicode) + 1) 
  Protected bstr_string.l 
  PokeS(@Unicode$, String$, -1, #PB_Unicode) 
  bstr_string = SysAllocString_(@Unicode$) 
  ProcedureReturn bstr_string 
EndProcedure 

Procedure.s UniToPB(*Unicode) 
  ProcedureReturn PeekS(*Unicode, #PB_Any, #PB_Unicode) 
EndProcedure 
; ProcedureDLL.s wmi_release(dumdum$) 
;   ;- WMI Release 
;   svc\release() 
;   loc\release() 
;   pEnumerator\release() 
;   If error=0 
;     pclsObj\release() 
;   EndIf 
;   CoUninitialize_() 
;   If FindString(dumdum$, "ERROR", 1) 
;     MessageRequester("", dumdum$) 
;     End 
;   EndIf 
; EndProcedure 

;// Strings needed later 
className=StringToBStr("Win32_NetworkAdapterConfiguration")
methodName=StringToBStr("EnableStatic")
namespacePath=StringToBStr("root\cimv2")
;BSTR className = SysAllocString(L"Win32_NetworkAdapterConfiguration"); 
;BSTR methodName = SysAllocString(L"EnableStatic"); 
;BSTR namespacePath = SysAllocString(L"root\\cimv2"); 


;// Create WbemLocator Instance 
;HRESULT hr; 
;hr = CoCreateInstance(CLSID_WbemLocator, 0, CLSCTX_INPROC_SERVER, 
;IID_IWbemLocator, (LPVOID *) &pLocator); 

CoInitializeEx_(0,#COINIT_MULTITHREAD) 
hres=CoInitializeSecurity_(0, -1,0,0,#RPC_C_AUTHN_LEVEL_DEFAULT,#RPC_C_IMP_LEVEL_IMPERSONATE,0,#EOAC_NONE,0) 
If hres <> 0: txt$="ERROR: unable To call CoInitializeSecurity":Debug txt$:Else: Debug "CoInitializeSecurity..done!": EndIf 
hr=CoCreateInstance_(?CLSID_WbemLocator,0,#CLSCTX_INPROC_SERVER,?IID_IWbemLocator,@pLocator) 
If hr <> 0: txt$="ERROR: unable To call CoCreateInstance":Debug txt$:Else: Debug "CoCreateInstance..done!": EndIf  


;// Using the WbemLocator, connect To the namespace 
; hr = pLocator->ConnectServer(namespacePath, NULL, NULL, NULL, 0, 
; NULL, NULL, &pNamespace); 
hr=pLocator\ConnectServer(namespacePath,0,0,0,0,0,0,@pNamespace) 
If hr <> 0: txt$="ERROR: unable To call IWbemLocator::ConnectServer": Debug txt$:Else: Debug "IWbemLocator::ConnectServer..done!": EndIf  


; hr = CoSetProxyBlanket( 
; pNamespace, // Indicates the proxy To set 
; RPC_C_AUTHN_WINNT, // RPC_C_AUTHN_xxx 
; RPC_C_AUTHZ_NONE, // RPC_C_AUTHZ_xxx 
; NULL, // Server principal name 
; RPC_C_AUTHN_LEVEL_CALL, // RPC_C_AUTHN_LEVEL_xxx 
; RPC_C_IMP_LEVEL_IMPERSONATE, // RPC_C_IMP_LEVEL_xxx 
; NULL, // client identity 
; EOAC_NONE // proxy capabilities 
; ); 
hr=CoSetProxyBlanket_(pNamespace,#RPC_C_AUTHN_WINNT,#RPC_C_AUTHZ_NONE ,#Null,#RPC_C_AUTHN_LEVEL_CALL,#RPC_C_IMP_LEVEL_IMPERSONATE,#Null,#EOAC_NONE)
If hr <> 0: txt$="ERROR: unable To call IWbemLocator::CoSetProxyBlanket":  Debug txt$:Else: Debug "IWbemLocator::CoSetProxyBlanket..done!": EndIf  
; If (FAILED(hr)) 
; { 
; pNamespace->Release(); 
; pLocator->Release(); 
; CoUninitialize(); 
; Return 0; // Program has failed. 
; }
 
;// Get the class object 
;hr = pNamespace->GetObject(className, 0, NULL, &pClass, NULL); 

hr = pNamespace\GetObject(className, 0, #Null, @pClass, #Null); 
If hr <> 0: txt$="ERROR: unable To get the class object: "+UniToPB(className):  Debug txt$:Else: Debug "class object: "+UniToPB(className)+"..done!": EndIf 

;// Get the method we want To use in this class 
;hr = pClass->GetMethod(methodName, 0, &pMethod, NULL); 
hr = pClass\GetMethod(methodName, 0, @pMethod, #Null); 
If hr <> 0: txt$="ERROR: unable To get the Methode to use: "+UniToPB(methodName):  Debug txt$:Else: Debug "Methode to use: "+UniToPB(methodName)+"..done!": EndIf 


;// Spawn an instance of the method so we can set it up (parameters) 
;hr = pMethod->SpawnInstance(0, &pInInst); 
hr = pMethod\SpawnInstance(0, @pInInst); 
If hr <> 0: txt$="ERROR: unable To Spawn an instance of: "+UniToPB(methodName):  Debug txt$:Else: Debug "Spawn an instance of: "+UniToPB(methodName)+"..done!": EndIf 

;// EnableStatic() expects To receive the args in an array 
; BSTR ArgNameIP = SysAllocString(L"IPAddress"); 
; BSTR ArgNameSM = SysAllocString(L"SubnetMask"); 
; BSTR IP = SysAllocString(L"172.21.0.1"); 
; BSTR SM = SysAllocString(L"255.255.0.0"); 
ArgNameIP=StringToBStr("IPAddress")
ArgNameSM=StringToBStr("SubnetMask")
IP=StringToBStr("192.168.66.8")
SM=StringToBStr("255.255.255.0")

; sab[1].SAFEARRAYBOUND
; 
; SAFEARRAYBOUND sab[1]; 
; sab[0].cElements = 1; 
; sab[0].lLbound = 0; 
; 
; 
; LONG i = 0; // index needed for SafeArrayPutElement() 
; 
; 
; // var1 is the array that holds one element which is IP 
; VARIANT var1; 
; var1.vt = VT_ARRAY | VT_BSTR; 
; var1.parray = SafeArrayCreate(VT_BSTR, 1, sab); // create the array 
; SafeArrayPutElement(var1.parray, &i, IP); // put IP in the array 
; at pos 0 


Define.safearray *psaIP, *psaSN,*psa_dest
Define.variant varIP, varSN,var_dest
Define.l i
; Create SafeArray
;Debug "Create SafeArray with first element is number 0 and 1 elements as string IP"
*psaIP = saCreateSafeArray(#TString, 0, 1)
*psaSN = saCreateSafeArray(#TString, 0, 1)

Debug "First Element: " + Str(saLBound(*psaIP))
Debug "Last Element: " + Str(saUBound(*psaIP))
Debug "Count Element: " + Str(saCount(*psaIP))

; Fill SafeArray IP
For i = saLBound(*psaIP) To saUBound(*psaIP)
    SA_BSTR(*psaIP, i) = T_BSTR("192.168.200.1")
Next

; Fill SafeArray SubNet
For i = saLBound(*psaSN) To saUBound(*psaSN)
    SA_BSTR(*psaSN, i) = T_BSTR("255.255.255.0")
Next

; ; Output SafeArray
; If *psaIP
;   For i = saLBound(*psaIP) To saUBound(*psaIP)
;     Debug "Index: " + Str(i) + " Value: " + SA_STR(*psaIP, i)
;   Next
; EndIf


; Set Variant SafeArray as string IP
V_ARRAY_STR(varIP) = *psaIP
V_ARRAY_STR(varSN) = *psaSN


;// put the ArgName And the Argument itself into the Method instance we 
;have 
;hr = pInInst->Put(ArgNameIP, 0, &var1, 0); 
hr = pInInst\Put(ArgNameIP, 0, varIP, 0); 
If hr <> 0: txt$="ERROR: unable To put argument: "+UniToPB(ArgNameIP):  Debug txt$:Else: Debug "put argument: "+UniToPB(ArgNameIP)+"..done!": EndIf 

VariantClear_(varIP); 
;VariantClear(&var1);
;hr = pInInst->Put(ArgNameSM, 0, &var2, 0); 
hr = pInInst\Put(ArgNameSM, 0,varSN, 0); 
If hr <> 0: txt$="ERROR: unable To put argument: "+UniToPB(ArgNameSM):  Debug txt$:Else: Debug "put argument: "+UniToPB(ArgNameSM)+"..done!": EndIf 

;VariantClear(&var2); 
VariantClear_(varSN); 

; 
; ; // Enumerate the instances of the NetworkAdapter To get at the __PATH 
; ; property 
; ; // To the one And only network card we really want To modify 
; ; IEnumWbemClassObject* pEnum; 
; pEnum.IWbemClassObject
; ; hr = pNamespace->CreateInstanceEnum(className, 
; ; WBEM_FLAG_RETURN_IMMEDIATELY | WBEM_FLAG_FORWARD_ONLY, 
; ; NULL, &pEnum); 
; #WBEM_FLAG_RETURN_IMMEDIATELY = 16;0x00000010 
; #WBEM_FLAG_FORWARD_ONLY = 32;0x00000020
; hr = pNamespace\CreateInstanceEnum(className,#WBEM_FLAG_RETURN_IMMEDIATELY | #WBEM_FLAG_FORWARD_ONLY,#Null, @pEnum); 
; If hr <> 0: txt$="ERROR: unable To enum class:"+UniToPB(className):Debug txt$:Else: Debug "enum class: "+UniToPB(className)+"..done!": EndIf  
; ; 
; // Get the instance 
; ULONG numRet; 
; BSTR PropName; 
; VARIANT desc; 
; VARIANT dhcp; 
; VARIANT ipEnabled; 
; VARIANT pathVar; 
; IWbemClassObject *pInstance; 
; While ( hr != WBEM_S_FALSE) 
; { 
; hr = pEnum->Next(WBEM_INFINITE, (ULONG)1, &pInstance, &numRet); 
; 
; If(0 == numRet) 
; Break; 
; // we know that the one With DHCP is the one we want 
; PropName = SysAllocString(L"DHCPEnabled"); 
; pInstance->Get(PropName, 0, &dhcp, 0, 0); 
; If (dhcp.bVal) 
; { 
; SysFreeString(PropName); 
; PropName = SysAllocString(L"IPEnabled"); 
; pInstance->Get(PropName, 0, &ipEnabled, 0, 0); 
; SysFreeString(PropName); 
; If(ipEnabled.bVal) 
; { 
; // Print out the description just For us To see 
; SysFreeString(PropName); 
; PropName = SysAllocString(L"Description"); 
; pInstance->Get(PropName, 0, &desc, 0, 0); 
; SysFreeString(PropName); 
; Break; 
; } 
; } 
; SysFreeString(PropName); 
; } 
; 
; 
; // now we have the instance of the actual network card we want To modify 
; // let's query it's PATH property so that we can call the method on it. 
; PropName = SysAllocString(L"__PATH"); 
; pInstance->Get(PropName, 0, &pathVar, 0, 0); 
; BSTR InstancePath = pathVar.bstrVal; 
; BSTR  InstancePath  =  SysAllocString(L"Win32_NetworkAdapterConfiguration=2");  
InstancePath=StringToBStr("Win32_NetworkAdapterConfiguration.Index=4")
; 
; // finally we get To call the actuall method we want (EnableStatic()) 
; hr = pNamespace->ExecMethod(InstancePath, methodName, 0, NULL, 
; pInInst, &pOutInst, NULL); 

hr = pNamespace\ExecMethod(InstancePath, methodName, 0, #Null,  pInInst, @pOutInst, #Null); 
Debug hr
; long ret = 0; 
; If(hr != WBEM_S_NO_ERROR) 
; { 
; BSTR Text; 
hr = pOutInst\GetObjectText(0, Text); 
Debug hr
Debug Text
; // CString strText = Text; 
; // MessageBox(strText); 
; } 
; Else 
; { 
; // Get the EnableStatic method Return value 
; 
; VARIANT ret_value; 
; BSTR strReturnValue = SysAllocString(L"ReturnValue"); 
; hr = pOutInst->Get(strReturnValue, 0, &ret_value, 0, 0); 
; long ret = V_I4(&ret_value); 
; } 
; 
; 
; 
; // We're done! 
; // Free up resources 
; SysFreeString(className); 
; SysFreeString(methodName); 
; SysFreeString(namespacePath); 
; SysFreeString(ArgNameIP); 
; SysFreeString(ArgNameSM); 
; SysFreeString(IP); 
; SysFreeString(SM); 
; SysFreeString(PropName); 
; SysFreeString(InstancePath); 
; pLocator->Release(); 
; pClass->Release(); 
; pMethod->Release(); 
; pNamespace->Release(); 
; pInInst->Release(); 
; pOutInst->Release(); 
; pEnum->Release(); 
; pInstance->Release(); 
; CoUninitialize(); 
; Return ret; 
; } 
;  
; Back To top  
 
 
 DataSection 
  CLSID_IEnumWbemClassObject: 
  ;1B1CAD8C-2DAB-11D2-B604-00104B703EFD 
  Data.l $1B1CAD8C 
  Data.w $2DAB, $11D2 
  Data.b $B6, $04, $00, $10, $4B, $70, $3E, $FD 
  IID_IEnumWbemClassObject: 
  ;7C857801-7381-11CF-884D-00AA004B2E24 
  Data.l $7C857801 
  Data.w $7381, $11CF 
  Data.b $88, $4D, $00, $AA, $00, $4B, $2E, $24 
  CLSID_WbemLocator: 
  ;4590f811-1d3a-11d0-891f-00aa004b2e24 
  Data.l $4590F811 
  Data.w $1D3A, $11D0 
  Data.b $89, $1F, $00, $AA, $00, $4B, $2E, $24 
  IID_IWbemLocator: 
  ;dc12a687-737f-11cf-884d-00aa004b2e24 
  Data.l $DC12A687 
  Data.w $737F, $11CF 
  Data.b $88, $4D, $00, $AA, $00, $4B, $2E, $24 
  IID_IUnknown: 
  ;00000000-0000-0000-C000-000000000046 
  Data.l $00000000 
  Data.w $0000, $0000 
  Data.b $C0, $00, $00, $00, $00, $00, $00, $46 

EndDataSection 
PB 5.10 Windows 7 x64 SP1
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Update - version 1.1.7. 9th Oct. 2008.
Version 1.1.7 adds a new method to the COMateObject class, namely : SetDesignTimeMode().

Basically, some ActiveX controls expose some properties which can only be set in a design-time environment (such as the VB IDE etc.) and are otherwise 'read-only' at execution time. A good example is the MS RichTextBox control which exposes 'Multiline' and 'Scrollbars' properties which can only be set at design time. At run-time we are forced to use either default values or those set at design time - which isn't a lot of use if not using VB etc!!!

I have thus added a new method : SetDesignTimeMode() to the COMateObject class which can be used in an attempt to fool the underlying ActiveX control into thinking it is being used in a design time environment - thus allowing us access to the read-only properties etc. I have tested with the aforementioned RichTextBox control and it worked fine.

The help manual has been updated.

See the nxSoftware site for the download.
I may look like a mule, but I'm not a complete ass.
User avatar
Kiffi
Addict
Addict
Posts: 1485
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Post by Kiffi »

srod wrote:Update - version 1.1.7. 9th Oct. 2008.
Version 1.1.7 adds a new method to the COMateObject class, namely : SetDesignTimeMode().
excellent! Image Thanks a lot!

Greetings ... Kiffi
Hygge
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Kiffi wrote:
srod wrote:Update - version 1.1.7. 9th Oct. 2008.
Version 1.1.7 adds a new method to the COMateObject class, namely : SetDesignTimeMode().
excellent! Image Thanks a lot!

Greetings ... Kiffi
You're welcome! 8)

Now, any more problems Mr. Kiffi and you can fix 'em yourself - I've work to be working on! :wink:

Actually that was a nice little challenge sorting that one out!
I may look like a mule, but I'm not a complete ass.
KIKI
Enthusiast
Enthusiast
Posts: 145
Joined: Thu Dec 28, 2006 11:49 am
Location: FRANCE

Post by KIKI »

KIKI wrote:
srod wrote:Sorry, I do not know what you are asking?
I don't speak english very well.
My problem is because i don't know how to pass the result of the property when launching open office that's while i present the first line because i hope that someone can correct them to be good
Srod,
You don't answer me how to do and i am bloqued by that. Thanks if you have an answer
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Kiki, I still don't know really what you are asking and I am very short of time right now. At the end of the day, your problem would seem to be a general coding issue - an open-office issue- and not really a COMate one, at least certainly not one which needs fixing. I am only really concerned with fixing bugs or addressing general omissions etc. not fixing other people's code! If your problem was due to there being some deficiency with COMate then I would work to sort it out, but when the problem appears to be something else then I must fit it in with all of my other commitments. I'll certainly try to help whenever I can, but at the end of the day I only have so much time.

Beside's which there are people here with far more COM knowledge than I (and I have no knowledge whatsoever of OpenOffice) and so perhaps you should be looking to someone with more experience than I.
I may look like a mule, but I'm not a complete ass.
Xombie
Addict
Addict
Posts: 898
Joined: Thu Jul 01, 2004 2:51 am
Location: Tacoma, WA
Contact:

Post by Xombie »

Howdy,

I need to be able to do something like this:

Code: Select all

Search\SetProperty("Command = {[Test Reports]:[Heat Number] = "+Chr(34)+"2MW9"+Chr(34)+"}")
But it's coming back with the "One or more arguments are invalid..." error. I suspect it's the extra "=" but it's always hard to say when you're not the one writing the code used, yeah? :D

I've tested with PureDispHelper using...

Code: Select all

dhPutValue(Search, "Command = %s", @"{[Test Reports]:[Heat Number] = "+Chr(34)+"2MW9"+Chr(34)+"}")
and it works.

Hope that's enough info for you. I expect this to be fixed within the next 32 seconds.
User avatar
Kiffi
Addict
Addict
Posts: 1485
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Post by Kiffi »

Xombie wrote:

Code: Select all

Search\SetProperty("Command = '{[Test Reports]:[Heat Number] = "+Chr(34)+"2MW9"+Chr(34)+"}'")
untested... ;-)
Xombie wrote:I expect this to be fixed within the next 32 seconds.
damned... 8 Minutes to late.

Greetings ... Kiffi
Last edited by Kiffi on Fri Oct 10, 2008 8:00 pm, edited 1 time in total.
Hygge
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Code: Select all

Search\SetProperty("Command = '{[Test Reports]:[Heat Number] = "+Chr(34)+"2MW9"+Chr(34)+"}'") 
**EDIT : too slow! :)
I may look like a mule, but I'm not a complete ass.
Little John
Addict
Addict
Posts: 4777
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Post by Little John »

Hello srod,

I've just finished reading the "COMate.chm" file. It's very well written, good understandable and instructive. And it actually answered all my million dollar questions. :D
So thanks again for so much good work!

Regards, Little John
Post Reply