Problem with OleObject in XE4 (shifting from Borland C++ Builder 6.0)

Dear all,

Please help, those who faced this problem and solved it...

I'm all the time trying to shift from Borland C++ Builder 6.0 to Embarcader C++ Builder XE4 and all the time it becomes almost impossible.
This time I tried to create an Excel automation object. In Borland C++ Builder it was ok, in XE4 it seems to be problematic, at least for this
moment. Here is the code:
_______________________________________________________________________________

#include <ComObj.hpp>

....

OleVariant u1_xl_app, u1_xl_wkbs, u1_xl_wkb, u1_xl_wkss, u1_xl_wks; // xl_dr - data range
OleVariant u1_xl_shs, u1_xl_sh, u1_xl_dr, u1_xl_acs, u1_xl_range, u1_xl_range_str, tmp_range;
OleVariant u1_xl_font, u1_xl_row, u1_xl_acw, u1_xl_col;

....

u1_xl_app=CreateOleObject("Excel.Application");
u1_xl_app.OlePropertySet("Visible",true);
u1_xl_app.OlePropertySet("DisplayAlerts",false);
u1_xl_wkbs=u1_xl_app.OlePropertyGet("Workbooks");
u1_xl_wkbs.OleFunction("Add");
u1_xl_wkb=u1_xl_wkbs.OlePropertyGet("Item",1);
u1_xl_wkb=u1_xl_app.OlePropertyGet("ActiveWorkbook");
u1_xl_wkss=u1_xl_app.OlePropertyGet("Worksheets");

....
__________________________________________________________________________________

And here is what compiler shows:

....

[bcc32 Error] UBC.cpp(102): E2247 'void Variant::OlePropertySet<bool>(const UnicodeString &,bool)' is not accessible
  Full parser context
    UBC.cpp(87): parsing: void _fastcall TForm1::Budget1Click(TObject *)
[bcc32 Error] UBC.cpp(103): E2247 'void Variant::OlePropertySet<bool>(const UnicodeString &,bool)' is not accessible
  Full parser context
    UBC.cpp(87): parsing: void _fastcall TForm1::Budget1Click(TObject *)
[bcc32 Error] UBC.cpp(106): E2247 'Variant Variant::OlePropertyGet<int>(const UnicodeString &,int)' is not accessible
  Full parser context
    UBC.cpp(87): parsing: void _fastcall TForm1::Budget1Click(TObject *)
[bcc32 Error] UBC.cpp(131): E2247 'Variant Variant::OlePropertyGet<int>(const UnicodeString &,int)' is not accessible
  Full parser context
    UBC.cpp(87): parsing: void _fastcall TForm1::Budget1Click(TObject *)
[bcc32 Error] UBC.cpp(141): E2247 'Variant Variant::OlePropertyGet<int>(const UnicodeString &,int)' is not accessible
  Full parser context
    UBC.cpp(87): parsing: void _fastcall TForm1::Budget1Click(TObject *)
[bcc32 Error] UBC.cpp(144): E2247 'void Variant::OlePropertySet<WideString>(const UnicodeString &,WideString)' is not accessible
  Full parser context
    UBC.cpp(87): parsing: void _fastcall TForm1::Budget1Click(TObject *)
[bcc32 Error] UBC.cpp(147): E2247 'Variant Variant::OlePropertyGet<int>(const UnicodeString &,int)' is not accessible
  Full parser context
    UBC.cpp(87): parsing: void _fastcall TForm1::Budget1Click(TObject *)
[bcc32 Warning] UBC.cpp(150): W8004 'flag_visible' is assigned a value that is never used
  Full parser context
    UBC.cpp(87): parsing: void _fastcall TForm1::Budget1Click(TObject *)
Failed
Elapsed time: 00:00:00.6
__________________________________________________________________________________

Errors took place at lines:

u1_xl_app.OlePropertySet("Visible",true);

u1_xl_app.OlePropertySet("DisplayAlerts",false);

u1_xl_wkb=u1_xl_wkbs.OlePropertyGet("Item",1);

which correspond to first 3 error lines.

What could be a problem? As I understood, properties are no longer accessible?

Thank you in advance.

Regards,
Bakhtiyar
0
Bakhtiyar
3/31/2015 11:26:52 AM
embarcadero.cppbuilder.ide 2180 articles. 1 followers. Follow

2 Replies
1781 Views

Similar Articles

[PageSpeed] 30
Get it on Google Play
Get it on Apple App Store

Bakhtiyar wrote:

> This time I tried to create an Excel automation object. In Borland C++ 
Builder
> it was ok, in XE4 it seems to be problematic, at least for this moment

The OleProcedure(), OleFunction(), and OlePropertyGet/Set() methods are public 
members of Variant.  OleVariant derives from Variant using *protected* inheritance, 
so the methods are protected in OleVariant.

In BCB 6, OleVariant promotes the methods to public unconditionally, which 
is why you are able to access them.

