ATL
  Home FAQ Contact Sign in
microsoft.public.vc.atl only
 
Advanced search
POPULAR GROUPS

more...

microsoft.public.vc.atl Profile…
 Up
ATL         


Author: peter.boot
Date: Jun 11, 2008 18:19

A Newbie question
What is the correct way to create a public data member on an ATL class
whose value can be set from outside the class ?

I have created a Browser Helper Object and can call functions from
other classes but if I try to set the value of a public data member I
get an 'Access violation' error.

thanks

Peter
11 Comments
Re: ATL         


Author: Igor Tandetnik
Date: Jun 11, 2008 19:51

"peter.boot" gmail.com> wrote in message
news:78154808-d1e2-49da-9228-1316a65862fc@w1g2000prd.googlegroups.com
> What is the correct way to create a public data member on an ATL class
> whose value can be set from outside the class ?

This depends on what you mean by "outside".
> I have created a Browser Helper Object and can call functions from
> other classes but if I try to set the value of a public data member I
> get an 'Access violation' error.

When you say "I can call functions from other classes", what do you mean
by "I"? The BHO calls methods on other classes? Something calls methods
on the BHO?

When you say "I try to set the value of a public data member", who is
"I" in this sentence, and whose data member this "I" tries to modify?

Best would be to show some code.
--
With best wishes,
Igor Tandetnik
Show full article (1.08Kb)
no comments
Re: ATL         


Author: peter.boot
Date: Jun 11, 2008 20:16

On Jun 12, 12:51 pm, "Igor Tandetnik" mvps.org> wrote:
> "peter.boot" gmail.com> wrote in message
>
> news:78154808-d1e2-49da-9228-1316a65862fc@w1g2000prd.googlegroups.com
>
>> What is the correct way to create a public data member on an ATL class
>> whose value can be set from outside the class ?
>
> This depends on what you mean by "outside".
>
>> I have created a Browser Helper Object and can call functions from
>> other classes but if I try to set the value of a public data member I
>> get an 'Access violation' error.
>
> When you say "I can call functions from other classes", what do you mean
> by "I"? The BHO calls methods on other classes? Something calls methods
> on the BHO?
>
> When you say "I try to set the value of a public data member", who is
> "I" in this sentence, and whose data member this "I" tries to modify? ...
Show full article (1.64Kb)
no comments
Re: ATL         


Author: peter.boot
Date: Jun 11, 2008 20:34

On Jun 12, 1:16 pm, "peter.boot" gmail.com> wrote:
> On Jun 12, 12:51 pm, "Igor Tandetnik" mvps.org> wrote:
>
>
>
>> "peter.boot" gmail.com> wrote in message
>
>>news:78154808-d1e2-49da-9228-1316a65862fc@w1g2000prd.googlegroups.com
>
>>> What is the correct way to create a public data member on an ATL class
>>> whose value can be set from outside the class ?
>
>> This depends on what you mean by "outside".
>
>>> I have created a Browser Helper Object and can call functions from
>>> other classes but if I try to set the value of a public data member I
>>> get an 'Access violation' error.
>
>> When you say "I can call functions from other classes", what do you mean
>> by "I"? The BHO calls methods on other classes? Something calls methods ...
Show full article (2.02Kb)
no comments
Re: ATL         


Author: Igor Tandetnik
Date: Jun 11, 2008 20:32

"peter.boot" gmail.com> wrote in message
news:d5d16291-b3f2-4a33-9a36-0f63bfa9a75d@j33g2000pri.googlegroups.com
> A BHO , called CMyBHO is registering your example PassThru AAP in the
> CMyBHO::SetSite method.
> CMyBHO.h includes an external decration
>
> extern CMyBHO* g_MyBHO;

Note that in IE7 and up, if I remember correctly, a separate BHO
instance is created for each tab. But you only have one global variable
for the whole process.
> The CMyBHO has a public function CMyBHO::addHTMLChunk that can be
> successfully called from the CTestAPP::Read implemented in your
> example like this
>
> g_digiSelfBHO->addHTMLChunk(...)
>
> But if CMyBHO::addHTMLChunk sets the value of a variable declared
> after public : an "Access violation" is thrown
Show full article (1.37Kb)
no comments
Re: ATL         


Author: peter.boot
Date: Jun 11, 2008 21:10

