|
AfxMessageBox(CString("hai")); //works fine
AfxMessageBox(CString("hai").Format("hello")); //gives error, any way to make this work without having a CString variable?.
|
|
|
|
|
|
|
I'm not quite clear on what you want to achieve.
In any case, you cannot use the CString constructor like that in the second case.
I Dream of Absolute Zero
|
|
|
|
|
RChin wrote:
In any case, you cannot use the CString constructor like that in the second case.
I feel its a valid call. But gives an error coz CString::Format() returns void.
suhredayan There is no spoon.
|
|
|
|
|
suhredayan® wrote:
I feel its a valid call. But gives an error coz CString::Format() returns void.
You're absolutely correct. My bad .
The following does indeed compile, though how it could be used in a useful way is still a puzzle. (since it cannot be assigned to anything)
void MyFunction()
{
CString("Hey").Format("There!");
}
I Dream of Absolute Zero
|
|
|
|
|
That compiles *and* runs successfully.
The problem is that CString::Format 's return type is void . So that's the return type of this statement, and there doesn't seem to be any way to convert that to the LPCTSTR that AfxMessageBox expects.
It's going to take some serious obfuscation to make this work. My question is...what's wrong with a local CString variable? Like it or not, the statement itself is creating a local CString that goes out of scope after the statement executes.
Bob Ciora
|
|
|
|
|
Bob Ciora wrote:
It's going to take some serious obfuscation to make this work. My question is...what's wrong with a local CString variable? Like it or not, the statement itself is creating a local CString that goes out of scope after the statement executes.
Its all about trying to show the geekness, wot you feel cing the following.
int fun(tchar* buff,tchar* szFnd,int n)
{
....
....
return CString(buff).Right(n).Find(szFnd);
}
suhredayan There is no spoon.
|
|
|
|
|
Although this is a valid call, isn't it a bit like asking for "unpredictable results" to come your way ?
CString strText( _T("Hey") );
strText += _T(" there !"); Much easier, much simpler, and compiles correctly
-Antti Keskinen
----------------------------------------------
"If we wrote a report stating we saw a jet fighter with a howitzer, who's going to believe us ?"
-- R.A.F. pilot quote on seeing a Me 262 armed with a 50mm Mauser cannon.
|
|
|
|
|
Dear all,
I am doing a project named Distributed Compiler. For that i need the file format that NMAKE utitlity is producing.
Do anyone know links or articles describing the NMAKE file format ? if any, please let me know.
Regards,
Jijo.
________________________________
Yesterday is history,
Tomorrow is a mystery,
But today is a present.
|
|
|
|
|
float f(12.34);
CString s;
s.Format("%.5f",f);
>>12.34000
but how to format string to be 00012.34000
|
|
|
|
|
float f(12.34);
CString s;
s.Format("%011.5f",f);
>> 00012.34000
Steve
|
|
|
|
|
plz tell me. how i can use ADO with SQL database in MFC Dialge.
thanx
Syed Abdul Qavi
|
|
|
|
|
Check the classes CDatabase and CDaoDatabase.
May be i am wrong but i hope these will give you clue
Regards.
|
|
|
|
|
CDatabase uses ODBC, and CDaoDatabase uses DAO. To use ADO requires importing from the type library (e.g., msado##.dll).
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
|
|
Hi,
I have a problem in Installshield ,
I am adding shortcuts in Rsources->shellObjects->Desktop->Start Menu->Programs-> Application Folder ->( Shortcut)
But these shortcuts are not appearing after installing the Application .
Can you tell me solution
thanx
Regards.
|
|
|
|
|
I think it will solve ur problem.
Rsources->ShellObjects->Explorer Shell->Desktop->Start Menu->Programs-> Ur Application ->Shortcut
|
|
|
|
|
Can anyone please explain me what is a call back function?
Is that function an API or is it something else?
Thanks
Prem
|
|
|
|
|
|
Hello Experts,
I am using MsFlexGrid control in my DialogBox. How to add print functionality?
I have fixed 20 rows and 20 columns in my grid, and it scrolls when data exceeds.I wish to print all data.
Regards
Deepali
|
|
|
|
|
Hi,
From within my application i need to wait for an external process to complete before proceeding. But all i have is the external process's name. Is there any API that returns the process id or handle given the process name ?? I tried using CreateToolhelp32Snapshot but it does not seem to work in VC41 in which my application is built. It works fine in VC6 though.
Thanks for ur help.
|
|
|
|
|
You can not to get the Handle of the process from the process name, you need to do the contrary. You must to enum the process handles or Ids and the get the process name
You need to use the psapi.dll library.
You must to use the EnumProcessModules function and then the GetModuleFileNameEx function to get the filename of each process.
Regards
Carlos Antollini
Do you know piFive[^] ?
|
|
|
|
|
Thanks a lot. That works.
|
|
|
|