|
No - that was me, 'cause it was exactly the answer I would have given
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Rajesh R Subramanian wrote: I don't think so, because the op wrote: However, other break points (even set immediately after the Format funtion works
Debugging in Release mode's a funny thing - breakpoints sometimes work, sometimes don't, you can look at some data, but other items are inaccessible - I saw nothing in the original post that was incompatible with the answer.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
pani68 wrote: other break points (even set immediately after the Format funtion works.
You may set the break point at this line :-
strMessage.Format(L"A text file containing the boundary detals in the following format may be imported:\n"
Change the breakpoint to this line,
L"\n\nDo you have a text file in this format and wish to continue?");
Worked ??
And why so ? lets hope some of Codeproject gods will answer this ...
modified on Friday, May 8, 2009 7:01 AM
|
|
|
|
|
Madhu Nair wrote: Change the breakpoint to this line,
L"\n\nDo you have a text file in this format and wish to continue?");
Worked ??
Yes. It worked. Thank you.
Madhu Nair wrote: And why so ? lets hope some of Codeproject gods will answer this ...
I also hope the mystry to be solved!
|
|
|
|
|
Madhu Nair wrote: You may set the break point at this line :-
strMessage.Format(L"A text file containing the boundary detals in the following format may be imported:\n"
Change the breakpoint to this line,
L"\n\nDo you have a text file in this format and wish to continue?");
Worked ??
It's quite odd that worked - whenever I've put a breakpoint on the first line of a multi-line function call, it's always resolved it to the last line of the call automatically. The only thing I can think of is that the source and the executable have got out of sync somehow, so the line referred to by the source isn't resolvable within the object code.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
pani68 wrote: L"\n\nDo you have a text file in this format and wish to continue?");
The breakpoint must go on this line, as it has the statement-terminating semicolon.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
DavidCrow wrote: The breakpoint must go on this line, as it has the statement-terminating semicolon.
Great answer David!
I have tried the code in OP, it was a strange thing to see that VS 2008 automatically pulls the breakpoint to the end line if we put it in any lines except the first line. I have tried some other multiline functions to recreate this, but VS2008 was clever enough to identify the first line of the statement.
Is that something related to the string which he represented in multiline (not the exact text in OP, any multiline unicode string) ? A bug in VS2008?
modified on Friday, May 8, 2009 12:58 PM
|
|
|
|
|
Hi All,
I'm planning to program a software where the user will be able to change the entire language (panels, error messages,...etc.).
I was thinking about having a 'language' directory where will be stored files (txt, xml?) with different language translations. And always during the application init, the program would read and use preferred 'language pack'.
So here are my questions is:
- is this a good 'method'?
- If yes, what is the best 'language-storable' file format? (plain text, xml,...)
- If not, do you have some other ideas how to solve this?
The software will be quite performance-dependent and reading a file might little slow-down the process.
thank you in advance.....
|
|
|
|
|
|
ok,...I forgot one thing.
The program should NOT be 'platform'/OS dependent. That means that it will be used on Linux, Windows,...maybe Mac OS....
the 'linked' article is for MFC,...
|
|
|
|
|
Hi there.
I can find the IP address of current system using below code but that's C++ code...
char* CLogger::GetIPAdd()
{
WORD wVersionRequested;
WSADATA wsaData;
char Name[255];
PHOSTENT HostInfo;
wVersionRequested = MAKEWORD( 1, 1 );
char *IPAdd;
if ( WSAStartup( wVersionRequested, &wsaData ) == 0 )
{
if( gethostname ( Name, sizeof(Name)) == 0)
{
if((HostInfo = gethostbyname(Name)) != NULL)
{
int nCount = 0;
while(HostInfo->h_addr_list[nCount])
{
IPAdd = inet_ntoa(*(struct in_addr *)HostInfo->h_addr_list[nCount]);
++nCount;
}
}
}
}
return IPAdd;
}
I want to get an IP Address using MFC. Can any one please help me out to get the same using MFC?
Thanks
PanB
|
|
|
|
|
MFC is just a wrapper over C++ classes functions, but what is the problem with the code above.
Even if you do find a class in MFC to get the IP address it must be using a similar sort of mechanism to get the IP Address of the local machine
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
Why MFC? I am getting lots of Windows.h already included related error messages.
But if we can get IP Address in MFC then that will server my requirement.
Thanks
|
|
|
|
|
PankajB wrote: But if we can get IP Address in MFC then that will server my requirement.
do you apply ointment on your feet if you have an headache
PankajB wrote: I am getting lots of Windows.h already included related error messages.
figure out why these errors are popping and resolve them. May be you are missing a library to link to or you didn't include a header file.
BTW what are the errors?
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
PankajB wrote: I can find the IP address of current system using below code but that's C++ code...
PankajB wrote: I want to get an IP Address using MFC
MFC doesn't have functionality covering IP address resolution - if it works, your C++ code is as good as anything.
Don't get too hung up about things being in MFC or not in MFC - MFC is, for the most part, a thin veneer over Win32 functions and, overall, has a very old fashioned design , a lot of which was constrained by the deficiencies of C++ compilers in use when MFC was developed.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
PankajB wrote: ...but that's C++ code...
Nothing in your code is C++.
PankajB wrote: return IPAdd;
You are potentially returning an uninitialized pointer.
PankajB wrote: I want to get an IP Address using MFC.
Then use the same code.
PankajB wrote: Can any one please help me out to get the same using MFC?
MFC offers no such class.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Thanks for the code! I just had to add the library Ws2_32.lib and the header Windows.h, works perfectly! Thanks!
|
|
|
|
|
Yeah it works perfect. Thanks a lot for the code
|
|
|
|
|
Hello,
I get compiler error error C2327: 'CMyGridEdit::OnChar' .symbol' : is not a type name, static, or enumerator..
What's wrong at this declaration ?
I have following declaration in VC++ 6.0
<<<mygrid.cpp>>
BEGIN_MESSAGE_MAP(CMyGrid::CMyGridEdit, CEdit)
ON_WM_CHAR()
END_MESSAGE_MAP()
void CMyGrid::CMyGridEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
}
<<mygrid.h>>
{
class CMyGrid : public CMSHFlexGrid
..
class CMyGridEdit : public CEdit
{
afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
DECLARE_MESSAGE_MAP()
};
};
Thanks for helps. jr
|
|
|
|
|
That pattern works fine in VS2008, so the only thing I can presume is that one of the VC6 compiler's many many deficiencies is biting you.
I'd suggest you pre-process the C++ file (with CL /P) and see if anything looks untoward in the BEGIN_MESSAGE_MAP code after pre-processing (don't look for BEGIN_MESSAGE_MAP in the .i file you get out of the pre-processor - it won't be there - look for CMyGrid::CMyGridEdit::GetMessageMap instead.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
The following is the code fragment which I used in my application,
CStringb csFilePath = _T("C:\\MyFolder\\");
if(csFilePath != "\\")
{
DWORD dwError = GetLastError();
}
And i am getting an error code of 122(The data area passed to a system call is too small) in VS2008.
But in VC6.0, there is no such problem, the error code i am getting is 0.The application is with UNICODE supported.
Please help me to find out the cause of this problem.
Thanks & Regards
VIJITH VIJAYAN
|
|
|
|
|
VIJITH VIJAYAN wrote: if(csFilePath != "\\")
this should probably be
if(csFilePath != _T("\\"))
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Thanks for the quick response .But at the compilation time this code didnt shown any errors or warnings . Do have any idea ,why it had happened like this ?
Thanks & Regards
VIJITH VIJAYAN
|
|
|
|
|
Because the CStringT == operator is overloaded to handle PCYSTR .
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
VIJITH VIJAYAN wrote: And i am getting an error code of 122(The data area passed to a system call is too small) in VS2008.
Possibly because that's the last value that was set (with SetLastError() ). In other words:
SomeWindowsFunctionThatFailsWithCode122();
CString csFilePath = _T("C:\\MyFolder\\");
if (csFilePath != _T("\\"))
{
DWORD dwError = GetLastError();
} If nothing calls SetLastError(0) , then its internal value will stay 122 .
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|