ATL Control and _ATL_MIN_CRT problem 
Author Message
 ATL Control and _ATL_MIN_CRT problem

Hi,
When I build my control with the _ATL_MIN_CRT defined, and without using the
string library the control works fine in VB.
BUT when  I use the #include <string> and remove the _ATL_MIN_CRT define,
I am haing the following problems.

As soon as I drop the control I get a messagebox with getlasterror = 487 [I
checked this with the VC error look up tool and it says Attempt to access
invalid address. ]
On clicking OK to this messagebox, I get another error message which says
the Object with clsid {xxxx-xxx.....} is not registerd. The clsid is that of
the control itself and it is definitely registered.
Could anyone be kind enough to explain this behavior?
I am using the string library to convert BSTRs to LPSTRs etc...is there
another way around this ?
Thanx Murtuza



Wed, 08 Oct 2003 05:28:58 GMT  
 ATL Control and _ATL_MIN_CRT problem
Show some code. It looks like a real error in your code that deals with
strings. Is there any in FinalConstruct?
--
With best wishes,
    Igor Tandetnik


Quote:
> Hi,
> When I build my control with the _ATL_MIN_CRT defined, and without using
the
> string library the control works fine in VB.
> BUT when  I use the #include <string> and remove the _ATL_MIN_CRT define,
> I am haing the following problems.

> As soon as I drop the control I get a messagebox with getlasterror = 487
[I
> checked this with the VC error look up tool and it says Attempt to access
> invalid address. ]
> On clicking OK to this messagebox, I get another error message which says
> the Object with clsid {xxxx-xxx.....} is not registerd. The clsid is that
of
> the control itself and it is definitely registered.
> Could anyone be kind enough to explain this behavior?
> I am using the string library to convert BSTRs to LPSTRs etc...is there
> another way around this ?
> Thanx Murtuza



Wed, 08 Oct 2003 05:38:05 GMT  
 ATL Control and _ATL_MIN_CRT problem
Here are some snippets of finalconstruct, and string handling code
 HRESULT FinalConstruct (){
  win = new CCardeReaderWindow();
   return S_OK;

  }
 HRESULT FinalRelease (){
  delete win;
  return S_OK;
  }

/////////////////////////////////////////////////////////////
 std::string s;
 USES_CONVERSION;
 s = W2A(deviceName);
 WORD wLowVersion = MAKEWORD(1, 0);
 WORD wHighVersion = MAKEWORD(3, 0);
 DWORD dwVersions = MAKELONG(wHighVersion, wLowVersion);
    LPSTR str = (LPSTR)s.c_str();
 _wfsversion version;
 hRes = WFSOpen(str, WFS_DEFAULT_HAPP, NULL, NULL, 300, dwVersions,
&version, NULL, &hService);
 if (hRes != WFS_SUCCESS)
  {
  OutputDebugString ("CardReader Open Failed");
  return E_FAIL;
  }

 win->SetPointerToControl(this);
 OutputDebugString ("Setting windowpointer");
 ::WFSRegister(hService, SYSTEM_EVENTS | USER_EVENTS | SERVICE_EVENTS |
EXECUTE_EVENTS, win->m_hWnd);
 OutputDebugString ("Registering for events");*/
////////////////////////////////////////////////////////////////////////////
///


Quote:
> Show some code. It looks like a real error in your code that deals with
> strings. Is there any in FinalConstruct?
> --
> With best wishes,
>     Igor Tandetnik



> > Hi,
> > When I build my control with the _ATL_MIN_CRT defined, and without using
> the
> > string library the control works fine in VB.
> > BUT when  I use the #include <string> and remove the _ATL_MIN_CRT
define,
> > I am haing the following problems.

> > As soon as I drop the control I get a messagebox with getlasterror = 487
> [I
> > checked this with the VC error look up tool and it says Attempt to
access
> > invalid address. ]
> > On clicking OK to this messagebox, I get another error message which
says
> > the Object with clsid {xxxx-xxx.....} is not registerd. The clsid is
that
> of
> > the control itself and it is definitely registered.
> > Could anyone be kind enough to explain this behavior?
> > I am using the string library to convert BSTRs to LPSTRs etc...is there
> > another way around this ?
> > Thanx Murtuza