That was changed in BCB 2006.  OleVariant promotes the methods to public 
only if VARIANT_AUTOMATION_SUPPORT is defined.  It is defined by default 
only if _Windows is defined and VARIANT_AUTOMATION_SUPPORT_NONE is not defined. 
 So clearly VARIANT_AUTOMATION_SUPPORT is not being defined in your project, 
which is why you are not able to accessible the methods anymore.  Why that 
is happening, I cannot say, as I do not know your project setup.  Either 
you are not compiling for Windows, or something in your project is defining 
VARIANT_AUTOMATION_SUPPORT_NONE.  You may have to manually define VARIANT_AUTOMATION_SUPPORT 
to re-enable the methods.  Or find out why VARIANT_AUTOMATION_SUPPORT is 
not being defined by default.

Either way, you can alternatively change your code to use Variant instead 
of OleVariant, then everything should work in both BCB6 and XE4.

-- 
Remy Lebeau (TeamB)
0
Remy
3/31/2015 5:30:59 PM
Thanks a lot, Remy!

I see your answers almost everywhere whenever I type a question in Google.

YOU ARE THE BEST PRACTICAL PROFESSIONAL IN C++ I'VE EVER KNOWN!!!

Regards,
Bakhtiyar
0
Bakhtiyar
4/1/2015 3:00:51 AM
Reply:

Similar Artilces:

problem of converting from C++ Builder 6 to C++ Builder 2007
Hi, A program which was developed by our partner was built fine with C++ Builder 6. Now I need to make some changes to it. We bought C++ Builder 2007 a few weeks ago. When I open the program with C++ Builder 2007, I was told that the project needs to be converted. I agreed. Then when I compile it, some errors happen: [BCC32 Error] ComCtrls.hpp(435): E2272 Identifier expected [BCC32 Error] ComCtrls.hpp(3880): E2272 Identifier expected [BCC32 Error] ComCtrls.hpp(4658): E2272 Identifier expected ...... Anybody has any idea how to fix it? Thanks, Allen In article <14040@f...

Borland C++ Builder 6, IMAPI2 and DDiscFormat2DataEvents problems
Hi all, I'm trying to code a simple CD burner application using IMAPI2 with Borland C++ Builder 6. I added imapi2.h, imapi2error.h, imapi2.idl, imapi2fs.h, imapi2fserror.h and imapi2fs.idl. The application seems to work fine, but now I would like to add the events sink to receive informations about the progress. So I added a derived class from TEventDispatcher as shown on one example in EDN and there born the problem. The row of code is: class TEventSinkHandler : public TEventDispatcher<TEventSinkHandler,&IID_DDiscFormat2DataEvents> When I compile the program all...

Borland C++ Builder 6.0 SSL/HTTPS question
Hi Not sure which forum to really post this in. I am using BCPPB6 to maintain some legacy projects. One of these needs to GET data from a https URL. I found that the TNMHTTP comnponent that I have used for standard http GET operations in the past does not support https. However the Indy TIdHTTP component apparantly does. With some trial and error I have found that it needs an Intercept component (TIdConnectionInterceptOpenSSL) and needs InterceptEnabled set to true. I then found that I need to have an OpenSSL libraryavailable. Thus I downloaded the latest version from http://indy.ful...

Strange behaviour of IDE while reading XML UTF-8 file under C++ Builder 6.0
Dear C++ Builder users, Did anyone face this kind of problem? I've got an XML file with the following header: <?xml version="1.0" encoding="UTF-8"?> but the text is fully ASCII letters (I asked to change encoding, it is impossible). Also I read that if the text is ASCII it could be read using old methods: fopen(), fgets() and we can save result to strings or vector of strings. And it is actually happening seemingly with no errors, but at the midtime strange thing is happening, such as "Floating point overflow" at the place where I'm changin...

