|
when the user type greater then 255 i want to post a error message.
In windows Local area Connection wizard display this kind of message.i want to do that like this.
|
|
|
|
|
Hi,
The one way could be by customizing the CEdit control using mask. You create ur own IPAddress control class, in which u can handle all validations as per your requirement.
Manoj
Never Give up
|
|
|
|
|
prathuraj wrote: when i enter value greater than 255 it automatically change to 255 at that time
If you are using a SysIPAddress32 window class (CIPAddressCtrl if using MFC), this is done automatically.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I want to read line by line in a text file by using CStdioFile .But I have some problem when my application run.VC++ notice a error messages.Please help me to fix where wrong in my code.Here is my code :
<br />
void CTestForm::LoadFile()<br />
{<br />
TRY<br />
{<br />
CStdioFile file("cauhoi.txt", CFile::modeRead|CFile::typeText);<br />
CArchive ar( &file, CArchive::load );<br />
CString data;<br />
<br />
BOOL finished = FALSE;<br />
<br />
while (!finished)<br />
{<br />
CQuestionData * pQues = new CQuestionData();<br />
pQues->Serialize(ar);<br />
if (pQues->GetData() == "") <br />
{<br />
delete pQues;<br />
finished = TRUE;<br />
}<br />
}<br />
ar.Close();<br />
}<br />
CATCH( CFileException, cfe)<br />
{<br />
}<br />
CATCH(CMemoryException, cme)<br />
{<br />
cme->ReportError();<br />
}<br />
CATCH(CArchiveException, cae)<br />
{<br />
}<br />
END_CATCH<br />
}<br />
void CQuestionData::Serialize(CArchive &ar)<br />
{<br />
CObject::Serialize(ar);<br />
<br />
if(ar.IsStoring())<br />
{<br />
}<br />
else<br />
{<br />
if (!ar.ReadString(data))<br />
{<br />
return;<br />
}<br />
ar.ReadString(data);<br />
while(data != "")<br />
{<br />
if(data == "#Q")<br />
{<br />
m_count++;<br />
ar.ReadString(data);<br />
m_sQues = data;<br />
ar.ReadString(data);<br />
}<br />
else if(data == "#A")<br />
{ <br />
ar.ReadString(data);<br />
while(data != "#Q")<br />
{<br />
m_arrAns[dem++] = data; <br />
ar.ReadString(data);<br />
}<br />
}<br />
<br />
}<br />
<br />
}<br />
}<br />
nothing
|
|
|
|
|
|
What is the error message?
|
|
|
|
|
From your code snippet, two things are missing in the serialize function. The variables "dem" and "data" do not seem to have been declared. I'm assuming based upon your naming conventions that member variable start with a "m_" so it would appear these are not member variables at first glance.
// Copy of your snippet
void CQuestionData::Serialize(CArchive &ar)
{
CObject::Serialize(ar);
if(ar.IsStoring()) {
} else {
// TODO: add loading code here
if (!ar.ReadString(data)) {
return;
}
ar.ReadString(data);
while(data != "") {
if(data == "#Q") {
m_count++;
ar.ReadString(data);
m_sQues = data;
ar.ReadString(data);
} else {
if(data == "#A") {
ar.ReadString(data);
while(data != "#Q") {
m_arrAns[dem++] = data;
ar.ReadString(data);
}
}
}
}
}
}
|
|
|
|
|
|
whale84 wrote: when my application is running, it suddenly stand by.
So why not use your debugger to step through the code to find the statement(s) that are "standing by?"
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I click on menu File=>Open Workspace then select *.dsw file that I want.
but nothing load to VC++.
Please advise me for solve this problem.
I use Visual c++ 6.
|
|
|
|
|
|
Try the following:
1. Close VC++.
2. Delete the *.opt, *.ncb, *.aps and *.clw files (don't worry - they will be recreated later).
3. Reopen the VC++ and select your *.dsw.
|
|
|
|
|
|
Can you tell me more.
What is the root cause of this problem?
|
|
|
|
|
These files are generated by VC++. They contain information about your project/workspace, for example the *.clw holds Class-Wizard information and *.ncb contain intellisense data for your project.
When VC++ loads your project, it collects data from these files (if they do not exist, they are rebuilt).
If one of these files gets corrupted (don't ask me why, but it happens , then VC++ fails to load your project/workspace. So the solution is to just delete these files and let VC++ rebuild them properly ...
|
|
|
|
|
What is the function that can be used to clear the data in the list box to display new data?
--Star
|
|
|
|
|
|
|
led mike wrote: They hide that information in the documentation[^]
Mean bastards.
Shog on learning VB6: Ah, that would have been VB6. Kicked my ass anyway. So easy to learn, just like falling down a flight of stairs...
|
|
|
|
|
|
Hi all:
I am supposed to extract the following string "cosc.exe" from a longer string "C:Program Files/Local_user/Visual Studio 2005/Project/Debugger/cosc.exe"
But I am not really sure how I am going to do it.
Can anyone help?
Thank you
|
|
|
|
|
What string class are you using ? Are you using MFC ? Are you using std::string ? Are you just using C ( that is, are you using char * to store a string ) ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi:
Thank you for your reply.
I am using std::string, C++.
|
|
|
|
|
Your slashes are backwards
"C:Program Files/Local_user/Visual Studio 2005/Project/Debugger/cosc.exe"
should be
"C:Program Files\Local_user\Visual Studio 2005\Project\Debugger\cosc.exe"
/////////////////////////
std::string sPath="C:Program Files\\Local_user\\Visual Studio 2005\\Project\\Debugger\\cosc.exe";
std::string sSearch="cosc.exe";
// If looking for the string directly
int nIndex=sPath.find(sSearch);
TRACE("Found \"%s\" at index = %d\n",sSearch.c_str(),nIndex);
/*
If you need to search out the filename
from a given path
*/
nIndex=sPath.rfind("\\");
std::string sExtract=sPath.substr(nIndex+1,sPath.length()-nIndex);
TRACE("Found '\\' at index = %d\n",nIndex);
TRACE("Filename from path is \"%s\"\n",sExtract.c_str());
|
|
|
|
|
Hi:
Thank you very much for your help. I really appreciate it.
Thank you
|
|
|
|