Board index » cppbuilder » Microsoft Script Control IScriptError *Error quit working in BCB4 used to work in BCB3.

Microsoft Script Control IScriptError *Error quit working in BCB4 used to work in BCB3.

After upgrading to BCB4 the following code does not work any longer:

            IScriptError *Error = ScriptControl->Error;
            if (Error) {
                BSTR Str;
                AnsiString Result;
                long Line;

                Error->get_Text(&Str);
                Result = AnsiString (WideString(Str));

                Error->get_Description(&Str);
                Result += "\n";
                Result += AnsiString (WideString(Str));

                Error->get_Line(&Line);
        }

Can someone tell me what I have to do to make this work again?
I have everything else working except this (and it wasn't easy to get here!)

Dino

 

Re:Microsoft Script Control IScriptError *Error quit working in BCB4 used to work in BCB3.


Quote

> Can you be more specific. What does not work anymore? Does it compile?

Sorry,
  It compiles & runs, but I get NULL back as the return value for all 3
items.

I have a work around though, the OnError Event for the Script control OCX
does work, and I can get my error info that way. I still would like to know
why this is no longer working, and how I can fix it.

As a general gripe, when I upgraded from BCB 3 to BCB 4, it was 4 days
before
my program was functional again. I had to wade through header files
to find what defines I had to compile with to make things work.

I also had to include a header file to make things work again:

// Added comobj.hpp so that a EOleException is thrown in vcl/utilcls.h
// when a Error is returned in WinExplorer_IMPL.cpp in BCB4
#include <vcl\comobj.hpp>

Why did this have to be so painful?, and why did I have to pay $250
for the pain? <g>

Next time, for that price, I'll just buy a new 3D accelerator card and a
game.

Dino

Re:Microsoft Script Control IScriptError *Error quit working in BCB4 used to work in BCB3.


Quote
Null Pointer <n...@stackcrash.com> wrote in message

news:7lr3b5$av38@forums.borland.com...
Quote
> After upgrading to BCB4 the following code does not work any longer:
> Can someone tell me what I have to do to make this work again?
> I have everything else working except this (and it wasn't easy to get

here!)

Can you be more specific. What does not work anymore? Does it compile?

Martijn Brinkers

Re:Microsoft Script Control IScriptError *Error quit working in BCB4 used to work in BCB3.


Dino,

You should re-import the script control and use the newly generated
xxx_tlb.h, xxx_tlb.cpp, xxx_ocx.h and xxx_ocx.cpp files.

HTH,
Alex

Quote
Null Pointer wrote:

[snip]

--
HotSend - portable documents technology
http://www.hotsend.com/
eFax - get your faxes via email - Free !
http://www.efax.com

Re:Microsoft Script Control IScriptError *Error quit working in BCB4 used to work in BCB3.


Quote
> You should re-import the script control and use the newly generated
> xxx_tlb.h, xxx_tlb.cpp, xxx_ocx.h and xxx_ocx.cpp files.

Alex,
  I did re-import the script control. I have the BCB 4.0 service pack 1
installed,
and I re-imported right after I installed it.

Is there anything I can look for in those files that may point to the
problem?

Thanks
  Dino

Re:Microsoft Script Control IScriptError *Error quit working in BCB4 used to work in BCB3.


Dino,
look at the newly generated _tlb.h file. I think the declarations may
have changed. Does the code you have compile ?

Alex

Quote
Null Pointer wrote:

[snip]

Re:Microsoft Script Control IScriptError *Error quit working in BCB4 used to work in BCB3.


Alex Bakaev [TeamB] <al...@jetsuite.com> wrote in message
news:3783AC50.4933C1F6@jetsuite.com...

Quote
> Dino,
> look at the newly generated _tlb.h file. I think the declarations may
> have changed. Does the code you have compile ?

Alex,
Yes It compiles & runs, but I get NULL back as the return value for all 3
items. I had to change the declaration from "IScriptError* Error =
ScriptControl->Error_;"
to "IScriptError *Error = ScriptControl->Error;" to get it to compile.

Dino

Re:Microsoft Script Control IScriptError *Error quit working in BCB4 used to work in BCB3.


Dino,
yeah, the patch has changed how the underscores are generated, so you
had to change the code. As for why NULL is returned - no idea. I've not
used the scrip control. Can you query the control for the IScriptError ?
What did you see if you stepped in the code to get the Error property ?

Alex

Quote
Dino Roggero wrote:

> Alex Bakaev [TeamB] <al...@jetsuite.com> wrote in message
> news:3783AC50.4933C1F6@jetsuite.com...
> > Dino,
> > look at the newly generated _tlb.h file. I think the declarations may
> > have changed. Does the code you have compile ?

> Alex,
> Yes It compiles & runs, but I get NULL back as the return value for all 3
> items. I had to change the declaration from "IScriptError* Error =
> ScriptControl->Error_;"
> to "IScriptError *Error = ScriptControl->Error;" to get it to compile.

> Dino

--
HotSend - portable documents technology
http://www.hotsend.com/
eFax - get your faxes via email - Free !
http://www.efax.com

Other Threads