Click here to Skip to main content
15,922,309 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
Questioncan i set the height of the item in CListViewCtrl and add a image for every item? Pin
HeartFriend2-Nov-03 21:07
HeartFriend2-Nov-03 21:07 
AnswerRe: can i set the height of the item in CListViewCtrl and add a image for every item? Pin
Dudi Avramov3-Nov-03 4:26
Dudi Avramov3-Nov-03 4:26 
AnswerRe: can i set the height of the item in CListViewCtrl and add a image for every item? Pin
Mil104-Nov-03 2:46
Mil104-Nov-03 2:46 
QuestionOLEDB issue new with MDAC 2.8? Pin
Steve S31-Oct-03 1:37
Steve S31-Oct-03 1:37 
GeneralDHTM binary behavior Pin
jackalwisdom30-Oct-03 22:38
jackalwisdom30-Oct-03 22:38 
GeneralReference to object using handle Pin
Member 60189830-Oct-03 18:24
Member 60189830-Oct-03 18:24 
GeneralContext Menu on web page shown ... Pin
byblostas30-Oct-03 11:11
byblostas30-Oct-03 11:11 
GeneralGetting notification on <CR> from Edit control Pin
janman30-Oct-03 0:49
janman30-Oct-03 0:49 
I have made a dialog-based WTL application in VS.NET.
I'm trying to make one edit window act as a command prompt. I would therefore like to receive a notification in the parent dialog when the user presses carriage return in the edit control.

I have tried to use the example by Kristian Lippert in his article Subclassing controls in ATL dialogs using WTL[^] but with no luck. It seems that the sub-class does not receive the WM_KEYDOWN or WM_CHAR at all (does receive WM_CHAR when typing some text).

First I thought that I could just use the IDOK-notification and use the control ID or the control hWnd parameters of the notification. But they are "empty" no matter which control has the focus when CR is pressed.

Any help appreciated.

Below is my control-template:


#define EN_GOT_RETURN         0x1000<br />
<br />
template <class T><br />
class CEditEnterNotificationT : public CWindowImpl<CEditEnterNotificationT<T> , CEdit><br />
{<br />
public:<br />
    BEGIN_MSG_MAP(CEditEnterNotificationT< T >)<br />
        TRACEMSG("CEditEnterNotification");<br />
        MESSAGE_HANDLER(WM_CHAR, OnChar)<br />
        MESSAGE_HANDLER(WM_KEYDOWN, OnKeyDown)<br />
    END_MSG_MAP()<br />
<br />
    CEditEnterNotificationT(HWND hWnd = NULL){ }<br />
<br />
    CEditEnterNotificationT< T >& operator=(HWND hWnd)<br />
    {<br />
        m_hWnd = hWnd;<br />
        return *this;<br />
    }<br />
<br />
    LRESULT OnChar(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)<br />
    {<br />
        //ignore without a beep<br />
        switch (wParam)<br />
        {<br />
            case '\r': //Carriage return<br />
                ATLTRACE("WM_CHAR - CR\n");<br />
                return 0;<br />
                break;<br />
        }<br />
        return DefWindowProc(uMsg, wParam, lParam);<br />
    }<br />
<br />
    LRESULT OnKeyDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)<br />
    {<br />
        switch (wParam)<br />
        {<br />
            case VK_RETURN:<br />
                ATLTRACE("WM_KEYDOWN - CR\n");<br />
                ::PostMessage (m_parent, WM_COMMAND, MAKELONG(EN_GOT_RETURN, this->m_dlgItem), LPARAM(this->m_hWnd));<br />
                bHandled = TRUE;<br />
                return FALSE;<br />
            }<br />
            return DefWindowProc(uMsg, wParam, lParam);<br />
        }<br />
<br />
    BOOL AttachToDlgItem(HWND parent, UINT dlgID)<br />
    {<br />
        m_dlgItem = dlgID;<br />
        m_parent = parent;<br />
        HWND hWnd = ::GetDlgItem(parent,dlgID);<br />
        return SubclassWindow(hWnd);<br />
    }<br />
private:<br />
        UINT m_dlgItem;<br />
        HWND m_parent;<br />
};<br />
<br />
typedef CEditEnterNotificationT<CWindow>	CEditEnterNotification;<br />

GeneralRe: Getting notification on &lt;CR&gt; from Edit control Pin
umeca741-Nov-03 1:29
umeca741-Nov-03 1:29 
GeneralRe: Getting notification on &lt;CR&gt; from Edit control Pin
janman1-Nov-03 22:42
janman1-Nov-03 22:42 
GeneralRe: Getting notification on &lt;CR&gt; from Edit control Pin
Simon Cooke4-Nov-03 12:29
Simon Cooke4-Nov-03 12:29 
GeneralATL NT Service module 49,7 bug Pin
User 3842129-Oct-03 21:33
User 3842129-Oct-03 21:33 
GeneralWindowing in ATL Pin
Sakusys29-Oct-03 16:57
Sakusys29-Oct-03 16:57 
GeneralRe: Windowing in ATL Pin
Michael Dunn29-Oct-03 19:14
sitebuilderMichael Dunn29-Oct-03 19:14 
GeneralCFile; Pin
Bo Hunter24-Oct-03 17:53
Bo Hunter24-Oct-03 17:53 
GeneralRe: CFile; Pin
Michael Dunn24-Oct-03 19:05
sitebuilderMichael Dunn24-Oct-03 19:05 
GeneralDirectX and ATL/WTL/STL Pin
StartingProgrammer23-Oct-03 22:30
StartingProgrammer23-Oct-03 22:30 
QuestionHow can I manipulate BSTR typed string in ATL3COM? Pin
Atif Bashir22-Oct-03 5:02
Atif Bashir22-Oct-03 5:02 
AnswerRe: How can I manipulate BSTR typed string in ATL3COM? Pin
tareqsiraj22-Oct-03 8:19
tareqsiraj22-Oct-03 8:19 
AnswerRe: How can I manipulate BSTR typed string in ATL3COM? Pin
Michael Dunn22-Oct-03 12:44
sitebuilderMichael Dunn22-Oct-03 12:44 
QuestionHow to download a file without common file download dialog Pin
yu-yu21-Oct-03 22:46
yu-yu21-Oct-03 22:46 
AnswerRe: How to download a file without common file download dialog Pin
Michael Dunn22-Oct-03 12:47
sitebuilderMichael Dunn22-Oct-03 12:47 
GeneralRe: How to download a file without common file download dialog Pin
yu-yu22-Oct-03 14:28
yu-yu22-Oct-03 14:28 
GeneralRe: How to download a file without common file download dialog Pin
Michael Dunn22-Oct-03 15:25
sitebuilderMichael Dunn22-Oct-03 15:25 
GeneralRe: How to download a file without common file download dialog Pin
yu-yu22-Oct-03 16:07
yu-yu22-Oct-03 16:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.