On Jun 12, 1:32 pm, "Igor Tandetnik" mvps.org> wrote:
> "peter.boot" gmail.com> wrote in message
>
> news:d5d16291-b3f2-4a33-9a36-0f63bfa9a75d@j33g2000pri.googlegroups.com
>
>> A BHO , called CMyBHO is registering your example PassThru AAP in the
>> CMyBHO::SetSite method.
>> CMyBHO.h includes an external decration
>
>> extern CMyBHO* g_MyBHO;
>
> Note that in IE7 and up, if I remember correctly, a separate BHO
> instance is created for each tab. But you only have one global variable
> for the whole process.
>
>> The CMyBHO has a public function CMyBHO::addHTMLChunk that can be
>> successfully called from the CTestAPP::Read implemented in your
>> example like this
>
>> g_digiSelfBHO->addHTMLChunk(...) ...
Show full article (1.77Kb)
no comments
Re: ATL         


Author: peter.boot
Date: Jun 11, 2008 21:14

On Jun 12, 2:10 pm, "peter.boot" gmail.com> wrote:
> On Jun 12, 1:32 pm, "Igor Tandetnik" mvps.org> wrote:
>
>
>
>> "peter.boot" gmail.com> wrote in message
>
>>news:d5d16291-b3f2-4a33-9a36-0f63bfa9a75d@j33g2000pri.googlegroups.com
>
>>> A BHO , called CMyBHO is registering your example PassThru AAP in the
>>> CMyBHO::SetSite method.
>>> CMyBHO.h includes an external decration
>
>>> extern CMyBHO* g_MyBHO;
>
>> Note that in IE7 and up, if I remember correctly, a separate BHO
>> instance is created for each tab. But you only have one global variable
>> for the whole process.
>
>>> The CMyBHO has a public function CMyBHO::addHTMLChunk that can be ...
Show full article (2.11Kb)
no comments
Re: ATL         


Author: Igor Tandetnik
Date: Jun 12, 2008 05:10

"peter.boot" gmail.com> wrote in message
news:9018220c-838d-4f73-9502-6bea2c02d1ac@a9g2000prl.googlegroups.com
> The purpose of wanting to do it is to maintain a common variable to be
> set and referenced by successive instances of CTestSink & CTestAPP as
> an HTML page and it's elements downloads and is processed

What do you plan to do when there are multiple HTML pages downloading
simultaneously, either in different tabs on IE7, or in different frames
on the same page in all IE versions?
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
no comments
Re: ATL         


Author: peter.boot
Date: Jun 12, 2008 16:45

On Jun 12, 10:10 pm, "Igor Tandetnik" mvps.org> wrote:
> "peter.boot" gmail.com> wrote in message
>
> news:9018220c-838d-4f73-9502-6bea2c02d1ac@a9g2000prl.googlegroups.com
>
>> The purpose of wanting to do it is to maintain a common variable to be
>> set and referenced by successive instances of CTestSink & CTestAPP as
>> an HTML page and it's elements downloads and is processed
>
> What do you plan to do when there are multiple HTML pages downloading
> simultaneously, either in different tabs on IE7, or in different frames
> on the same page in all IE versions?
> --
> With best wishes,
> Igor Tandetnik
>
> With sufficient thrust, pigs fly just fine. However, this is not
> necessarily a good idea. It is hard to be sure where they are going to
> land, and it could be dangerous sitting under them as they fly
> overhead. -- RFC 1925 ...
Show full article (1.35Kb)
no comments
Re: ATL         


Author: Igor Tandetnik
Date: Jun 12, 2008 18:50

"peter.boot" gmail.com> wrote in message
news:e330b420-dd43-4274-9b79-d9e5a12e3d69@a70g2000hsh.googlegroups.com
> On Jun 12, 10:10 pm, "Igor Tandetnik" mvps.org> wrote:
>> What do you plan to do when there are multiple HTML pages downloading
>> simultaneously, either in different tabs on IE7, or in different
>> frames on the same page in all IE versions?
>
> Good question, quick & dirty solution I am intending on keeping an
> array of buffers indexed by the URL of the page. But I had in mind
> investigating threading functionality, is
> IInternetProtocolSink::Switch the correct place to look at to attempt
> that ?

To attempt what? I don't understand what you want to do.
--
With best wishes,
Igor Tandetnik
Show full article (0.97Kb)
no comments
1 2