Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I Set the Title Bar to a variable? (Specifically, String Table)

Status
Not open for further replies.

nytyme

Programmer
Jan 8, 2001
19
US
I've been working with C/C++ off and on for serveral years and am self taught. I never have much time to learn, so I became good at finding answers on the web and in Books. However, the answers I found are all similar and are not working.

I am using M$ Visual C++ 6.0 using MFC for the first time in a real application.
I have the default setup chosen.

I want to allow my Title Bar to use a variable I created in the String Table.
I can't figure out how to accomplish this.
The code samples I found are all similar to:
CWnd * pWnd = (Cwnd *) GetDlgItem (IDC_EDIT);
pWnd->SetWindowText ("TEST");
however this doesn't work:
error C2660: 'GetDlgItem' : function does not take 1 parameters

i tried another posts solution:
HWND *pHWnd;
Wnd* pWnd = GetDlgItem(*pHWnd,IDD_COOKIELOGIN_DIALOG);
pWnd->SetWindowText(_T("Test"));
error C2440: 'initializing' : cannot convert from 'struct HWND__ *' to 'class CWnd *'

and variations:
HWND *pHWnd;
Wnd* pWnd = GetDlgItem(pHWnd,IDD_COOKIELOGIN_DIALOG);
pWnd->SetWindowText(_T("Test"));
error C2664: 'GetDlgItem' : cannot convert parameter 1 from 'struct HWND__ ** ' to 'struct HWND__ *'

i mixed the two:
HWND *pHWnd;
Wnd* pWnd =(CWnd *) GetDlgItem(pHWnd,IDD_COOKIELOGIN_DIALOG);
pWnd->SetWindowText(_T("Test"));
error C2664: 'GetDlgItem' : cannot convert parameter 1 from 'struct HWND__ ** ' to 'struct HWND__ *'

HWND *pHWnd;
Wnd* pWnd =(CWnd *) GetDlgItem(*pHWnd,IDD_COOKIELOGIN_DIALOG);
pWnd->SetWindowText(_T("Test"));
warning C4700: local variable 'pHWnd' used without having been initialized
when i try to run it crashes. i've even tried using the dereferencing it with "&".

can someone please help?
I know i'm not initializing the *pHWnd, that's what GetDlgItem is supposed to do... isn't it?

Thank you.
 
in WinAPI is:

HWND hWnd;

/////////
//getting in some way the hWnd from somewhere
....
///////////


HWND hDlg = GetDlgItem(hWnd,IDD_COOKIELOGIN_DIALOG);
SetWindowText(hWnd,_T("Test"));

The same in MFC:

CWnd *pWnd;
/////////
//getting in some way the pWnd from somewhere
....
///////////

CWnd* pDlg =(CWnd *) pWnd->GetDlgItem(IDD_COOKIELOGIN_DIALOG);
pDlg->SetWindowText(_T("Test"));
John Fill
1c.bmp


ivfmd@mail.md
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top