|
Hi
I have a project containing an ATL Simple object,
It's a VC++ server project.
I am using VB6 to connect to the object.
Now I wanted to add more ATL Simple objects.
I used the wizard and marked the new objects with
Dual support.
But when I try to connect with the objects in VB6 I get
an error msg: 430, that the object doesn’t support automation.
What did I do wrong???
Yoav
|
|
|
|
|
Although i'm not a VB programmer it sounds to me that your interface does not inherit from IDispatch (or is not a dispinterface). VB(and scripting languages) need IDispatch to communicate. Check your IDL file to see if this is the case.
|
|
|
|
|
I'm making a hyperlink control which i obviously need to color but i found out that chil controls don't automaticly receive the WM_CTLCOLORSTATIC message so i thought i needed to do this with Message Reflection. I however don't have a clue how to do this except for Notify messages. Can somebody help me out?
|
|
|
|
|
Have you looked into handling the OCM_CTRLCOLORSTATIC message with reflection?
|
|
|
|
|
If I use this, how do I reflect the message from to parrent to the child?
|
|
|
|
|
I have used something like the following:
In the parent's message map include REFLECT_NOTIFICATIONS()
like:
BEGIN_MSG_MAP(CMainFrame)
REFLECT_NOTIFICATIONS()
...
END_MSG_MSP()
And in the child message map do something like:
BEGIN_MSG_MAP(CChildWindow)
MSG_OCM_NOTIFY(OnNotify)
DEFAULT_REFLECTION_HANDLER()
END_MSG_MAP()
This has worked for me. The MSG_OCM_NOTIFY is from WTL enhanced message crackers in atlcrack.h.
Good Luck,
Tom Rieck
|
|
|
|
|
Hi All,
I can't figure out why VS.NET03 can't find my wtl7 include directory? I set the dir. path in Tools->Options->Project->VC++ Include directories. I even set it in the project settings as an additional include directory.
Any suggestions ? Here is the exact error I am getting.
Compiling...
stdafx.cpp
c:\Documents and Settings\Administrator\My Documents\Visual Studio Projects\WTLTest\stdafx.h(15) : fatal error C1083: Cannot open include file: 'atlapp.h': No such file or directory
Thanks.
R.Bischoff | C++
.NET, Kommst du mit?
|
|
|
|
|
Partial answer to my own question:
I got it to compile by doing the following steps:
1. right click on project, select properties. Then C++/General, under 'Additional Directories' I entered C:\wtl70\include.
2. now i have an error with atlres.h not found, so again, right click on project, select properties. Then Resources/General, under 'Additional Directories' I entered C:\wtl70\include.
Now it compiles, but why doesn't setting the include of wtl7 via Tools->Options->Project->VC++ -> Include directories work ??
Thanks.
R.Bischoff | C++
.NET, Kommst du mit?
|
|
|
|
|
You're using two tools, the C++ compiler and the resource compiler (RC), and they have different settings. If you were using VC++6, and any IDL, then you'd be using a third tool as well, which also has independent settings...
Steve S
[This signature space available for rent]
|
|
|
|
|
I need to redraw composite control each time when Enabled stock property was changed.
Composite control do not use OnDraw method foor displaying itself, so technique for traditional controls is not applicable.
Or give me an example of working composite control with Font and Enabled property support
This is my property map:
BEGIN_PROP_MAP(CADialog)
PROP_DATA_ENTRY("_cx", m_sizeExtent.cx, VT_UI4)
PROP_DATA_ENTRY("_cy", m_sizeExtent.cy, VT_UI4)
PROP_ENTRY("AutoSize", DISPID_AUTOSIZE, CLSID_NULL)
PROP_ENTRY("Enabled", DISPID_ENABLED, CLSID_NULL)
PROP_ENTRY("Font", DISPID_FONT, CLSID_StockFontPage)
PROP_ENTRY("TabStop", DISPID_TABSTOP, CLSID_NULL)
END_PROP_MAP()
|
|
|
|
|
How can I make a hash map with an std::string for a key? VC++ .NET barfs, complaining that it cannot convert from type 'std::string' to 'size_t'.
Why couldn't Science, in the long run, serve
As well as one's uncleared lunch-table or
Mme X en Culottes de Matador? James Merrill
|
|
|
|
|
I don't know how to do this but you need to write a hash function.
John
|
|
|
|
|
I found this on a web search:
#include <iostream>
#include <string>
#include <hash_map>
using namespace std;
namespace std
{
template<> struct hash< std::string >
{
size_t operator()( const std::string& x ) const
{
return hash< const char* >()( x.c_str() );
}
};
}
hash_map <string, int> months;
int main(void) {
months["january"] = 31;
months["february"] = 28;
return 0;
}
John
|
|
|
|
|
Here's the hash function I've been using:
namespace std {
template<>
size_t hash_compare<string>::operator()(const string &s) const
{
unsigned long retv = 0;
for (string::const_iterator iter = s.begin();
iter != s.end(); ++iter)
{
retv = 5 * retv + *iter;
}
return size_t(retv);
}
} There's probably a better way to do it, though.
- Mike
|
|
|
|
|
The other ways, of course, to get working hash_map s would be to either
- use STLPort (where
hash_map and hash_set have a hash comparison function defined for std::string s - and also you get nice features like debug mode, which tells you when you've made boo-boos like pushing an iterator outside a container, or used mismatched iterators)
- Upgrade to VS.NET 2003. It cost me GBP19 (USD30 roughly) and was worth every penny - especially for the way more compliant compiler and faster IDE (well, I think it is - subjectively).
Of course, the solution in the other posts is rather more immediate
Stuart Dootson
'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
|
|
|
|
|
Here's how Java get a hash code for the string. The algorithm should be fine:
/**
* Returns a hash code for this string. The hash code for a
* <code>String</code> object is computed as
* <blockquote><pre>
* s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1]
* </pre></blockquote>
* using <code>int</code> arithmetic, where <code>s[i]</code> is the
* <i>i</i>th character of the string, <code>n</code> is the length of
* the string, and <code>^</code> indicates exponentiation.
* (The hash value of the empty string is zero.)
*
* @return a hash code value for this object.
*/
Best regards,
Alexandru Savescu
<small>P.S. Interested in art? Visit <a href="http://www.geocities.com/mirunadutescu" target="_blank"> this! </a></small>
|
|
|
|
|
Thanks to everyone who helped explain this. Thanks especially for the code fragments.
Why couldn't Science, in the long run, serve
As well as one's uncleared lunch-table or
Mme X en Culottes de Matador? James Merrill
|
|
|
|
|
I am having to implement a help key in a Property Sheet. The sheet consists of several pages derived from COlePropertyPage, and one that is an ATL implementation and is derived from IPropertyPageImpl.
I've managed to insert a help button by calling SetHelpInfo from the COlePropertyPage derived pages, but this button is disabled/greyed out when the ATL page is selected.
The property sheet container is not directly within my control as it is created via BEGIN_PROPPAGEIDS. How can I either force a global enable of this Help button, or enable it directly from the ATL page? Or any other imaginative solution would do!
Thanks
Debbie
|
|
|
|
|
I have problem with IWebBrowser2 or IwebBrowserApp.
I use ATL/COM .exe module build a program and
hr = CoCreateInstance(CLSID_InternetExplorer, NULL, CLSCTX_LOCAL_SERVER,
IID_IWebBrowser2, (void**)&m_spIE);
To create IWebBrowser2
Later on I can call IWebBrowser2/IwebBrowserApp's Navigate sussefully.
But when I create a thread in my ATL/COM , use that thread
to call IWebBrowser2::Navigate or IwebBrowserApp::Navigate
It pop up error.
If it is IWebBrowser2::Navigate, it pops up Error MessageBox
Said "Run time error"
when I use IWebBrowserApp::Navigate, it don't work without any error messagebox.
When I debug. I found After I call Navigate. It throw out a error
message "0x800401F0: (no name)"..
But if I not call from the new create thread, nothing is wrong.
BTW, I use Visual C++ 5.0 without microsoft SDK.
My computer's IE is IE 6.0 Sp1.
Help...
Thank you
|
|
|
|
|
I have a question that I've found the answer to but still can't figure out.
I've got this class, let's call it "cat". Cat has many methods, but the only one i care about right now is "get_age()" which returns the cat's age as a float. Now I have a vector of these cats and wish to sort that vector by the cat's ages.
cats.sort() by cats.get_age().
I know I have to do something like:
bool apredicate(const cat& a, const cat& b)
{
return &a.get_age < &b.get_age;
}
I am completely confused on how this works (can't get it to work either). Could someone please show be a coded example... maybe then I'll get it
Thank you!
greg
|
|
|
|
|
Greg1421 wrote:
cats.sort() by cats.get_age().
Vectors don't have a sort method, but lists do. To compensate you will need to use the generic STL sort algorithm.
Greg1421 wrote:
return &a.get_age < &b.get_age;
The predicate should call cat::get_age() rather than taking its address.
Make sure that cats::get_age() is declared const, if it isn't the predicate won't compile.
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
class cat
{
public:
cat(int age)
: age_(age)
{
}
int get_age() const { return age_; }
private:
int age_;
};
bool apredicate(const cat& a, const cat& b)
{
return a.get_age() < b.get_age();
}
int main()
{
vector<cat> v;
v.push_back(cat(0));
v.push_back(cat(2));
v.push_back(cat(1));
v.push_back(cat(4));
v.push_back(cat(3));
v.push_back(cat(9));
sort(v.begin(),v.end(),apredicate);
for(int i = 0; i < v.size(); i++)
{
cout << v.at(i).get_age() << endl;
}
return 0;
}
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
I made an ActiveX control. The control haven't input focus for keyboard, but I want to do something when keyboard event occurs. And now the control can't receive the WM_KEYDOWN or WM_CHAR message. What can I do? Please help me?
stanley
|
|
|
|
|
I have implmented a CAxDialogImpl derived dialog, and have defined the caption for the dialog in the resource editor. However, I would like to change the title bar caption dynamically. Though easily done with standard CDialog derived dialogs, this seems to be an effort with CAxDialogImpl derived dialogs. Anyone have any clues?
|
|
|
|
|
|
Well, I would agree that it should, but its not. The SetWindowText() function is returning success, but the caption remains unchanged. Did I mention that I'm creating this ATL based dialog modally?
"Never play drinking games with coffee"
|
|
|
|