Wed, 08 Oct 2003 05:47:31 GMT  
 ATL Control and _ATL_MIN_CRT problem
Does WFSOpen modify the first argument? You cast away constness, which is
there for a reason.
--
With best wishes,
    Igor Tandetnik


Quote:
> Here are some snippets of finalconstruct, and string handling code
>  HRESULT FinalConstruct (){
>   win = new CCardeReaderWindow();
>    return S_OK;

>   }
>  HRESULT FinalRelease (){
>   delete win;
>   return S_OK;
>   }

> /////////////////////////////////////////////////////////////
>  std::string s;
>  USES_CONVERSION;
>  s = W2A(deviceName);
>  WORD wLowVersion = MAKEWORD(1, 0);
>  WORD wHighVersion = MAKEWORD(3, 0);
>  DWORD dwVersions = MAKELONG(wHighVersion, wLowVersion);
>     LPSTR str = (LPSTR)s.c_str();
>  _wfsversion version;
>  hRes = WFSOpen(str, WFS_DEFAULT_HAPP, NULL, NULL, 300, dwVersions,
> &version, NULL, &hService);
>  if (hRes != WFS_SUCCESS)
>   {
>   OutputDebugString ("CardReader Open Failed");
>   return E_FAIL;
>   }

>  win->SetPointerToControl(this);
>  OutputDebugString ("Setting windowpointer");
>  ::WFSRegister(hService, SYSTEM_EVENTS | USER_EVENTS | SERVICE_EVENTS |
> EXECUTE_EVENTS, win->m_hWnd);
>  OutputDebugString ("Registering for events");*/

////////////////////////////////////////////////////////////////////////////

- Show quoted text -

Quote:
> ///



> > Show some code. It looks like a real error in your code that deals with

> > strings. Is there any in FinalConstruct?
> > --
> > With best wishes,
> >     Igor Tandetnik



> > > Hi,
> > > When I build my control with the _ATL_MIN_CRT defined, and without
using
> > the
> > > string library the control works fine in VB.
> > > BUT when  I use the #include <string> and remove the _ATL_MIN_CRT
> define,
> > > I am haing the following problems.

> > > As soon as I drop the control I get a messagebox with getlasterror =
487
> > [I
> > > checked this with the VC error look up tool and it says Attempt to
> access
> > > invalid address. ]
> > > On clicking OK to this messagebox, I get another error message which
> says
> > > the Object with clsid {xxxx-xxx.....} is not registerd. The clsid is
> that
> > of
> > > the control itself and it is definitely registered.
> > > Could anyone be kind enough to explain this behavior?
> > > I am using the string library to convert BSTRs to LPSTRs etc...is
there
> > > another way around this ?
> > > Thanx Murtuza



Wed, 08 Oct 2003 06:01:48 GMT  
 ATL Control and _ATL_MIN_CRT problem
No, the value of the first parameter is not changed by the call.
The easiest way I could convert data from a BSTR to a LPSTR was using this
method .
Is there a standard way to convert a BSTR to a LPSTR?

Thanx murtuza

Quote:
> Does WFSOpen modify the first argument? You cast away constness, which is
> there for a reason.
> --
> With best wishes,
>     Igor Tandetnik



> > Here are some snippets of finalconstruct, and string handling code
> >  HRESULT FinalConstruct (){
> >   win = new CCardeReaderWindow();
> >    return S_OK;

> >   }
> >  HRESULT FinalRelease (){
> >   delete win;
> >   return S_OK;
> >   }

> > /////////////////////////////////////////////////////////////
> >  std::string s;
> >  USES_CONVERSION;
> >  s = W2A(deviceName);
> >  WORD wLowVersion = MAKEWORD(1, 0);
> >  WORD wHighVersion = MAKEWORD(3, 0);
> >  DWORD dwVersions = MAKELONG(wHighVersion, wLowVersion);
> >     LPSTR str = (LPSTR)s.c_str();
> >  _wfsversion version;
> >  hRes = WFSOpen(str, WFS_DEFAULT_HAPP, NULL, NULL, 300, dwVersions,
> > &version, NULL, &hService);
> >  if (hRes != WFS_SUCCESS)
> >   {
> >   OutputDebugString ("CardReader Open Failed");
> >   return E_FAIL;
> >   }