CHARSET problem with ASA 6.0.3 / no problem with ASA 6.0
Il s'agit d'un message multivolet au format MIME. --------------BEC705D07BE8C418A71C3DCB Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Hi, We are building a Java application. This application connect to a ASA db through JDBC 2.0 (JDK 1.2.2), the application runs on the db server. On the developer station, we have an ASA 6.0 server. On the demo station we have an ASA 6.0.3 server. In Belgium we speek French so we use caracters like �,�,�... The dbs on the two machines are the same (we copy the db from the developer machine to the demo machin...

Problem with C++ builder #6
Hi there, I am trying to generate a C++ object out of my NVO. Even though I am able to create a ..cpp and .h I am unable to put them to work. I tried to write a small program in VC+ 5.0 by using these files. I can not even build this project. It is giving a compiler error saying that "fatal error C1010: unexpected end of file while looking for precompiled header directive" in xxx.cpp file. Did any body tried this. Can any body help with this. Thanks in advance, Srikanth.Y srikanth wrote: > Hi there, > I am trying to generate a C++ object out of my NVO....

10.0.6 & 10.0.7 updates will not properly install in C++ Builder 2009
Okay, it looks like there is a problem with C++ Builder 2009 IntraWeb updates. I ran my Delphi 2009 (we bought both) and the updates definately installed there (log on standalone server shows IntraWeb version 10.0.7.. source code shows 10.0.7 being used). Everyone who has C++ Builder 2009 and has installed the new updates I need you to look at your standalone server log or your Source code on your intraweb browser, I'm betting you will see 10.0.0 instead of 10.0.7. Is there anyone at Embarcadero who can test to see if this is true? Have the updates been fully tested to make sure t...

6.0.1 problem reappears in 6.0.2
Consolidated running 6.0.2.2188 Remote running 6.0.1.1329. This is a test enviroment with only one remote user. A problem I had in the original maintenance release of 6.0.1 that appeared to be fixed in the 1329 ebf has reappeared in 6.0.2.2188. The first message sent from the upgraded 6.0.2.2188 dbremote to the 6.0.1.1329 dbremote caused the following message to be logged at the 1329 remote I. 06/08 15:00:13. Received message from "base_pub" (0-0000749280-0) E. 06/08 15:00:14. This message does not belong to me. Log offset sent to user 'base...

Convert to C++ Builder XE from C++ Builder 6 and 2007
Any information regarding the roadblocks of converting the code build in C++ Builder 6,2007 to C++ Builder XE? On 6/20/2012 8:20 AM, Girish Duddu wrote: > Any information regarding the roadblocks of converting the code build in C++ Builder 6,2007 to C++ Builder XE? The big change is the default string in XE is UnicodeString rather than AnsiString. All VCL String properites (Text, etc.) are Unicode in XE. There are good white papers regarding making this transition on the Embarcadero EDN site. I found that most of the changes I had to make fell into two categories: 1) Places...

Borland C Builder 6 updates
Does anyone know where I can get the borland updates anymore? I need the updates for builder 6 (update 1 and 2 if possible) as they have a fix for a variant issue that is not in update 4; Cheers Hi, are you sure you need them? The documentation to upd4 tells me it includes 1,2 and 3, so I would be worried if I dropped some files I would need. What I do have are some other fixes, maybe you can find them by file name upd1: BCB6P01.ZIP (39kB) ... C++Builder 6 Special Help Update upd2: cb6errs_pro.zip (560kB) ... another Help Update kind regards Ingo In article <1462...

Problem with Borland c++ v2.0
Hi, I'm new here so forgive me if I posted this thread in the wrong topic. But, I found it the most appropriate. So, this is my problem. It seems rather easy, after I saw some threads in here :D. I'm going to high school (I'm 15) and we're learning some basics of c language in Borland c++ v2.0. So, our profesor told us to download Borland v2.0 or v3.0 to practice at home. So I did. I have both versions. And, no mather which one I use, I get the same problem. The whole keyboard is scrambled- I can't type in most of the symbols I need (for example I can't type ...

sgcWebSockets for C++ Builder 6
The library documentation and the install readme says that the project, who was build for Delphi, works as well for C++ Builder. [http://www.esegece.com/manual/sgcWebSockets.pdf] a) All Delphi/C++Builder Versions: Add the directory {$DIR}\source to the library path How can I run delphi code in a C++ Builder Project? Is it possible? > {quote:title=Eliseu Martins Gomes wrote:}{quote} > The library documentation and the install readme says that the project, who was build for Delphi, works as well for C++ Builder. Most Delphi components are usable in C++Builder...

Db 6.0.4 and Client 6.0.3 ! Problems ?
Hi, I know it's not a good thing but if there's any problem to run a ASA 604 database server when all the client machine run ASA 6.0.3. Because I can't synchronise all at the same time. Thanks. Pierre Vallee Should be OK. As long as the server is a higher version that the clients, we do our best to make things backwards compatible. -- Reg Domaratzki, Sybase iAnywhere Solutions Certified SQL Anywhere Associate Please reply only to the newsgroup ASA Patches and EBFs : http://downloads.sybase.com/swx/sdmain.stm -> Choose SQL Anywhere Studio ->...

ASA 6.0.1 to ASA 6.0.3
Hi, I have database created with ASA 6.0.1 with custom collation (polish). I have also 12 remote databases each extracted with ASA 6.0.1. We are using Netware for all remote databases. Last week we upgraded remote servers to ASA 6.0.3.2747 (we did not changed database files). After this operation we lost ability to find any string pattern in database. We cannot find any row when we are using national characters in query. When we run database on older ASA 6.0.1 server everything works fine! Looks like ASA 6.0.3 is not able to use custom collation in database created with 6.0.1. Doe...

Web resources about - Problem with OleObject in XE4 (shifting from Borland C++ Builder 6.0) - embarcadero.cppbuilder.ide

Object Linking and Embedding - Wikipedia, the free encyclopedia
Object Linking and Embedding ( OLE ) is a technology developed by Microsoft that allows embedding and linking to documents and other objects. ...

Apache releases big OpenOffice upgrade get it now!
... , which is also based on OpenOffice. Version 3.4’s major features can be found under the hood vastly improved startup times, improved OLEObject ...

ASF hopes Apache OpenOffice 3.4 release jump starts stalled development on office suite
New release is the first public update since OpenOffice was handed to the Apache Software Foundation By Oracle.

Resources last updated: 12/24/2015 2:01:59 AM