|
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.
|
|
|
|
|
Have you called CWinApp::InitInstance ? Which is the particular ASSERT that is failing?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Explicitly calling InitInstance didn't help.
The assert that fails, fails from CException::GetErrorMessage. Somewehre, some function calls AfxFormatStrings, which asserts after a call to AfxLoadString fails.
I guess I'll have to pour through a dialog-based or doc-view app, check out all the things that it does, and do some "emperical programming" until I find the combo that works...
Even if you win the rat race, you're still a rat.
|
|
|
|
|
Figured it out. I needed to have
#include "afxres.rc"
in my resource includes. Even though this gets put there automatically by AppWizard in an MFC app, it does NOT get put there automatically when you have a console app, even if you check "An app that supports MFC".
Guess that's what I get for relying too heavily on generated code.
Even if you win the rat race, you're still a rat.
|
|
|
|
|
Hi,
I want to know what is the useful space that I have in a document ( the X-Axis of the page)...
My idea is before insert one ActiveX scale it to the optimal size in the Ms Word instance.
Thanks in advance, greetings
Braulio
|
|
|
|
|
I pass a SAFEARRAY through a Variant from an ATL-made COM to some VB testing program.
Now i have the Variant and i don't know how to extract the SAFEARRAY from it.
rechi
|
|
|
|