> >  win->SetPointerToControl(this);
> >  OutputDebugString ("Setting windowpointer");
> >  ::WFSRegister(hService, SYSTEM_EVENTS | USER_EVENTS | SERVICE_EVENTS |
> > EXECUTE_EVENTS, win->m_hWnd);
> >  OutputDebugString ("Registering for events");*/

////////////////////////////////////////////////////////////////////////////

- Show quoted text -

Quote:
> > ///



> > > Show some code. It looks like a real error in your code that deals
with

> > > strings. Is there any in FinalConstruct?
> > > --
> > > With best wishes,
> > >     Igor Tandetnik



> > > > Hi,
> > > > When I build my control with the _ATL_MIN_CRT defined, and without
> using
> > > the
> > > > string library the control works fine in VB.
> > > > BUT when  I use the #include <string> and remove the _ATL_MIN_CRT
> > define,
> > > > I am haing the following problems.

> > > > As soon as I drop the control I get a messagebox with getlasterror =
> 487
> > > [I
> > > > checked this with the VC error look up tool and it says Attempt to
> > access
> > > > invalid address. ]
> > > > On clicking OK to this messagebox, I get another error message which
> > says
> > > > the Object with clsid {xxxx-xxx.....} is not registerd. The clsid is
> > that
> > > of
> > > > the control itself and it is definitely registered.
> > > > Could anyone be kind enough to explain this behavior?
> > > > I am using the string library to convert BSTRs to LPSTRs etc...is
> there
> > > > another way around this ?
> > > > Thanx Murtuza



Wed, 08 Oct 2003 06:10:08 GMT  
 ATL Control and _ATL_MIN_CRT problem
Well, W2A (better use OLE2A) does exactly that, no need to go through
std::string
--
With best wishes,
    Igor Tandetnik


Quote:
> No, the value of the first parameter is not changed by the call.
> The easiest way I could convert data from a BSTR to a LPSTR was using this
> method .
> Is there a standard way to convert a BSTR to a LPSTR?

> Thanx murtuza


> > Does WFSOpen modify the first argument? You cast away constness, which
is
> > there for a reason.
> > --
> > With best wishes,
> >     Igor Tandetnik



> > > Here are some snippets of finalconstruct, and string handling code
> > >  HRESULT FinalConstruct (){
> > >   win = new CCardeReaderWindow();
> > >    return S_OK;

> > >   }
> > >  HRESULT FinalRelease (){
> > >   delete win;
> > >   return S_OK;
> > >   }

> > > /////////////////////////////////////////////////////////////
> > >  std::string s;
> > >  USES_CONVERSION;
> > >  s = W2A(deviceName);
> > >  WORD wLowVersion = MAKEWORD(1, 0);
> > >  WORD wHighVersion = MAKEWORD(3, 0);
> > >  DWORD dwVersions = MAKELONG(wHighVersion, wLowVersion);
> > >     LPSTR str = (LPSTR)s.c_str();
> > >  _wfsversion version;
> > >  hRes = WFSOpen(str, WFS_DEFAULT_HAPP, NULL, NULL, 300, dwVersions,
> > > &version, NULL, &hService);
> > >  if (hRes != WFS_SUCCESS)
> > >   {
> > >   OutputDebugString ("CardReader Open Failed");
> > >   return E_FAIL;
> > >   }

> > >  win->SetPointerToControl(this);
> > >  OutputDebugString ("Setting windowpointer");
> > >  ::WFSRegister(hService, SYSTEM_EVENTS | USER_EVENTS | SERVICE_EVENTS
|
> > > EXECUTE_EVENTS, win->m_hWnd);
> > >  OutputDebugString ("Registering for events");*/

////////////////////////////////////////////////////////////////////////////

- Show quoted text -

Quote:
> > > ///



> > > > Show some code. It looks like a real error in your code that deals
> with

> > > > strings. Is there any in FinalConstruct?
> > > > --
> > > > With best wishes,
> > > >     Igor Tandetnik



