|
I want to subclass some combobox controls on a dialog to handle WM_KEYDOWN msg (to delete contents using DEL key).
1. I`m using CContainedWindow. I use the function:
OnKeyDown(TCHAR nChar, UINT nRepCnt, UINT nFlags) with MSG_WM_KEYDOWN in ALT_MSG_MAP(1).
For one control, it's ok (works fine), but what if I want to subclass more than one and redirect all WM_KEYDOWN msgs to the same function ? How can I tell what control is receiving the message ? The m_hWnd member points to my dialog wnd.
2. I also tried the DDX way, using DDX_CONTROL and defining:
class CCombo: public CWindowImpl<ccombo, ccombobox="">
and defining my controls of this class, but the compiler gives me an error saying that SubclassWindow is not a member of CComboBoxT<class atl::cwindow="">
How can I do it using #1 and what am I doing wrong with #2 ?
Thanks.
|
|
|
|
|
1) See CWindowImpl::GetCurrentMessage() . You'll find the recipient HWND in the MSG-struct, i.e. GetCurrentMessage()->hwnd .
2) That's because CComboBoxT doesn't derive from CWindowImpl which is the template which implements SubclassWindow. CComboBoxT is just a wrapper for an already existing window class, thus it isn't supposed to subclass another class. I never use DDX-stuff, so I wouldn't know how to deal with it. :shrug:
--
Watcha' gonna do, when Hulkamania runs wild on you!?
|
|
|
|
|
Alright, I've managed to get buttons and all that working just fine, but I can't figure out how to get just a bitmap in the toolbar... In the google toolbar, for example, they have that lovely google logo over a button... I'd like that, but without the button. I've even gone so far as to make a button, and make it TB_INDEFINITE (or whatever it is, I'm not looking at my code), but I don't want it greyed out like that. I want it full color, but not clickable at all. I mean, I can have a button, but I don't want it to "click". Any thoughts, anyone?
|
|
|
|
|
I would like to use the substitution capabilities in the ATL server without the output going to the Web. All of the examples that I see have something like: m_HttpResponse << "Hello"; in the handler. I would like to be able to take the output of the handler and use it to build a single string that has all of the sustituitions made. Something like SRF in and HTML out. I have seen CLStencil and that gets me part way but I don't know how to code the handlers so the output is directed to a stream not the WEB.
Thank you.
Kevin Burton
rkevinburton@charter.net
|
|
|
|
|
How can I catch the focus in my ATL control which is put in HTML text in DHTML based IE toolband?
|
|
|
|
|
I'm using an free-threaded in-proc DLL server (written in ATL 7.0) which creates a separate thread for asynchronous I/O. If I terminate the separate thread by an interface command (using a terminate event to signal the thread's WaitForMultipleObjects loop), everything works as expected - the thread terminates, and any subsequent GetExitCodeThread call shows the proper exit code.
However, if I wait for COM to call DllMain with DLL_PROCESS_DETACH and then try to terminate the thread, I find that the tread exits, but a subsequent GetExitCodeThread call will return STILL_ACTIVE, and a WaitForSingleObject(hMyThread, INFINITE) call will hang up forever. It seems as though once the
DLL_PROCESS_DETACH is called, the kernel can no longer see that the thread has exited.
Is this correct behavior? If so, why? I was expecting the kernel could always see the thread's exit.
Thanks for any help,
Richard
|
|
|
|
|
|
Thanks, Tim - that answers it!
- Richard
|
|
|
|
|
Hi!
I have a CFrameWindowImpl-based main frame on Pocket PC 2003 and the newly released WTL. I can not get menu state updating to work using the update ui feature of WTL. I believe the relevant parts of the class definition are these:
class CMainFrame :
public CFrameWindowImpl<CMainFrame>,
public CUpdateUI<CMainFrame>,
public CIdleHandler,
public CMessageFilter
{
public:
DECLARE_FRAME_WND_CLASS(APP_MAINFRAME_CLASS, IDR_MAINFRAME);
BEGIN_UPDATE_UI_MAP(CMainFrame)
UPDATE_ELEMENT(IDM_HIDE_WEEKEND, UPDUI_MENUPOPUP)
END_UPDATE_UI_MAP()
BEGIN_MSG_MAP(CMainFrame)
...
CHAIN_MSG_MAP(CUpdateUI<CMainFrame>)
CHAIN_MSG_MAP(CFrameWindowImpl<CMainFrame>)
END_MSG_MAP()
...
};
In CMainFrame::OnCreate() I then do
...
CMessageLoop* pLoop = _Module.GetMessageLoop();
ASSERT(pLoop);
pLoop->AddMessageFilter(this);
pLoop->AddIdleHandler(this);
UISetCheck(IDM_HIDE_WEEKEND, true, TRUE);
...
which, unfortunately, doesn't check the menu item.
Any ideas what might be goin on here? Did I miss something?
I can see with UIGetState() that UISetCheck() sort of works, since the state includes the checked bits, but the menu item is not updated! No check mark is drawn!
I can set check marks using raw API, but hey, WTL is supposed to do this for me! So, please...
Thanks for _any_ pointers!
/Johann Gerell
--
Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so. (Douglas Adams)
|
|
|
|
|
Funny you mention this. I was baffled today when I noticed that I couldn't disable menu entries using CUpdateUI<>
Maybe there's a bug in the new WTL release.
[edit]I'm not using WTL on a Pocket PC[/edit]
--
In the land of the blind, be king![^]
|
|
|
|
|
Seems as a bug in atlframe.h:
The CUpdateUIBase message map entry for WM_INITMENUPOPUP and its message handler are #ifdef -d off for Windows CE. Remove these #ifdef s and menu ui updating works.
Note: AtlIsOldWindows() needs to be modified to take Windows CE version numbering into account, or a debug break will occur there in debug builds after the #ifdef removal.
--
Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so. (Douglas Adams)
|
|
|
|
|
|
|
You should use basic_string::replace(). MSDN has a sample on how to use it.
|
|
|
|
|
// Copyright(c) 2002 by Kolya Kosenko
void replace_string(string &str, const char *search, const char *repl_value)
{
string::size_type size = char_traits<char>().length(search);
string::size_type repl_value_size = char_traits<char>().length(repl_value);
string::size_type replace_pos = 0;
if(size) {
do {
replace_pos = str.find(search, replace_pos);
if(replace_pos == string::npos) break;
str.replace(replace_pos, size, repl_value);
replace_pos += repl_value_size;
}while(true);
}
}
|
|
|
|
|
I did some docking windows and add some buttons in them. But after when I clicked the button , nothing happened. why?
the is message loop.
DECLARE_WND_CLASS(_T("CSearchDockingWindow"))
BEGIN_MSG_MAP(thisClass)
MESSAGE_HANDLER(WM_CREATE, OnCreate)
MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBkgnd)
MESSAGE_HANDLER(WM_SIZE, OnSize)
MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
COMMAND_ID_HANDLER(ID_SEARCH_PLACE_BTN, OnPlaceBtn)
COMMAND_ID_HANDLER(ID_SEARCH_ATTRIBUTE_BTN, OnAttributeBtn)
COMMAND_ID_HANDLER(ID_SEARCH_START_BTN, OnSearchStartBtn)
COMMAND_ID_HANDLER(ID_SEARCH_STOP_BTN, OnSearchStopBtn)
CHAIN_MSG_MAP(baseClass)
END_MSG_MAP()
LRESULT OnAttributeBtn(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
CSearchAttributeDlg dlg;
dlg.DoModal();
return 0;
}
Please help me, Thank you .
|
|
|
|
|
|
Thank you very much, I finished it. Now it run good.
Freehawk
|
|
|
|
|
I want to call a MFC dialog from the docking window in a WTL project, but it can not be compiled. the message is :
error C2504: 'CDialog' : is not defined.
how to solute it?
Thank you
|
|
|
|
|
You have to add a MFC support to a WTL project. Just create a new WTL project using the wizard and check a checkbox 'Add MFC support' and see what includes were added to stdafx.h file.
|
|
|
|
|
Thank you.
With Daniel's help, I wrote a program in which I added a dialog into a docking window.
Freehawk
|
|
|
|
|
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.
|
|
|
|