Click here to Skip to main content
15,880,956 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to send a message Pin
Hamid_RT9-May-09 0:22
Hamid_RT9-May-09 0:22 
AnswerRe: How to send a message Pin
«_Superman_»9-May-09 4:34
professional«_Superman_»9-May-09 4:34 
QuestionWindow taskbar activation issue [modified] Pin
andrew_dk8-May-09 19:56
andrew_dk8-May-09 19:56 
AnswerRe: Window taskbar activation issue Pin
Stuart Dootson9-May-09 0:37
professionalStuart Dootson9-May-09 0:37 
QuestionHelp creating a help dialog Pin
xzing8-May-09 19:48
xzing8-May-09 19:48 
AnswerRe: Help creating a help dialog Pin
Hamid_RT9-May-09 0:15
Hamid_RT9-May-09 0:15 
AnswerRe: Help creating a help dialog Pin
Stuart Dootson9-May-09 0:22
professionalStuart Dootson9-May-09 0:22 
QuestionText with backspace in Transparent window Pin
gcorrea8-May-09 16:18
gcorrea8-May-09 16:18 
I want to know how I can write text with backspace in a transparent window.

I am using this code but it does not work.


#include <afxwin.h>


//////////////////////////////////////////////////////////////////////////
// CMyFrameWnd
class CMyFrameWnd : public CFrameWnd
{
public:
CMyFrameWnd();

protected:

CString m_Text;
//{{AFX_MSG(CMyFrameWnd)
afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnPaint();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};

BEGIN_MESSAGE_MAP(CMyFrameWnd, CFrameWnd)
//{{AFX_MSG_MAP(CMyFrameWnd)
ON_WM_CHAR()
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

CMyFrameWnd::CMyFrameWnd()
{
//Transparent window
CString strMyClass=AfxRegisterWndClass( NULL, NULL, (HBRUSH) NULL);

Create(strMyClass, _T("Frame Window"));

}

void CMyFrameWnd::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
m_Text += nChar;

if (nChar == VK_BACK)
{
m_Text = m_Text.Left(m_Text.GetLength() - 2);

TRACE("\n%s", m_Text);
}

Invalidate();
}

void CMyFrameWnd::OnPaint()
{
CPaintDC dc (this);

dc.TextOut(0,0,m_Text);
}

//////////////////////////////////////////////////////////////////////////

class CMyApp : public CWinApp
{
public:

CMyApp(){};
virtual BOOL InitInstance();

};

BOOL CMyApp::InitInstance()
{
m_pMainWnd = new CMyFrameWnd();

m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();

return TRUE;
}


CMyApp myApp;


If I use a normal window changing:
CString strMyClass=AfxRegisterWndClass( NULL, NULL, (HBRUSH) NULL);
Create(strMyClass, _T("Frame Window"));
to
Create(NULL, _T("Frame Window"));

backspace work well

Can you give me any idea

Thanks
AnswerRe: Text with backspace in Transparent window Pin
Stuart Dootson9-May-09 0:20
professionalStuart Dootson9-May-09 0:20 
GeneralRe: Text with backspace in Transparent window Pin
gcorrea9-May-09 5:26
gcorrea9-May-09 5:26 
GeneralRe: Text with backspace in Transparent window Pin
Stuart Dootson9-May-09 6:01
professionalStuart Dootson9-May-09 6:01 
GeneralRe: Text with backspace in Transparent window Pin
gcorrea9-May-09 8:19
gcorrea9-May-09 8:19 
GeneralRe: Text with backspace in Transparent window Pin
Stuart Dootson9-May-09 8:30
professionalStuart Dootson9-May-09 8:30 
GeneralRe: Text with backspace in Transparent window Pin
gcorrea9-May-09 9:58
gcorrea9-May-09 9:58 
GeneralRe: Text with backspace in Transparent window Pin
Stuart Dootson9-May-09 10:09
professionalStuart Dootson9-May-09 10:09 
GeneralRe: Text with backspace in Transparent window Pin
gcorrea9-May-09 10:42
gcorrea9-May-09 10:42 
GeneralRe: Text with backspace in Transparent window Pin
Stuart Dootson9-May-09 10:48
professionalStuart Dootson9-May-09 10:48 
GeneralRe: Text with backspace in Transparent window Pin
gcorrea11-May-09 13:09
gcorrea11-May-09 13:09 
GeneralRe: Text with backspace in Transparent window Pin
gcorrea20-May-09 7:29
gcorrea20-May-09 7:29 
QuestionHow To Get Cursor position in Edit Control Pin
jeansea8-May-09 16:03
jeansea8-May-09 16:03 
AnswerRe: How To Get Cursor position in Edit Control Pin
Madhu Nair8-May-09 16:31
Madhu Nair8-May-09 16:31 
Questionipod program Pin
john3468-May-09 12:55
john3468-May-09 12:55 
AnswerRe: ipod program Pin
Electron Shepherd8-May-09 13:46
Electron Shepherd8-May-09 13:46 
AnswerRe: ipod program Pin
bulg8-May-09 16:37
bulg8-May-09 16:37 
QuestionDuplex pipes Pin
HungryHorace8-May-09 12:03
HungryHorace8-May-09 12:03 

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.