> > > > > Hi,
> > > > > When I build my control with the _ATL_MIN_CRT defined, and without
> > using
> > > > the
> > > > > string library the control works fine in VB.
> > > > > BUT when  I use the #include <string> and remove the _ATL_MIN_CRT
> > > define,
> > > > > I am haing the following problems.

> > > > > As soon as I drop the control I get a messagebox with getlasterror
=
> > 487
> > > > [I
> > > > > checked this with the VC error look up tool and it says Attempt to
> > > access
> > > > > invalid address. ]
> > > > > On clicking OK to this messagebox, I get another error message
which
> > > says
> > > > > the Object with clsid {xxxx-xxx.....} is not registerd. The clsid
is
> > > that
> > > > of
> > > > > the control itself and it is definitely registered.
> > > > > Could anyone be kind enough to explain this behavior?
> > > > > I am using the string library to convert BSTRs to LPSTRs etc...is
> > there
> > > > > another way around this ?
> > > > > Thanx Murtuza



Wed, 08 Oct 2003 06:23:44 GMT  
 ATL Control and _ATL_MIN_CRT problem
Tried using OLE2A but have the same problem,
first dialog box says "invalid virtual base addr.; GetLastError 487"
the next dialog box pops up and says
"Class not registered ,looking for object with clsid {xxx-xxx- }"
where xxx-... is the clsid of the coclass.
Thanx in advance  Murtuza

Quote:
> Well, W2A (better use OLE2A) does exactly that, no need to go through
> std::string
> --
> With best wishes,
>     Igor Tandetnik



> > No, the value of the first parameter is not changed by the call.
> > The easiest way I could convert data from a BSTR to a LPSTR was using
this
> > method .
> > Is there a standard way to convert a BSTR to a LPSTR?

> > Thanx murtuza


> > > Does WFSOpen modify the first argument? You cast away constness, which
> is
> > > there for a reason.
> > > --
> > > With best wishes,
> > >     Igor Tandetnik



> > > > Here are some snippets of finalconstruct, and string handling code
> > > >  HRESULT FinalConstruct (){
> > > >   win = new CCardeReaderWindow();
> > > >    return S_OK;

> > > >   }
> > > >  HRESULT FinalRelease (){
> > > >   delete win;
> > > >   return S_OK;
> > > >   }

> > > > /////////////////////////////////////////////////////////////
> > > >  std::string s;
> > > >  USES_CONVERSION;
> > > >  s = W2A(deviceName);
> > > >  WORD wLowVersion = MAKEWORD(1, 0);
> > > >  WORD wHighVersion = MAKEWORD(3, 0);
> > > >  DWORD dwVersions = MAKELONG(wHighVersion, wLowVersion);
> > > >     LPSTR str = (LPSTR)s.c_str();
> > > >  _wfsversion version;
> > > >  hRes = WFSOpen(str, WFS_DEFAULT_HAPP, NULL, NULL, 300, dwVersions,
> > > > &version, NULL, &hService);
> > > >  if (hRes != WFS_SUCCESS)
> > > >   {
> > > >   OutputDebugString ("CardReader Open Failed");
> > > >   return E_FAIL;
> > > >   }

> > > >  win->SetPointerToControl(this);
> > > >  OutputDebugString ("Setting windowpointer");
> > > >  ::WFSRegister(hService, SYSTEM_EVENTS | USER_EVENTS |
SERVICE_EVENTS
> |
> > > > EXECUTE_EVENTS, win->m_hWnd);
> > > >  OutputDebugString ("Registering for events");*/

////////////////////////////////////////////////////////////////////////////

- Show quoted text -

Quote:
> > > > ///



> > > > > Show some code. It looks like a real error in your code that deals
> > with

> > > > > strings. Is there any in FinalConstruct?
> > > > > --
> > > > > With best wishes,
> > > > >     Igor Tandetnik



> > > > > > Hi,
> > > > > > When I build my control with the _ATL_MIN_CRT defined, and
without
> > > using
> > > > > the
> > > > > > string library the control works fine in VB.
> > > > > > BUT when  I use the #include <string> and remove the
_ATL_MIN_CRT
> > > > define,
> > > > > > I am haing the following problems.

