The computer was rebooted, same results. On the above suggestion, did a Clean and Rebuild, same results. I will try another reboot and clean and if sucessful, will post the results. Otherwise, assume no change.
(The working computer has no internet connection and is in another room)
I also noticed:
m_hour = 0;
m_minute = 0;
m_second = 0;
All are declared a member variables. The debugger skipped over m_hour and visited m_minute and m_second. Very curious.
After a reboot and after deleting the *ncp and *.pch files, the results were the same. Another Clean and Build had no effect.
I realized the project was set to build the realease version. (That is displayed in the toolbar) After changing that to debug, everything seems normal again. I could whine about this, that, and the other, and how it SHOULD work but that is not going to change anything. The end result is almost two hours expended learning this little lesson because I did not notice all the indicators.
Yeah, release version isn't built with debug information so the debugger doesn't work right.... You can however, mix debug and release versions of things to debug the portions that are built with debug information hence Visual Studio allowing you to do this... So, it's really working as it should be.
I realized the project was set to build the realease version.
Yeah, we've all done that once or twice. The thing with the Release build is that variables can get optimized away that will always show up in the Debug build. BTW I don't think that rebooting would have made any difference to the situation.
Sorry if this is not the good place where I put my question but please I have an urgent problem.
I have a MFC application which create mdb and mdw files , I build it into two platform:
1) 32 bit : its include odbc library and it works on both OS 32 and 64 (as Win 7)
2) 64 bit : this version not works and it says that cant get the driver to create mdb and mdw files.
It seems that cant get the driver ODBC 64 bit and after a long search it seems also that there is no version 64 for driver for mdb files
Have you any idea about this ? and how can I have a 64 bit version of my application which run normaly and without this type of problem ?
I have just gone from Visual C++ 6.0 to Visual Studio 2012. So far it is working well, I have manged to transfer my application over, albeit with some difficulties. But the program creates this big SQL Server Compact Edition, which I don't need. My application is not a database tool. How do I remove it?
Environment Windows XP and 7, Visual Studio 2008, C++.
Experience level: novice with TCP/IP, but do have the application working with CAsyncSocket.
The message application receives telemetry data from some hardware (arrives fast and furious), processes it and dispatches the results to a display device via TCP/IP. It sends the data to the client but does not receive from the client.
Setup: the TCP “Manager” is started by the main application and it listens for the client. On connect, it creates the “Sender” that does all the sending.
Question: what is the best, read that simple and maintainable, way for the manager to get the Sender pointer to the main application so it can use the Sender? When the client closes the connection, how is the application informed of that?
Tentative proposal: the application provides the Manager with a pointer to itself. When the connect is made the Manager calls an application method such as
Set_TCP_Sender_Pointer( C_Sender_Class *new_sender_pointer );
The Manager can pass the pointer (to the main application) to the Sender on creation. When the Sender gets a close from the client, it calls the same method using a NULL for the argument. This makes the application aware there is no Sender. Then the Sender exits. (There is only one thread so I think there is no concern about the application using a pointer to a non-existent Sender.)
I am pretty sure that will work, but if you had to pick up on this project, would it be easy to understand and maintain? Presume you are not an expert with TCP/IP in the Microsoft world.
I am open to alternative suggestions.
After writing the OP I outlined the process with all the steps then began to implement.
I have started using a common directory for re-usable code. In order for the Manager to call a method in its creator it must know the name of the owner's class. To do that I added a forward declaration in the Manager.
However, this means that when the class is re-used, and the owner has a different name, the Manager must be changed.
There is another indicator this is a bad practice. After the forward declaration in the dot H file, the dot CPP file needs to reference the dot H file of the owner. The common code resides in another directory and it cannot find the central code of the main project unless it is specifically spelled out. Then, if the project is moved or re-name, the common code must change.
There may be a way to do this automatically using directive and path names within Visual Studio. But I now think that even if that can be done it would be miss-guided.
A utility class can call "down" the heiarchy to objects it creates, but should not call up to its owner. While the concept of it calling up may make the owner code neater, it represents an inversion of authority. (Regardless of how the methods are name, a call up in an inversion.)
The main application uses pointers into the lower level objects to accomplish its tasks. How does it become aware that the lower level needs to exit, or maybe even has already exited.
When the TCP sending function detects that the client has closed the connection it does not exit right away. It waits until the upper level code calls the method to send the data. Then the lower level returns an error code stating that the data has not been sent and that the object is exiting.
I generally do not like exceptions, but this appears to be a time when an exception is warranted. When the lower level must terminate unexpectedly, then an exception could work its way back to the upper level and the exception handler can NULL the pointer.
I personally never used exceptions for ATL projects. Now a colleague votes strongly for throwing exceptions instead of returning HRESULTs. I did some research, and even here on codeproject I don't find much about ATL and exceptions. To me it appears that exceptions in ATL are not very popular. So I would like to know from you ATL guys:
Do you use exceptions? Or you simply return an HRESULT?
I used a combination. A colleague and I developed an exception object with various constructors that could, for example, be thrown with parameters of: a HRESULT, a string describing what failed, the file name it was thrown in, and the line number of the file it was thrown in.
The exception object constructor then took care of writing the error as an event to the System Event log as well as looking up any messages from the HRESULT, or accessing any other error handling mechanism needed.
This resulted in code unclutered with complicated error handling and a standard way of making sure that the log showed not only an error code or message, but a comment on what was being attemted, which .cpp file this was detected in and the line number of the file.
I agree when you say you'd rather return an error code than throw an exception. I found using exceptions locally makes the code clearer and imposes some structure. Having caught the exception locally and dealt with it i.e. usually recorded what exactly went wrong etc I too then prefered to return an error code.
Windows XP and 7, Visual Studio 2008 and 2010, MFC, C++
Application A supports Unicode and application B does not. Class Log_Writer does not support Unicode. Both applications use Log_Writer ok passing a char * to log writer.
The problem is within Log_Writer when it cannot open the log file. It uses AfxMessageBox() to display an error to the user. When Log_Writer is compiled within the A environment the error message is:
None of the 2 overloads could convert all the argument types.
What can be done so that Log_Writer will work in both environments?
Thanks for your time
Last Visit: 31-Dec-99 18:00 Last Update: 29-Apr-17 7:43