|
Hi All,
Has anyone encountered:
An unnamed file was not found
error message box popup in your application before?
It happens when I run the release version of my MFC program outside of MS Visual Studio. When run inside visual studio, both debug and release versions have no errors...
Comments? Inputs?
Thanks.
|
|
|
|
|
This is MFC framework error message.
This will be occur when you try to open a file which doesnt exist physically.
If this problem occurs in InitInstance()..then manually populate the
CCommandLineInfo Object.
For more info, let us know what u r doing!
Hth,
Ramu
|
|
|
|
|
Thanks You for your help!
Thanks to your note, I found the problem in one of my destructors. It was attempting to delete a file that does not exist.
<br />
CFileStatus fileStatus;<br />
CFile::GetStatus("temp.satdef", fileStatus);<br />
<br />
<br />
<br />
if (!(fileStatus.m_attribute & 0xD0))<br />
CFile::Remove("temp.satdef");<br />
Apparently, somehow, my fileStatus check sometimes doesn't work all the time.
|
|
|
|
|
Can anyone decode this piece of code for me ??
template <typename Type>
std::list<const bla*> * blou::bli()
{
return getObjectDescriptor().template listSonsOfType<Type>( );
}
I think there must be some STL (which i do not know at all) in the thing, but i quite do not understand the last line : what´s this .template ? and what is here really returned ? is this a cast or something ??
~RaGE();
|
|
|
|
|
Well, this a rather obscure use of the template keyword caused by the extremely clumsy C++ syntax. getObjectDescriptor() returns an object of some class for which a template member function listSonsOfType is defined as in this example:
class CObjectDescriptor
{
...
template <typename T> std::list<const bla *> * listSonsOfType();
...
}; Now the line (without the template keyword)
return getObjectDescriptor().listSonsOfType<Type>( ); could be interpreted as a call to the member function or as an expression involving the operators "less than" and "greater than". In this case, the latter doesn't have any meaning, but C++ gurus found pathological examples in which both interpretations are valid. To disambiguate, one must include template .
By the way, this piece of code won't even approach to compile in VC++, which lacks template member function support.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
OK. Thank you very much.
~RaGE();
|
|
|
|
|
Can someone explain why the following doesn't compile:
#include < list >
template < class TYPE > class CNeighbourhoodArray
{
CNeighbourhoodArray()
{};
~CNeighbourhoodArray()
{};
list < int > foo_list;
};
Is it illegal in C++ to use a template class as the type of a member variable of another template class? Did that make sense ?
TIA,
Pete
|
|
|
|
|
Anonymous wrote:
Can someone explain why the following doesn't compile
what error do you get?
-c
Garbage collection, making life better - for weenies!
|
|
|
|
|
Sorry, I forgot to include the error...
c:\pete\capture\vss\neighbourhoodarray.h(25) : error C2143: syntax error : missing ';' before '<'
c:\pete\capture\vss\neighbourhoodarray.h(26) : see reference to class template instantiation 'CNeighbourhoodArray<type>' being compiled
HTH,
Pete
|
|
|
|
|
This is perfectly legal, the only missing thing is the std:: prefix:
include < list >
template < class TYPE > class CNeighbourhoodArray
{
CNeighbourhoodArray() {};
~CNeighbourhoodArray() {};
std::list < int > foo_list;
};
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Doh! That'll do it.
Thanks a lot Joaquin
|
|
|
|
|
Have you checked your namespaces???
"When a friend hurts us, we should write it down in the sand, where the winds of forgiveness get in charge of erasing it away, and when something great happens, we should engrave it in the stone of the memory of the heart, where no wind can erase it" Nish on life [methinks]
"It's The Soapbox; topics are optional" Shog 9
|
|
|
|
|
Suppose we are making simple client server application.
We use a function "connect()" in client source code to connect to the server. By default this function is in blocking mode. As such when we try to connect, the program sticks at a particular location and only when this function returns, the program flow continues. This function return 0 on success.
Let suppose, the socket is in non-blocking mode, as such when we use connect(), the program flow not stop as this function immediately return and our application is free to do something else. In this case the connect() function immediately returns with error something like, WSAERRWOUILDBLOCK.
Now the problem is that how we will be able to know after some time that the connection actually established or not ??
Infact in blocking mode connect() waits for a while and returns 0 on success. But in non blocking mode connect() immediately returns and does its working on background. So how we will be able to know whether connect() established connection or not ???
|
|
|
|
|
Have a look at select .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
By default, the program is in blocking mode when you use WSAConnect, connect, WSADisconnect, disconnect, etc. To be in non-blocking mode, you have to decide what non-blocking mode you want to use. There are numerous mode including WSAAsyncSelect, WSAAsyncEvent, and more complicated non-blocking mode for big servers. Once you have implemented a non-blocking mode, your network flow automatically becomes non-blocking.
For example, for a small network program such as an ftp client, chat/message program, etc. you can use WSAAsyncSelect. WSAAsyncSelect makes good use the the Windows messaging system. Once you have implemented WSAAsyncSelect, Windows sends you messaged including FD_CONNECT, FD_READ, FD_WRITE, FD_CLOSE, etc. You use the messages to determine what is going on with the network connection.
I highly recommend Network Programming for Microsoft Windows, Second Edition
by Anthony Jones and Jim Ohmund for Windows programmers.
Kuphryn
|
|
|
|
|
I am using ODBC to acess Mysql DB ..
I am using comands MoveNext(), MovePrev() ... of Recordset class ..
it´s working well .. The AddNew register is working .. but when I try
to use Delete function or Update function appear the follow message:
No Cursos name avaliable ..
To Update I am using this code:
m_pSet->Edit();
m_pSet->m_id = NEW_VALUE;
m_pSet->m_descricao = NEW_VALUE;
m_pSet->Update();
to Delete I am using:
m_pSet->Delete();
Tks
|
|
|
|
|
Are you opening the RecordSet Connection over 'CRecordset::dynamic'????
Thanks,
Ramu
|
|
|
|
|
I have an MFC dialog based app, and ON_UPDATE_COMMAND_UI just doesn't work. For some reason ON_UPDATE_COMMAND_UI is sent when I actually choose the menu-option (Rather when the menu drops down). After asking around and searching the net it seems like this is a known problem, but I haven't been able to find any good info on why and/or how to make it work.
Is there someone here who can?
Sprudling
|
|
|
|
|
Hi,
For your first question,
Suppose at run time you want to change(enable/disable,show/hide) the menuitems, then this function is usefull.
Second,
It works quite similar to other functions. You just have to add this function and write ur logic.
|
|
|
|
|
One way to do this is to loop through all items once the popup menu is drop down and call
CCmdUI::DoUpdate for all the child sub-menu. You will have to catch WM_MENUSELECT and loop through the sub-menu. Good luck!
Last Article:
Client/Server Socket class
|
|
|
|
|
Thank you VERY much
This actually solves it quite elegant
I like that
Sprudling
|
|
|
|
|
I have colors of a picture in array but i have to save all these colors i.e. picture into a .bmp file , I have already created .bmp file now how can I save my desired array's data into .bmp file at my desired x, y, places.
I'll me so thankfull to you.
|
|
|
|
|
I have a console app that uses MFC. I am doing some testing on a class that I have that utilizes CStdioFile. I know that the CStdioFile constructor will throw an exception if something goes wrong (e.g., it can't create the file.)
I try to catch this exception in the standard manner, and that part seems to work. But when I call its GetErrorMessage function, it triggers an ASSERT deep in MFC code. It appears that it is trying to load a string from a resource, but can't seem to get at the resource.
Below is the relevant fragment of code. I looked at an MSDN article TEAR (I think) and it did the exact same thing - try to call MFC functions from a console app, and I can't see why my code would be any different. (NOTE: I have also tried catching a CFileException instead of a CException , but that caused the same problem.)
try
{
CStdioFile file(realFileName, CFile::modeCreate | CFile::modeWrite);
...
}
catch(CException *e)
{
TCHAR buff[201];
bRet = false;
e->GetErrorMessage(buff, 200);
TRACE("Writing to file %s failed:\n\t%s", fileName, buff);
e->Delete();
}
Also, in my main function, this is how I initialize MFC (appwizard generated code):
if(!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
cerr << _T("Fatal Error: MFC initialization failed") << endl;
return 1;
}
Even if you win the rat race, you're still a rat.
|
|
|
|
|
You'll have to do a little hacking to get MFC to work in a console app. In this case, chances are the lacking of a CWinApp object in your code is driving MFC nuts in its effort to locate the appropriate resources. Try declaring a CWinApp object to see it that works.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Nope - already got a CWinApp object.
I could just ignore this, since this app is really just a test harness, and our "real" apps are full MFC (either doc-view or dialog based), not console apps. But I want it to work right!
Even if you win the rat race, you're still a rat.
|
|
|
|