|
What version of VS are you using? Because since 7.0 CString was changed to a templated class. So it became possible to use the CString in MFC (which will give you the above problems, if using VS6), and ATL.
For ATL specific project, use the CAtlString class. CString is virtually derived from that, but you can used it in your ATL project.
I Dream of Absolute Zero
|
|
|
|
|
Hi,
Thanks for your response. I am using VS6. I am trying to build ATL COM Service and hence in the AppWizard I am not able to add support from MFC to my workspace. If I want to add MFC to my project how can I do that?
Regards
-- modified at 7:06 Friday 28th April, 2006
|
|
|
|
|
Hi,
I'm creating an ATL Exe Server that wraps an ActiveX(OCX) control inside the exe server. All the methods and events of the ActiveX are mapped to the Exe servers methods and events. I'm having a problem with one of the events fired from the ActiveX control to the Server Exe back to the Client. When I fire the event via the Invoke command it returns an error CO_E_NOTINITIALIZED. The other events fire without any problems. The only thing I can think of, is the event in the ActiveX control that is firing the event is on a seperate thread. Any ideas?
Thanks
|
|
|
|
|
CO_E_NOTINITIALIZED means that CoInitialize , CoInitializeEx or OleInitialize hasn't been called for the thread.
Steve
|
|
|
|
|
Hi Steve,
Do I need to call the CoInitialize in the ActiveX(OCX) thread for that event. I tried that too, I then get the following error.
RPC_E_WRONG_THREAD which translates to "The application called an interface that was marshalled for a different thread." I don't know what to do next. Any ideas?
Thanks
|
|
|
|
|
I suspect you're passing interface pointers between threads without marshalling. In general this can't work as COM has to take the difference in the threading models into account and it does this by setting by proxies and stubs when an interface is marshaled. Threading is complicated.
Steve
|
|
|
|
|
Hi Steve,
Do you know how I can do this between the ActiveX(OCX) and the ATL Exe Server?
Regards,
|
|
|
|
|
how to programming for allow users drag & drop spliter to adjust
control position?
just like windows explorer.
you can adjust position of both left directory tree and right file
details.
and I need add this function in Standard VC++ 6.0 (can't using MFC).
because I need add this in my ATL control.
thanks in advance.
|
|
|
|
|
|
to Mike,
Thanks for your reply. I have read your acticle your provided. this is a class under MFC. can you using it in my ATL (not support MFC)?
Thanks in advance.
|
|
|
|
|
No, it's not an MFC class. The article however is targeted at MFC developers, making the WTL learning curve less steep.
|
|
|
|
|
CSplitterWindow is a WTL class, not MFC, you'll have no trouble using it in an ATL project as long as you add the right WTL includes. See Part 1 and 2 of the series for details on how to set up a WTL project.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
Thank you very much, I will try it later, Now I am coding for other important functions in my project.
|
|
|
|
|
Hi Mike,
I am writing code for add a splitter now.
I downloaded WTL7.1 and setuped it. then add this includes into vc directories.
But, there are many errores happened when I add two include(atlapp.h and atlsplit.h) only.
the following text is error messages
--
D:\WTL71\INCLUDE\atlapp.h(397) : error C2872: 'ATL' : ambiguous symbol
D:\WTL71\INCLUDE\atlapp.h(398) : error C2872: 'ATL' : ambiguous symbol
D:\WTL71\INCLUDE\atlapp.h(596) : error C2872: 'ATL' : ambiguous symbol
D:\WTL71\INCLUDE\atlapp.h(600) : error C2872: 'ATL' : ambiguous symbol
D:\WTL71\INCLUDE\atlapp.h(601) : error C2872: 'ATL' : ambiguous symbol
D:\WTL71\INCLUDE\atlapp.h(604) : error C2872: 'ATL' : ambiguous symbol
D:\WTL71\INCLUDE\atlapp.h(845) : error C2872: 'ATL' : ambiguous symbol
D:\WTL71\INCLUDE\atluser.h(39) : error C2872: 'ATL' : ambiguous symbol
D:\WTL71\INCLUDE\atluser.h(39) : error C2872: 'ATL' : ambiguous symbol
D:\WTL71\INCLUDE\atluser.h(57) : error C2872: 'ATL' : ambiguous symbol
D:\WTL71\INCLUDE\atluser.h(82) : error C2872: 'ATL' : ambiguous symbol
D:\WTL71\INCLUDE\atluser.h(205) : error C2872: 'ATL' : ambiguous symbol
D:\WTL71\INCLUDE\atluser.h(490) : see reference to class template instantiation 'WTL::CMenuT<t_bmanaged>' being compiled
D:\WTL71\INCLUDE\atlgdi.h(78) : error C2872: 'ATL' : ambiguous symbol
D:\WTL71\INCLUDE\atlgdi.h(86) : error C2872: 'ATL' : ambiguous symbol
D:\WTL71\INCLUDE\atlgdi.h(88) : error C2872: 'ATL' : ambiguous symbol
D:\WTL71\INCLUDE\atlgdi.h(528) : error C2872: 'ATL' : ambiguous symbol
D:\WTL71\INCLUDE\atlgdi.h(682) : see reference to class template instantiation 'WTL::CBitmapT<t_bmanaged>' being compiled
D:\WTL71\INCLUDE\atlsplit.h(824) : error C2872: 'ATL' : ambiguous symbol
D:\WTL71\INCLUDE\atlsplit.h(852) : see reference to class template instantiation 'WTL::CSplitterWindowImpl<t,t_bvertical,tbase,twintraits>' being compiled
D:\WTL71\INCLUDE\atlsplit.h(823) : error C2872: 'ATL' : ambiguous symbol
D:\WTL71\INCLUDE\atlsplit.h(863) : see reference to class template instantiation 'WTL::CSplitterWindowT<t_bvertical>' being compiled
D:\WTL71\INCLUDE\atlsplit.h(823) : error C2872: 'ATL' : ambiguous symbol
D:\WTL71\INCLUDE\atlsplit.h(863) : see reference to class template instantiation 'WTL::CSplitterWindowT<t_bvertical>' being compiled
E:\Workspace_synviz\SynViz1.1\SynVizRGGantt\StdAfx.cpp(8) : error C2856: #pragma hdrstop cannot be inside an #if block
E:\Workspace_synviz\SynViz1.1\SynVizRGGantt\StdAfx.cpp(9) : error C2856: #pragma hdrstop cannot be inside an #if block
Error executing cl.exe.
--
ATL + WTL these confuse me deeply.
Thanks in advance.
|
|
|
|
|
Just a thought, have you tried Build->Rebuild All? That seems to fix some problems I've had in the past...
[EDIT]Are you including these files in stdafx.h?[/EDIT]
- S
50 cups of coffee and you know it's on!
-- modified at 2:23 Thursday 27th April, 2006
|
|
|
|
|
Hi Steve Echols,
Thanks for your reply.
Steve Echols wrote: Just a thought, have you tried Build->Rebuild All? That seems to fix some problems I've had in the past...
--
I alway press F7 key from building my project. F7 is short key for ‘Rebuild ALL’.
Steve Echols wrote: Are you including these files in stdafx.h?
--
yes. I add these include in 'stdafx.h' file.
|
|
|
|
|
ah, I forgot to mention that when you use WTL and MFC in the same project, you need to #define _WTL_NO_AUTOMATIC_NAMESPACE before the WTL headers because some classes in MFC and WTL have the same name (like CString ).
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
Hi Mike,
I changed the code like you told me.
but, the system still output error messages, just like I didn't add [#define _WTL_NO_AUTOMATIC_NAMESPACE ] before the WTL headers.
--
C:\WTL71\INCLUDE\atlapp.h(396) : error C2872: 'ATL' : ambiguous symbol
--> Source Code : ATL::CSimpleArray<CMessageFilter*> m_aMsgFilter;
...
Michael Dunn wrote: because some classes in MFC and WTL have the same name (like CString).
I am developing a ATL com without MFC. does it something wrong?
Thanks for your help.
|
|
|
|
|
Hi.
----------------------------------------
AtlWin.h some code about unsubclass window:
LONG_PTR pfnWndProc = ::GetWindowLongPtr(pThis->m_hWnd, GWLP_WNDPROC);<br />
lRes = pThis->DefWindowProc(uMsg, wParam, lParam);<br />
if(pThis->m_pfnSuperWindowProc != ::DefWindowProc && ::GetWindowLongPtr(pThis->m_hWnd, GWLP_WNDPROC) == pfnWndProc)<br />
::SetWindowLongPtr(pThis->m_hWnd, GWLP_WNDPROC, (LONG_PTR)pThis->m_pfnSuperWindowProc);<br />
#if (_ATL_VER >= 0x0700)<br />
pThis->m_dwState |= WINSTATE_DESTROYED;<br />
#else // !(_ATL_VER >= 0x0700)<br />
HWND hWnd = pThis->m_hWnd;<br />
pThis->m_hWnd = NULL;<br />
pThis->OnFinalMessage(hWnd);<br />
#endif // !(_ATL_VER >= 0x0700)
---------------------------------------
WINCORE.CPP some code about unsubclasswindow
WNDPROC pfnWndProc = WNDPROC(GetWindowLongPtr(m_hWnd, GWLP_WNDPROC));<br />
Default();<br />
if (WNDPROC(GetWindowLongPtr(m_hWnd, GWLP_WNDPROC)) == pfnWndProc)<br />
{<br />
WNDPROC pfnSuper = *GetSuperWndProcAddr();<br />
if (pfnSuper != NULL)<br />
SetWindowLongPtr(m_hWnd, GWLP_WNDPROC, INT_PTR(pfnSuper));<br />
}<br />
Detach();
----------------------------------------------------
1.Why in ATL when "pThis->m_pfnSuperWindowProc == ::DefWindowProc " not need restore old wndproc, but in MFC without this compare?
2.Now i write subclass window(mulriple, like DefWindowProc -> My subclass -> CWnd subclass(CWindow subclass) or DefWindowProc -> CWnd subclass(CWindow subclass) -> my subclass), and can safe unsubclass window. which above code i can modification and use in my code?
Thanks.
|
|
|
|
|
This is more of a Win32 question than a WTL Q, but I don't see a Win32 message board.
I have "Win32 Programming" by Rector & Newcomer which has been great (I bought it a year or two after it was published [1997], still quite useful).
Unfortunately it doesn't cover a lot of the common controls, most notably the listview and tab control. I am really looking for an in-depth book or article on common controls behavior & best programming practices. Built-in MSVC help / MSDN stuff just don't cut it & are both woefully inadequate (just about as useful for programming as a dictionary would be to tell you how to write sentences).
any suggestions? Right now I am going out of my mind trying to deal with MSDN docs.
--Jason
|
|
|
|
|
Actually the 'Visual C++ / MFC' forum would probably generate more answers. I can not recommend any books, because every book I have seen falls short on this subject, even books that are supposed to cover the subject. The best source is the MSDN, even though their examples are woefully inadequate. The next best source is the Web, most sights will just regurgitate what the MSDN says but some of them will actually give you new information. The last source is articles on programs that actually require the control that you need information on, you can find these at sights like CodeProject (CP).
Finding information on the Web is an art form and is all about how you ask the question.
INTP
Every thing is relative...
|
|
|
|
|
What methods do people here use for case-insensitive comparisons of STL strings? The std::wstring compare method is case-sensitive, and I want to use something portable if possible. Currently I use _wcsicmp(str1.c_str(), str2.c_str()) but this doesn't "feel" right...
The Rob Blog Google Talk: robert.caldecott
|
|
|
|
|
depends
derive from wstring. replace wcsicmp()?
Kuphryn
|
|
|
|
|
Robert Edward Caldecott wrote: What methods do people here use for case-insensitive comparisons of STL strings?
They ask the Guru[^]
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
Robert Edward Caldecott wrote: but this doesn't "feel" right
Nor to me, but that's still what I use
|
|
|
|