|
Hello.
Thank you for this reply.
BTW, where is the checkbox 'Add MFC support' ?
I created a new WTL project but not the check box displayed.
-Freehawk
|
|
|
|
|
Ooops! Sorry, my fault. It was in WTL wizard that was supplied with WTL 3.0.
|
|
|
|
|
Hello.
Thank you for the reply.
Now I am using WTL7.1, is there anything like "Add MFC support"?
-Freehawk
|
|
|
|
|
If you are using VC7 create a test ATL project, go to application settings (part of the project wizard), uncheck Attributed checkbox, select DLL server type, check Support MFC checkbox, look at stdafx.h file and copy all afx*.h files to your projects.
It should do it.
Good luck,
Igor.
|
|
|
|
|
Hello
I did a test WTL project as the following
1.Open VC.net 2003 and create a new project(select "ATL/WTL Application Wizard")
but I can not find Attributed checkbox.where is it?
-Freehawk
|
|
|
|
|
Not ATL/WTL project, select a template called "ATL Project". Click OK. You'll see "ATL Project Wizard" dialog. By default an "Overview" tab is opened, switch to "Application Settings" tab.
There you'll find it. (I'm also using VC 2003, I just did it).
Good luck,
Igor.
|
|
|
|
|
Hello.
Thank you for reply so fast.
I will try it. In fact, I am using VC6.0 and WTL7.1 to make my project. And in the WTL project, I want to use MFC, If done as you said, can it be realized?
-Freehawk
|
|
|
|
|
In VC6 you should select ATL COM project type, click OK. On the next page select DLL server type, check Support MFC checkbox, finish creating a project and then look at stdafx.h file.
Good luck,
Igor.
|
|
|
|
|
Hi,
Can anyone tell me if there is a limit of 2^15 (32768) items that can be sorted in a list using the list function sort()?
I am trying the following code in Visual C++ 6 on Windows 2000.
std::list<int> TestList;
for (int i=0; i<40000; i++)
TestList.push_back(i);
int nSize = TestList.size();
test.sort();
int nSize2 = TestList.size();
nSize is 40000.
nSize2 is 7232.
The difference between the two values is always 32768.
Less than 32768 values sorts fine.
NOTE: max_size() returns a value of > 100000000.
I could not find any information that mentions this limit but it is clearly there.
Can anyone suggest an alternative?
|
|
|
|
|
It looks like there is a bug in the list sort routine which ships with VC 6.0.
Looking at the source in <list>, it appears that the internal array used to process the merge sorts is not being handled properly when the array is full.
You might be able to find a fix for this by getting an upgrade to the STL that you use. This isn't a bad idea, as there are a number of problems with the STL that ships with VC 6.0.
For a quick fix, you could patch the <list> header file so that the sort works correctly. Or you could write your own sort routine which fixes the problem.
(just glancing at it, it appears that the sort could be fixed by changing the following sequence:
<br />
if (_I == _MAXN)<br />
_A[_I].merge(_X);<br />
else<br />
{_A[_I].swap(_X);<br />
if (_I == _N)<br />
++N; }}<br />
to the following:
<br />
if (_I == _MAXN)<br />
_A[_I].merge(_X);<br />
else<br />
_A[_I].swap(_X);<br />
if (_I == _N)<br />
++N; }<br />
Note: I only briefly tested this, but it appears to work.
The other choice (if you are going change <list>) is to increase the const _MAXN to a larger number, so that the temporary array can fit more elements. Each increase of this number doubles the size of the list that can be sorted. By setting this to 32, it should be able to handle any size list that you could create.
Best regards,
John
|
|
|
|
|
This is a known bug. See the following page for how to patch your VC6 STL headers for a number of known bugs:
http://www.dinkumware.com/vc_fixes.html[^]
In particular, see the "Fix to <list>" section.
- Mike
|
|
|
|
|
I have developped a add-in explorer bar for Internet Explorer. In the DllRegisterServer() function I have also entering the class-id of the toolbar to the registry key...
HKEY_LOCAL_MACHINE/Software/Microsoft/Internet Explorer/ Toolbar/{Toolbar Class ID}
But the toolbar is not visible in the Internet Explorer right after registration. After registering the dll, when I open a new instance of IE the toolbar doesn't appears by default. I have to explicitely check going to IE's View/Toolbar menu thereafter. But with many other third party toolbars like Yahoo, Google etc. the toolbar appears by default for the first time.
Can any one pls tell me where am I really missing out? Is there any other registry entry needed to make the toolbar default visible? I have already compared with Google toolbar registry entries with that of mine. They are almost same.Or do I have code any thing exclusive for that?
Thanx in advance for a positive reply from any friend in need around the globe.
|
|
|
|
|
|
I am currently attempting to localize a dialog for Japanese. This dialog inherits off of CAxDialogImpl. The seemingly simple way to localize this was to set the _Module.hinstResource to our language DLL. This seems to find the dialog and seems to load it. It does call _DialogSplitHelper::SplitDialogTemplate which finds all the controls and builds the template. However when it proceeds to call DialogBoxIndirectParam it returns a -1. Called GetLastError and of course it returns "Operation Completed Successfully".
Then I tried to modify the dialog to use our internal resources. I did that by overriding DoModal and creating a Modal Pump. This allows me to use our internal dialog creation tools that are designed to load from our Japanese language DLL and if that fails load from the embedded English resources. However the Japanese dialog fails to load, and then StartWindowProc asserts when trying to load the English dialog. This is because _Module.ExtractCreateWndData() returns a NULL. (NOTE: I do AddCreateWndData() in the DoModal call). Also if set the application to load English only, then this dialog still doesn't come up but does not assert in StartWindowProc.
Anybody seen this before and solved it? Anybody have any articles on localizing CAxDialogImpl()?
All help is helpful, and appreciated...
Thanks,
Brian
If you start a fire for a man, he will be warm for a day. If you start that same man on fire, he will be warm for the rest of his life.
|
|
|
|
|
|
|
Can someone check their VC++ 7 compiler whether it accepts multiple entries into a map with duplicate keys?
Maps are NOT supposed to accept duplicate keys!! This is a feature reserved only for multimaps.
In VC++ 6, multiple entries into a map with duplicate keys, are accepted.
Thanks.
William
Fortes in fide et opere!
|
|
|
|
|
WREY wrote:
In VC++ 6, multiple entries into a map with duplicate keys, are accepted.
Could you give a testcase where this happens? The following test program gives the appropriate behavior in VC6:
#include <map>
#include <iostream>
using namespace std;
typedef map<int,int> items_t;
int main(int argc, char* argv[]) {
items_t items;
if (items.insert(items_t::value_type(1,2)).second) {
cout << "First insert OK!" << endl;
}
if (items.insert(items_t::value_type(1,3)).second) {
cout << "Second insert OK (bad!)" << endl;
}
cout << "Value for key 1: " << items[1];
return 0;
}
- Mike
|
|
|
|
|
Thanks for replying.
In your sample, you are doing "items.insert(items_t::value_type(1,2)).second", which is the value of the second half of the "pair<const K, V>" format. Your sample, in essence, simply changes the value of that second half from 2, to 3.
I'm talking about the key itself,
items.insert(items_t::value_type(1).first, items_t::value_type(99).second); It doesn't matter what integer value is placed in "second" (i.e. as much as "int" can hold). "second" is not the key; "first" is.
William
Fortes in fide et opere!
|
|
|
|
|
items.insert(items_t::value_type(1,3)).second Take a closer look. map::insert(value_type) returns a pair which is not the map::value_type . Instead, the second element of the pair is a bool which indicates success or failure. In this case, I'm trying to insert a new element into the map with the same key as the first element (1 ). It fails, since the key 1 already exists in the map.
Are you referring to retrieving a reference to a map element, then modifying the key? The STL specifies that the key for an associative container should be immutable, but some implementions do not enforce this (it may be possible to change the key in such a way as to not break the strict weak ordering or multiplicity rules -- the STL itself cannot determine this).
- Mike
|
|
|
|
|
std::map can't hold more than one equivalent key+data pair. However, if you insert an equivalent key+data pair, the old key+data pair is replaced with the new one.
--
In the land of the blind, be king![^]
|
|
|
|
|
I have a COM object I'm using in an ATL project. One of the exposed COM interfaces is called IWTOnLoad. According to the COM object's documentation, a class implements the IWTOnLoad by having a method in the class called .onLoadComplete. How would I go about implementing this IWTOnLoad COM interface in an ATL project?
The graveyards are filled with indispensible men.
|
|
|
|
|
I'm assuming you're not using attributed COM-stuff (VS.NET-specific). I don't know anything about attributed COM-programming and I really don't care to know anything about it, because I think that's a bastardization. (Goodie, I got to bitch/vent a little )
Add a , public IWTonLoad in the list of inheritances (sp?) for the implementing class.
Then add a COM_INTERFACE_ENTRY(IWTonLoad) in the BEGIN_COM_MAP map.
Then you may (optionally) add the interface to the array of "supported" interfaces in the ISupportsErrorInfo::InterfaceSupportsErrorInfo(REFIID riid) method. It depends on if you implement ISupportErrorInfo and if you use the ErrorInfo features in COM.
Then you add the method using the STDMETHOD macro as all the "other methods" are declared.
Optionally, you can also add a interface IWTonLoad in the corresponding coclass in your idl-file if you want to make the interface visible in the type library.
That should be pretty much it. You're new to ATL-programming, aren't you?
--
20 eyes in my head, they're all the same![^]
|
|
|
|
|
Hi. I am having some trouble with the Web Browser 2 control. I am able to display my html file within a window in my program, but can't print it. I am using ATL only.
The Nagivate() method has no errors but afterwards the ready state is always READYSTATE_LOADING, even some time after the browser control displays the html. When I try to print with the ExecWB function, I get error "0x80040100 Trying to revoke a drop target that has not been registered". I think there may be problem with the way the object is created?
Here is my code:
<br />
#include exdisp.h
#include exdispid.h
#include mshtmcid.h
<br />
CAxWindow wndIE;<br />
RECT rc = {0,200,800,700};<br />
HWND hIEWnd = wndIE.Create(hWnd, rc, _T(""), WS_CHILD | WS_VISIBLE | WS_THICKFRAME);<br />
CComPtr<IUnknown> punkCtrl;<br />
CComQIPtr<IWebBrowser2> pBrowserApp;<br />
<br />
wndIE.CreateControlEx ( L"{8856F961-340A-11D0-A96B-00C04FD705A2}", NULL, NULL, &punkCtrl );<br />
pBrowserApp = punkCtrl;<br />
<br />
if (pBrowserApp)<br />
{<br />
CComVariant vEmpty;<br />
hr = pBrowserApp->Navigate ( CComBSTR("c:\\report.html"), &vEmpty, &vEmpty, &vEmpty, &vEmpty );<br />
READYSTATE ReadyState;<br />
hr = pBrowserApp->get_ReadyState(&ReadyState);<br />
Sleep(3000);<br />
hr = pBrowserApp->get_ReadyState(&ReadyState);<br />
<br />
hr = pBrowserApp->ExecWB((OLECMDID)IDM_PRINT, (OLECMDEXECOPT)PRINT_DONTBOTHERUSER, NULL, NULL);<br />
}<br />
Any advice or comments would be greatly appreciated.
Thanks, Joanne
|
|
|
|
|
Update Internet Explorer up to last version. Can will help
|
|
|
|