> > > > > > As soon as I drop the control I get a messagebox with
getlasterror
> =
> > > 487
> > > > > [I
> > > > > > checked this with the VC error look up tool and it says Attempt
to
> > > > access
> > > > > > invalid address. ]
> > > > > > On clicking OK to this messagebox, I get another error message
> which
> > > > says
> > > > > > the Object with clsid {xxxx-xxx.....} is not registerd. The
clsid
> is
> > > > that
> > > > > of
> > > > > > the control itself and it is definitely registered.
> > > > > > Could anyone be kind enough to explain this behavior?
> > > > > > I am using the string library to convert BSTRs to LPSTRs
etc...is
> > > there
> > > > > > another way around this ?
> > > > > > Thanx Murtuza



Fri, 10 Oct 2003 21:15:06 GMT  
 ATL Control and _ATL_MIN_CRT problem
When I comment out the WFSOpen and WFSRegister calls the control does not
crash.
These calls are the problem. The whole point in writing this control is to
wrap the functionality of the xfs library ?
What do you suppose is wrong?

The library tha I use is a standard microsoft library  msXFS.lib [a part of
the xfs sdk]

Thanx Murtuza

Quote:
> Does WFSOpen modify the first argument? You cast away constness, which is
> there for a reason.
> --
> With best wishes,
>     Igor Tandetnik



> > Here are some snippets of finalconstruct, and string handling code
> >  HRESULT FinalConstruct (){
> >   win = new CCardeReaderWindow();
> >    return S_OK;

> >   }
> >  HRESULT FinalRelease (){
> >   delete win;
> >   return S_OK;
> >   }

> > /////////////////////////////////////////////////////////////
> >  std::string s;
> >  USES_CONVERSION;
> >  s = W2A(deviceName);
> >  WORD wLowVersion = MAKEWORD(1, 0);
> >  WORD wHighVersion = MAKEWORD(3, 0);
> >  DWORD dwVersions = MAKELONG(wHighVersion, wLowVersion);
> >     LPSTR str = (LPSTR)s.c_str();
> >  _wfsversion version;
> >  hRes = WFSOpen(str, WFS_DEFAULT_HAPP, NULL, NULL, 300, dwVersions,
> > &version, NULL, &hService);
> >  if (hRes != WFS_SUCCESS)
> >   {
> >   OutputDebugString ("CardReader Open Failed");
> >   return E_FAIL;
> >   }

> >  win->SetPointerToControl(this);
> >  OutputDebugString ("Setting windowpointer");
> >  ::WFSRegister(hService, SYSTEM_EVENTS | USER_EVENTS | SERVICE_EVENTS |
> > EXECUTE_EVENTS, win->m_hWnd);
> >  OutputDebugString ("Registering for events");*/

////////////////////////////////////////////////////////////////////////////

- Show quoted text -

Quote:
> > ///



> > > Show some code. It looks like a real error in your code that deals
with

> > > strings. Is there any in FinalConstruct?
> > > --
> > > With best wishes,
> > >     Igor Tandetnik



> > > > Hi,
> > > > When I build my control with the _ATL_MIN_CRT defined, and without
> using
> > > the
> > > > string library the control works fine in VB.
> > > > BUT when  I use the #include <string> and remove the _ATL_MIN_CRT
> > define,
> > > > I am haing the following problems.

> > > > As soon as I drop the control I get a messagebox with getlasterror =
> 487
> > > [I
> > > > checked this with the VC error look up tool and it says Attempt to
> > access
> > > > invalid address. ]
> > > > On clicking OK to this messagebox, I get another error message which
> > says
> > > > the Object with clsid {xxxx-xxx.....} is not registerd. The clsid is
> > that
> > > of
> > > > the control itself and it is definitely registered.
> > > > Could anyone be kind enough to explain this behavior?
> > > > I am using the string library to convert BSTRs to LPSTRs etc...is
> there
> > > > another way around this ?
> > > > Thanx Murtuza



Sat, 11 Oct 2003 02:34:23 GMT  
 ATL Control and _ATL_MIN_CRT problem


Fri, 19 Jun 1992 00:00:00 GMT  
 ATL Control and _ATL_MIN_CRT problem
There were 2 versions of the msxfs.dll on the machine. VB was picking the
wrong one.

