Click here to Skip to main content
16,005,281 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow to show the 'Privacy Report' dialog in CHtmlView Based Application? Pin
Tcpip20053-Sep-06 16:22
Tcpip20053-Sep-06 16:22 
QuestionGDI+ Bitmap Class new operator. Pin
mostafa_pasha3-Sep-06 10:37
mostafa_pasha3-Sep-06 10:37 
AnswerRe: GDI+ Bitmap Class new operator. Pin
Justin Tay3-Sep-06 13:06
Justin Tay3-Sep-06 13:06 
QuestionWhen debugging from VS it works, when running from explorer not Pin
lucki_luke3-Sep-06 9:46
lucki_luke3-Sep-06 9:46 
AnswerRe: When debugging from VS it works, when running from explorer not Pin
MayankT3-Sep-06 17:40
MayankT3-Sep-06 17:40 
GeneralRe: When debugging from VS it works, when running from explorer not Pin
lucki_luke4-Sep-06 9:40
lucki_luke4-Sep-06 9:40 
GeneralRe: When debugging from VS it works, when running from explorer not Pin
Blake Miller6-Sep-06 12:11
Blake Miller6-Sep-06 12:11 
QuestionMFC CString's LoadString and VC++ 8.0 Problems Pin
Jon68z3-Sep-06 9:21
Jon68z3-Sep-06 9:21 
Hi,

I'm having difficulties using CString's LoadString under VC++ 8.0. I'm not sure what to make of it. I'm attempting to load a string from resources and getting back an incomplete string, e.g. "This application is registered to %1 %2For use on the computer named %3 only." and getting back, "This application is registered to %1????". The '?' are inserted into the string. I'm a total newbee to VC++ 8.0.

It seems to be random, cause loading strings from the resource seems to work correctly in the instances above the lines of code before calling the last LoadString.

e.g.
BOOL CAboutDlg::OnInitDialog()
{
CDialog::OnInitDialog();

// TODO: Add extra initialization here
CString cs0, cs1, cs2, cs3, cs4;

DWORD dwSizeUserName, dwSizeComputerName, dwError;

char szUserName[MAX_COMPUTERNAME_LENGTH + 1];
char szComputerName[MAX_COMPUTERNAME_LENGTH + 1];

dwSizeUserName = MAX_COMPUTERNAME_LENGTH + 1;
dwSizeComputerName = MAX_COMPUTERNAME_LENGTH + 1;

szUserName[0]=0;
szComputerName[0]=0;

m_nAppIcon.SetIcon(::LoadIcon(theApp.m_hInstance, MAKEINTRESOURCE(IDR_MAINFRAME)) );

cs0.Empty();
cs0.LoadString(AFX_IDS_APP_TITLE);

AfxSetWindowText(::GetDlgItem(this->m_hWnd, IDC_STATICTEXTAPPNAME), cs0);

cs0.Empty();
cs1.Empty();
cs2.Empty();
cs3.Empty();
cs4.Empty();

cs1.LoadString(IDS_STRABOUTAPPINFO);
// IDS_STRABOUTAPPINFO =
// File Version: %s\nProduct Version: %s\nApplication Info: %s\n\n%s by
// %s. All Rights Reserved.

cs2.LoadString(IDS_FILEINFOCOMMENTS);
// IDS_FILEINFOCOMMENTS = Comments

cs3.LoadString(IDS_FILEINFOLEGALCOPYRIGHT);
// IDS_FILEINFOLEGALCOPYRIGHT = LegalCopyRight

cs4.LoadString(IDS_FILEINFOCOMPANYNAME);
// IDS_FILEINFOCOMPANYNAME = CompanyName

cs0.Format( cs1,
CAppUtilitylFunctions::GetFileVersionX(),
CAppUtilitylFunctions::GetProductVersionX(),
CAppUtilitylFunctions::GetVersionInfo(NULL, cs2),
CAppUtilitylFunctions::GetVersionInfo(NULL, cs3),
CAppUtilitylFunctions::GetVersionInfo(NULL, cs4));

AfxSetWindowText(::GetDlgItem(this->m_hWnd, IDC_STATICTEXT1), cs0);

if( !(::GetUserName(szUserName, &dwSizeUserName)) )
{
dwError = GetLastError ();
}
if( !(::GetComputerName(szComputerName, &dwSizeComputerName)) )
{
dwError = GetLastError ();
}
else
{
cs0.Empty();
cs1.Empty();

// THIS LOAD FAILS TO LOAD ALL OF THE STRING IN THE RESOURCE
cs1.LoadString(IDS_ABOUTAPPINFO);
// IDS_ABOUTAPPINFO =
// This application is registered to %1 %2For use on the computer
// named %3 only.


cs0.FormatMessage( cs1,
szUserName,
"\n",
szComputerName);

AfxSetWindowText(::GetDlgItem(this->m_hWnd, IDC_STATICTEXT2), cs0);
}

return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}

Cry | :(( Can someone shed some light on this for me? I'm thinking that it must have something to do with project settings....

Thanks!

Jon68z
QuestionRe: MFC CString's LoadString and VC++ 8.0 Problems Pin
prasad_som3-Sep-06 22:56
prasad_som3-Sep-06 22:56 
AnswerRe: MFC CString's LoadString and VC++ 8.0 Problems Pin
Jon68z3-Sep-06 23:32
Jon68z3-Sep-06 23:32 
GeneralRe: MFC CString's LoadString and VC++ 8.0 Problems Pin
prasad_som4-Sep-06 0:05
prasad_som4-Sep-06 0:05 
GeneralRe: MFC CString's LoadString and VC++ 8.0 Problems Pin
Jon68z4-Sep-06 0:33
Jon68z4-Sep-06 0:33 
QuestionRe: MFC CString's LoadString and VC++ 8.0 Problems Pin
Jon68z4-Sep-06 0:50
Jon68z4-Sep-06 0:50 
AnswerRe: MFC CString's LoadString and VC++ 8.0 Problems Pin
prasad_som4-Sep-06 1:51
prasad_som4-Sep-06 1:51 
QuestionCPropertySheet Pin
ftsOne3-Sep-06 9:10
ftsOne3-Sep-06 9:10 
QuestionCertification Pin
messages3-Sep-06 8:12
messages3-Sep-06 8:12 
AnswerRe: Certification Pin
Waldermort3-Sep-06 8:19
Waldermort3-Sep-06 8:19 
GeneralRe: Certification Pin
messages3-Sep-06 8:33
messages3-Sep-06 8:33 
QuestionError Pin
messages3-Sep-06 8:04
messages3-Sep-06 8:04 
AnswerRe: Error Pin
Waldermort3-Sep-06 8:20
Waldermort3-Sep-06 8:20 
GeneralRe: Error Pin
messages3-Sep-06 8:33
messages3-Sep-06 8:33 
QuestionHow to get a pointer of the active view? Pin
yummi3-Sep-06 7:45
yummi3-Sep-06 7:45 
AnswerRe: How to get a pointer of the active view? Pin
Nader Elshehabi3-Sep-06 12:11
Nader Elshehabi3-Sep-06 12:11 
GeneralRe: How to get a pointer of the active view? Pin
yummi3-Sep-06 22:50
yummi3-Sep-06 22:50 
GeneralRe: How to get a pointer of the active view? Pin
prasad_som4-Sep-06 0:34
prasad_som4-Sep-06 0:34 

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.