|
After reading MSDN documentation I couldn't find anything. Do you know how to do that?
-Saurabh
|
|
|
|
|
You can get a handle to a messagebox window and then you can change text of it.
|
|
|
|
|
MessageBox is a modal window so it blocks the calling thread. So once you call MessageBox then unless you dismiss it nothing else can be done.
-Saurabh
|
|
|
|
|
I saw my files it was on the C#.
|
|
|
|
|
I hate to do this but it is not going to work in C# as well. System.Windows.Forms.MessageBox mimics MessageBox in windows. So there is no option to use just the Cancel button.
-Saurabh
|
|
|
|
|
Saurabh.Garg wrote: I hate to do this but it is not going to work in C#
Why c# is good I think its easy to learn anyway maybe you like to see Dissecting the MessageBox[^].
|
|
|
|
|
I never asked why C# is good!!! We were talking about MessageBox. I have seen that article and it create a new class for doing custom stuff. It has got nothing to do with MessageBox WinAPI provides.
-Saurabh
|
|
|
|
|
I don't think it is possible with MessabeBox. You can simple create your own dialog and add a single cancel button.
-Saurabh
|
|
|
|
|
Thanks Guys,
I created a new dialog to work with cancel button.
I wanted to try with messagebox only.
Any way thanks for ur replies.
|
|
|
|
|
|
Hello everyone,
I am a chinese.Here,my development envirument is VC.net.In my project i add a FORMVIEW resource(named IDD_FORMVIEW(English (U.S.))).But i find that this FORMVIEW can not display my motherlanguage.Every chinese character comes to be a chaos.
I don't know how to find a IDD_FORMVIEW(Chinese (P.R.C)).And I can't find the properties of FORMVIEW has a "Language" item. I have try my best to solve the problem.But i faild.
Can anybody tell me how to change the FORMVIEW's language?
Thanks!
|
|
|
|
|
No one know?
|
|
|
|
|
I want to format 3 digit numbers as follows
if number is 6 then add "00" before number; SNumber = 006
if number is 15 then add "0" before number; SNumber = 015
CString givenTEXT;
GetDlgItemText(IDC_ID, givenTEXT);
int TEXTvalue = givenTEXT;
CString tempTEXT;
if (TEXTvalue < 10)
{
tempTEXT="00" + TEXTvalue;
}
else if(TEXTvalue < 100)
{
tempTEXT="0" + TEXTvalue;
}
else
{
tempTEXT = TEXTvalue; //error: "=" operator is ambiguous
}
if i change the last line to
tempTEXT = "" + TEXTvalue;
it compiles but tempTEXT is all screw up : "..\include\Atlexcept.h"
|
|
|
|
|
Try this.
int i = 15;
CString str;
str.Format("%03d", i);
-Saurabh
|
|
|
|
|
I've tried the conversion routines and still get errors. I receive from an edit box a number. I want to add something to that number and then put it into a CString. can someone show me a code example that works Please. I can get the number find but I can't add something to it and then put it back into a CString.
A C++ programming language novice, but striving to learn
|
|
|
|
|
I am sorry, what exactly is the problem? Perhaps some code you tried will help.
-Saurabh
|
|
|
|
|
For instance : int a = 42; CString str; int tmp;(pEdit already established) pEdit1->GetDlgItemText(str); now str holds the value the User typed which was NOT a number. but the representation of a number in character format. Now tmp = _tstoi(str); WORKS it changes the character to a number and puts it in tmp(an integer). but my question is How do I do the reverse? How to I get an integer valve into the CString(ie str)?
I've tried these functions: _itot_s, _itoa_s, and _itoa and they all give a long error message basically saying the str cannot be transfered to a char*
I know there is something that works, but I can't recall what it is.
I just want to put an integer value into a CString after I have converted one from the User's entry.
A C++ programming language novice, but striving to learn
|
|
|
|
|
Okay I think the problem is _itot excepts second argument to be either wchar_t* or char* depending whether unicode is defined or not and it cannot automatically convert from CString to char* or wchar_t*. I don't use much MFC so not sure if there are function in CString to automatically do this but you can try something like this:
int i = 42;
CString str("50");
int temp = _ttoi(str);
temp += i;
TCHAR buffer[50];
_itot(temp, buffer, 10);
str = buffer;
-Saurabh
|
|
|
|
|
works until the last statement: str = buffer; at this point buffer does indead have the value I want, but I get an Access violation error when the assignment operator in CString tries to assign buffer's value to the CString(ie str).
A C++ programming language novice, but striving to learn
|
|
|
|
|
check CString format function
CString tmp;
int a = 5;
tmp.Format("%d Hey ", a);
Hope this helps.
|
|
|
|
|
I get this error: "Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast"
A C++ programming language novice, but striving to learn
|
|
|
|
|
That should be:
CString tmp;
int a = 5;
tmp.Format(_T("%d Hey "), a);
Here's a tip:
Choose a string character type and stick with it.
The three common choices are
char (ANSI)
wchar_t (Unicode)
TCHAR (Generic - either char or wchar_t based on build configuration)
MFC uses generic types and, except for OLD APIs, so does Windows, so if you're using MFC,
generic is probably the best choice - unless you want to have to conver strings every
time you call a Windows or MFC API.
CString is also a generic type - it's either a CStringA (ANSI/char) or
CStringW (Unicode/wchar_t) depending on the build configuration.
If you choose to use the generic types, use them everywhere.
That means:
Use the Generic Text Mappings[^]
Wrap your string literals with the _T() macro
Use CSring instead of CStringA or CStringW
IMO, this stuff should be second-nature. You shouldn't have to think about it.
It's VERY worthwhile to take the time to understand it completely.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks Mark
A C++ programming language novice, but striving to learn
|
|
|
|
|
Hi,
I have the following issue:
#include <time.h>
....
struct tm tm;
if(strptime("2001-05-21", "%Y-%m-%d", &tm) == NULL)
{
//Some error processing
}
But I seem to be getting the following error when I compile, Can someone please tell me what I am doing wrong?
error C3861: 'strptime': identifier not found, even with argument-dependent lookup
|
|
|
|
|
correction
#include < time.h >
|
|
|
|