Thanx for the all the help.

Murtuza


Quote:
> When I comment out the WFSOpen and WFSRegister calls the control does not
> crash.
> These calls are the problem. The whole point in writing this control is to
> wrap the functionality of the xfs library ?
> What do you suppose is wrong?

> The library tha I use is a standard microsoft library  msXFS.lib [a part
of
> the xfs sdk]

> Thanx Murtuza


> > Does WFSOpen modify the first argument? You cast away constness, which
is
> > there for a reason.
> > --
> > With best wishes,
> >     Igor Tandetnik



> > > Here are some snippets of finalconstruct, and string handling code
> > >  HRESULT FinalConstruct (){
> > >   win = new CCardeReaderWindow();
> > >    return S_OK;

> > >   }
> > >  HRESULT FinalRelease (){
> > >   delete win;
> > >   return S_OK;
> > >   }

> > > /////////////////////////////////////////////////////////////
> > >  std::string s;
> > >  USES_CONVERSION;
> > >  s = W2A(deviceName);
> > >  WORD wLowVersion = MAKEWORD(1, 0);
> > >  WORD wHighVersion = MAKEWORD(3, 0);
> > >  DWORD dwVersions = MAKELONG(wHighVersion, wLowVersion);
> > >     LPSTR str = (LPSTR)s.c_str();
> > >  _wfsversion version;
> > >  hRes = WFSOpen(str, WFS_DEFAULT_HAPP, NULL, NULL, 300, dwVersions,
> > > &version, NULL, &hService);
> > >  if (hRes != WFS_SUCCESS)
> > >   {
> > >   OutputDebugString ("CardReader Open Failed");
> > >   return E_FAIL;
> > >   }

> > >  win->SetPointerToControl(this);
> > >  OutputDebugString ("Setting windowpointer");
> > >  ::WFSRegister(hService, SYSTEM_EVENTS | USER_EVENTS | SERVICE_EVENTS
|
> > > EXECUTE_EVENTS, win->m_hWnd);
> > >  OutputDebugString ("Registering for events");*/

////////////////////////////////////////////////////////////////////////////

- Show quoted text -

Quote:
> > > ///



> > > > Show some code. It looks like a real error in your code that deals
> with

> > > > strings. Is there any in FinalConstruct?
> > > > --
> > > > With best wishes,
> > > >     Igor Tandetnik



> > > > > Hi,
> > > > > When I build my control with the _ATL_MIN_CRT defined, and without
> > using
> > > > the
> > > > > string library the control works fine in VB.
> > > > > BUT when  I use the #include <string> and remove the _ATL_MIN_CRT
> > > define,
> > > > > I am haing the following problems.

> > > > > As soon as I drop the control I get a messagebox with getlasterror
=
> > 487
> > > > [I
> > > > > checked this with the VC error look up tool and it says Attempt to
> > > access
> > > > > invalid address. ]
> > > > > On clicking OK to this messagebox, I get another error message
which
> > > says
> > > > > the Object with clsid {xxxx-xxx.....} is not registerd. The clsid
is
> > > that
> > > > of
> > > > > the control itself and it is definitely registered.
> > > > > Could anyone be kind enough to explain this behavior?
> > > > > I am using the string library to convert BSTRs to LPSTRs etc...is
> > there
> > > > > another way around this ?
> > > > > Thanx Murtuza



Sat, 11 Oct 2003 04:37:38 GMT  
 
 [ 10 post ] 

 Relevant Pages 

1. _ATL_MIN_CRT - release problem

2. ATL Full Control - mouse activation problems in Composite Control

3. ATL Full Control - mouse activation problems in Composite Control

4. Key Buffer Problem ATL Windows RichEdit Control Control

5. Help - Problems with Drawing an MFC ActiveX control inside on ATL compsoite control

6. Problems with Drawing an MFC ActiveX control inside on ATL compsoite control

7. Howto make the data of one ATL control to other ATL controls

8. Problem using activex control inside ATL com dll

9. Problem with ATL combo control

10. ATL ActiveX control tabstop problem

11. WM_MOUSELEAVE in ATL ActiveX Control problem, help

12. ATL HTML Control problem

 

 
Powered by phpBB® Forum Software