|
IElementBehaviorFactory* pEBFactory = NULL;
//Create my com object of implementing IElementBehaviorFactory interface
CoCreateInstance(CLSID_Factory, NULL, CLSCTX_INPROC_SERVER,IID_IElementBehaviorFactory, (void**)&pEBFactory);
//Mashal IElementBehaviorFactory
hr = CoMarshalInterThreadInterfaceInStream(IID_IElementBehaviorFactory, pEBFactory, &pStm);
The return value hr is 0x80004002, why?
The default value of [HKEY_CLASSES_ROOT/Interface/{3050F429-98B5-11CF-BB82-00AA00BDCE0B}/ProxyStubClsid32] is {B8DA6310-E19B-11D0-933C-00A0C90DCAA9}.
{B8DA6310-E19B-11D0-933C-00A0C90DCAA9} is the class id of actxprxy.dll.
I think that actxprxy.dll is the proxy/stub for IElementBehaviorFactory, but I don't know why CoMarshalInterThreadInterfaceInStream call fail for IElementBehaviorFactory.
|
|
|
|
|
With the help of new ATL object i have done OLEDB connection and now table.h header file is created in my project with all the table field varaible in that...now i want to insert Data from remote server to msaccess database..but i dont know how to do coding for that..can anybody help me...to do coding...how to start..if any question pls ask and try to help me..
Thank you
|
|
|
|
|
|
We have a function which has the following signature
SomeFunction(TCHAR* szPassword,TCHAR* szEncryptPwd)
Now we need to pass in a std::string as the first parameter,and convert the second parameter back into a std::string on return.
How is the conversion from std::string to TCHAR* and back to std::string done?
|
|
|
|
|
|
Hello,
Just use W2A(…) macro. More information on MSDN.
Regards,
Leonid
|
|
|
|
|
Hi. I'm new to writing Active-X controls and have a few quesitons which I couldn't find answers for in the archives. Here's what I'm trying to do. If you have a better suggestion, please respond.
We are using Visual C++ 6.0 and EVC++ 4.0 and ATL (no MFC). I want to create a collection of ActiveX controls which will all be derived from one base control so I can use a vector of them in a container window. My main quesiton:
- Is it even possible to derive new ATL ActiveX controls from a base ATL ActiveX control? I'm thinking like in regultar C++ if I create a base ActiveX control for, say, a button, then derive other types of buttons from that and override their OnDraw() or OnPain() methods, I can just have a vector of these base buttons. Am I off in left field?
Thanks,
Mark.
Mark Malin
Software Developer
GE Healthcare
|
|
|
|
|
markjmalin wrote: Am I off in left field?
More like left-center.
No you cannot derive from ActiveX controls because you cannot derive from COM objects.
markjmalin wrote: I can just have a vector of these base buttons.
For what purpose is the vector? Not to use the OnDraw() or OnPaint() methods right? All COM objects already share a common interface "IUnkown", so technically you could store that in the vector, but for what purpose?
led mike
|
|
|
|
|
The idea was to have a container window class of some sort which would contain any number of ActiveX controls. These would be diverse (buttons, grids, graphs, etc.). I figured a vector could contain maybe pointers to these, but in my non-COM object oriented brain I'm thinking they all need to derive from some common class, then. Each one would handle it's own drawing and functionality.
Our current design uses a template struct, "ViewHost", which contains a CAxWindow and a CComPtr member. This struct wraps the creation of the ActiveX controls. Our current design hard-codes different container window types to contain specific ActiveX controls. I'm working on redisigning it and want to be able to take any container window and put whatever controls I want in it. My thought was a vector of our "ViewHosts" in each container, but since ViewHost is a template (and since it contains CComPtr which is a template), the compiler needs to know at compile time what class each one is. So that kills my idea of a vector of ViewHost structures containing any kind of ActiveX control.
Anyhow, that's why I thought "if I can derive these controls from some common base class I can have a vector of them"
Any thoughts? Are you sure I'm only "off center"?
Mark.
Mark Malin
Software Developer
GE Healthcare
|
|
|
|
|
markjmalin wrote: to be able to take any container window and put whatever controls I want in it
CAxWindow already does that so I am completely confused at this point.
led mike
|
|
|
|
|
Hm.... I need to look at our design. The guy who did the design is no longer here. One thing we've done is create our own private heap class. It's very likely he wrapped this code to make use of our own New and Delete methods in our private heap.
So you're saying a guy could have a vector of any number of CAxWindow's and be good to go?
(sorry for the ignorance -- I'm not all that adept at ActiveX and COM)
Mark.
Mark Malin
Software Developer
GE Healthcare
|
|
|
|
|
markjmalin wrote: So you're saying a guy could have a vector of any number of CAxWindow's and be good to go?
Well not yet since you still did not explain "why" you need anything in a vector. So far all you mentioned was the painting routines which are already managed from a calling stand point so there would be no need for you to access any of these objects at runtime in association with painting.
led mike
|
|
|
|
|
Sorry. The ActiveX controls have methods that need to be called on them. Obviously things like painting happen already. These controls are things like real-time graphs (strip charts) for instance, which have data sent to them, status information, etc. There are numeric displays that a user might interact with via touch-screen, which might visibly change based on user input. We're using a "Model/View/Controler" pattern, and the "View" part of that will contain the ActiveX controls for user input and display of information. The Model and Controller (also COM objects) process user input events from the View and change the display of the ActiveX controls where needed.
So I need some way for the Model to manage the View. Since the View is a container of ActiveX controls, the Model needs access to these to update them and make visual changes via calling methods on them. If a View container can have any number of diverse ActiveX control on it, I thought a vector would be a good route.
Our current design has specific View containers pre-defined. It's a very non-flexible design. One pre-defined view might always have 3 buttons along the top, so there are 3 "ViewHost" members containing buttons. It may always have a static text box, so there's one "ViewHost" member for that. When the user touches the button, maybe the next step is for the other two buttons to dissapear and the text to change. The Model needs to have access to the View's ActiveX controls to tell the 2 buttons to make themselves invisible, and push some text into the text box.
Hope that makes it clearer.
Mark.
Mark Malin
Software Developer
GE Healthcare
|
|
|
|
|
markjmalin wrote: the Model needs access to these to update them and make visual changes via calling methods on them.
MVC pattern should utilize "events" to notify listeners of data changes. Then listeners "pull" data. This way the Model remains isolated from knowing about Controllers or Views. This is a major factor in the MVC design.
In your case it sounds like your View windows (the containers of all the CAxWindows) might be good candidates for registering for the data events. Then each View would have the logic about how to call methods in all it's child windows to update their displays.
Does that help?
led mike
|
|
|
|
|
That helps a great deal. Thanks!
Mark.
Mark Malin
Software Developer
GE Healthcare
|
|
|
|
|
I'm working on a data processing application where the user selects the data source and relevant fields at runtime. No matter what the source (Access, Excel, MySQL, etc) I am able to retrieve the table names and column information. But for any non-access data source, when I query it, there are no rows returned and the application crashes on my MoveFirst call. Here is the source, and forgive me, this is my first time with ATL:
<br />
CDataSource source;<br />
CSession sess;<br />
<br />
CTable<CDynamicAccessor> rs;<br />
<br />
USES_CONVERSION;<br />
<br />
if(source.OpenFromInitializationString(A2OLE(m_lpFilename))!=S_OK)<br />
return FALSE;<br />
<br />
<br />
if(sess.Open(source)!=S_OK)<br />
{<br />
sess.Close();<br />
source.Close();<br />
<br />
return FALSE;<br />
}<br />
<br />
<br />
CString sSQL="..."<br />
<br />
<br />
rs.Open(sess,sSQL);<br />
<br />
HRESULT hr=rs.MoveFirst();<br />
The debugger asserts on the rowset being NULL, so I take it nothing was returned from the data source but queries run against the database (like in the MySQL console) return rows.
Any idea at all whats going wrong?
Thanks,
Aaron
modified 12-Jul-20 21:01pm.
|
|
|
|
|
CTable doesn't accept an SQL-string as argument, it expects a table name. It could be the case that CTable crashes due to poor error handling. Have you tried with CCommand?
--
LOADING...
|
|
|
|
|
You're right, its not supposed to accept SQL. Very odd that it would in certain cases. Now that I've addressed that, everything is working great. Thanks!
modified 12-Jul-20 21:01pm.
|
|
|
|
|
I want to add Atl New Object to my project And according to theory it sould be present in Insert Menu But that is not present in my vc++6.0 Enter price Edition...
Can anybody help me how to get it
|
|
|
|
|
does answer in VC++ forum doesn't satisfy you?
|
|
|
|
|
hy.
I am write aplication in WinXP on DCOM and i have a lot of problems with it.
My question is : meybe there is samthing else that better that DCOM or samthing that replace DCOM or may be .NET have anything else.
I tred to find any books on DCOM but I can`t find any new books on DCOM. a books that a found them from 1999 and there is nothing on DCOM in WinXP.
please help me.
thanks.
greg
-- modified at 4:42 Sunday 22nd October, 2006
|
|
|
|
|
i recently coded an Empty Hello Projcet using VC6.0.
this project consists of three files:
1 MySimple.cpp
//----------------------------------------
#include "accum3.h"
#include <iostream>
template< typename T >
inline
typename AccumulationTraits< T >::AccT accum(T const* beg, T const* end)
{
return Accum< T >::accum(beg, end);
}
int main()
{
int num[] = {1,2,3,4,5};
accum(&num[0], &num[5]);
return 0;
}
//------------------------------
2 accumtriats.hpp
//-----------------------------
template< typename T >
class AccumulationTraits;
template<>
class AccumulationTraits< char >
{
public:
typedef int AccT;
static AccT zero()
{
return 0;
}
};
template<>
class AccumulationTraits< int >
{
public:
typedef long AccT;
static AccT zero()
{
return 0;
}
};
......
//--------------------------------
3 accum3.hpp
//----------------------------------
#include "accumtraits2.h"
template < typename T ,
typename AT = AccumulationTriats< T > >
class Accum
{
public:
static typename AT::AccT accum(T const* beg, T const* end )
{
typename AT::AccT total = AT::zero();
while( beg != end )
{
total += *beg;
++beg;
}
return total;
}
};
//------------------------
but when i try to complie this project, problems start to arise like fellowing:
"AccT" is not a member of AccumulationTraits
being stuck by this problem for days, i really get
frustrated. Doesn't VC6.0 surpport syntax like this?
template< typename T >
class AccumulationTraits;
template<>
class AccumulationTraits< char >
{
public:
typedef int AccT;
static AccT zero()
{
return 0;
}
};
well, i am all at the sea now
i do define AccT in AccumulationTraits
|
|
|
|
|
I suggest you to post your code in proper format , using pre tags.
|
|
|
|
|
Hello Yaki_15,
Visual C++ 6.0 is not fully STL compliant. VC++ 7.0 -is-.
I compiled your code in VC++ 7.0 with no problems but faced the exact same compilation error that you faced when I did it with VC++ 6.0.
However, I came up with a workaround for you :
try adding this class :
template < typename T >
class return_value
{
public:
typedef AccumulationTraits<t> traits_type;
typedef traits_type::AccT type;
};
then re-declare "accum" as follows :
template< typename T >
inline typename return_value< T >::type accum(T const* beg, T const* end)
{
return Accum< T >::accum(beg, end);
}
The compilation worked this time. The results are the same when I used "accum()" in main().
Best Regards,
Bio.
|
|
|
|
|
Hi, Bio
<I compiled your code in VC++ 7.0 with no problems >
After days' searching for stuff on this, i begin to know that VC++7.0
Surports:
Partial Specialization of class templates
but VC++6.0 doesn't, as well as follow Advanced Features of C++:
1 Out-of-class member template definitions
2 template template parameters
It's said that VC++7.1 or higher is upto 98% conforming to the C++ Standar,so
the featurs we discuss above are well surpported by VC7.1
<try adding this class>
where should i place this class? i need more information like this:
1 in which file
2 at which position(a Forward Declaration?)
I really appreciate your work and help.
best wishes
Yaki
|
|
|
|