|
Jon Hulatt wrote:
Does anyone else here secretly enjoy it when they come up with something really complicated that noone else will ever make head or tail of?
I enjoy it, but I also enjoy trying to explain to someone what I actually did, and try to help them understand it, then they get a deeper appreciation for some of the code that I develop.
|
|
|
|
|
Jon Hulatt wrote:
Does anyone else here secretly enjoy it when they come up with something really complicated that noone else will ever make head or tail of?
I prefer hearing that my code and interfaces are clear and easy to understand. Code that is extremely hard to understand is usually an indication of poor design.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Theres nothing wrong with nested classes. If CMySecondClass is only meaningful in the context of a CMyFirstClass object, then nesting the classes makes this clear.
However, if the second class is an implementation detail that doesn't appear in the public interface, there is another technique that you may be able to apply. In the header file that declares CMyFirstClass you simply give a forward reference to CMySecondClass:
class CMySecondClass;
class CMyFirstClass
{
public:
protected:
CMySecondClass *m_p_instance;
};
Now, both the declaration and implementation of CMySecondClass can be put in the implementation file
for CMyFirstClass. This provides much stronger encapsulation than a nested protected or private class, since the details of CMySecondClass aren't even visible to code that uses CMyFirstClass (other than the fact that CMySecondClass exists). With a nested protected or private class, the details of CMySecondClass are visible, but access is restricted.
Stephen C. Steel
Kerr Vayne Systems Ltd.
|
|
|
|
|
I have imported a project developed in VC++ 6.0.
and am getting this(these) errors when running
C:\\windows\system32\ntdll.dll , cannot find or open a required DBG file
C:\\windows\system32\mfc70.dll , cannot find or open a required DBG file
PS. It compiles and is able to run but what do this errors mean? I tried search MSDN but nothing.
How do I fix these?
Thanks -JoeSox
|
|
|
|
|
Try issuing a "Rebuild all" command. It could be that some .obj has not been properly refreshed.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Tried that, still getting same output in debug window.
I guess I shouldn't worry about it if my app is working ok.
|
|
|
|
|
Those are just information messages issued by the debugger. All it is saying is that it can't find a valid DBG/PDB file for the specified DLL. Since those DLLs are system DLLs, it isn't shocking that they can't be found.
Very very very very safe to ignore.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Tim, Can I ask a follow-up question?
In VC++ 6.0, I would hit the run button, it would ask me to compile, and it would only compile the parts I just modified.
It seems in VC++.NET, I hit the run button and it compiles ALL the Classes, which takes longer. How do I change this setting?
|
|
|
|
|
I know. I hate that too. I wish I knew what the setting was. I also hate that if your top document is from X.DLL, then only X.DLL gets built when you hit build. I liked the old V6 system where it would build your current project. This whole 'program to start' setting is confusing.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
If it wasn't for the better handling of the toolbars (support for over 256 colors) I wouldn't be trying to use VC++.NET at all.
I have alot of bugs in my inmported code I must now fix.
It would take me too long to rewrite all my code.
|
|
|
|
|
I want to work with a database that has a large number of records,So I want
to read the database,and in disconnect mode,modify,add or delete in database,after all
of them update the datasource.which class or object should I use?
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Hi,
I have many forms that would share many stuff (function, variables) and I'd like to create sort of a template class with CFormView, so that my forms could derrive from CFrmTmpl instead of CFormView. Here's some code:
class CFrmTmpl : public CFormView
{
protected:
CFrmTmpl(); // protected constructor used by dynamic creation
DECLARE_DYNCREATE(CFrmTmpl)
// Form Data
public:
//{{AFX_DATA(CFrmTmpl)
enum { IDD = _UNKNOWN_RESOURCE_ID_ };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
**************
class CFrm1 : public CFrmTmpl
{
protected:
CFrm1(); // protected constructor used by dynamic creation
DECLARE_DYNCREATE(CFrm1)
// Form Data
public:
//{{AFX_DATA(CFrm1)
enum { IDD = IDD_DIALOG1 };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
also:
CFrmTmpl::CFrmTmpl()
: CFormView(CFrmTmpl::IDD)
{
********************
CFrm1::CFrm1()
: CFrm1(CFrm1::IDD) // I know this does not work, that's the prob!
{
The problem that I have is the IDD and the constructor. Seems like the CFormView absolutely needs an IDD. Is there a way to make this work?
Thanks!
---------------
http://www.edovia.com
|
|
|
|
|
I guess that the best way is not to derrive from CFormView. Just create your own class and instanciate it in every form...
thanks Luke!
---------------
http://www.edovia.com
|
|
|
|
|
No problemo Luke!
---------------
http://www.edovia.com
|
|
|
|
|
Follow this scheme:
class CFrmTmpl : public CFormView
{
protected:
CFrmTmpl();
CFrmTmpl(UINT uId);
...
);
CFrmTmpl::CFrmTmpl(UINT uId)
: CFormView(uId)
{
...
}
CFrm1::CFrm1()
: CFrmTmpl(CFrm1::IDD)
{
...
) The idea is to have an additional constructor in CFrmTmpl that accepts the IDD from its derived classes. In this scheme, the default ctor for CFrmTmpl is never used, though I think DECLARE_DYNCREATE(CFrmTmpl) requires it.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi, buddies,
Say, I programmed a simple text editor, when users open a file to edit, The
file may be changed outside of the editor, How do I know that? Which window
message should be response?
Thanks you.
|
|
|
|
|
You might want to have a look at FindFirstChangeNotification .
|
|
|
|
|
Hi,
I'd like to know if there's some way to programatically change the label of a CD-RW that is formated with Adptec DirectCD. This aplications "formats" the CD and allow user to copy, move and delete files on the CD as if they were on a HardDisk.
The label can not be changed by explorer, like the other kinds of disks, so I'd looking for a way to chage the label without using the Adpatec burner software.
Best Regards,
Igor
|
|
|
|
|
I believe UDF has two five-sector volume descriptors. Using ASPI or SPTI I think it should be possible to erase and rewrite those using packet-writing, but I'm really not sure.
How? I haven't got a clue. You might want to try e.g. google and look for some Linux packet driver to get an idea of the SCSI commands involved. You'd probably also need to know a bit about UDF, why you probably have to scan some UDF source code also.
++luck
|
|
|
|
|
When the Class Wizard in VC++ 6.0 is out of sync, Microsoft recommends to delete the CLW file and then press Ctrl+W to build up the file again.
If there would be an Add-In to automatically delete the CLW file, this would be very handy.
Since the CLW-file is text-based, it should be even possible to build it automatically from all files in the project. This could be very helpful if your project has many files in many subdirectories.
Does anyone know such an Add-In?
--
See me: www.magerquark.de
|
|
|
|
|
Hi,
After my questions the other day about getting single lines out of CAsyncSocket, I thought a good starting & learning point would be to knock up something I know and understand, namely an SMTP daemon.
So, I implemented it a bit like this:
CSMTPDaemon : public CAsyncSocket
-- is set up to bind and listen on port 25. It spawns a new CMailConnection for every connection (up to a maximum of 5 concurrent connections)
CMailConnection : public CAsyncSocket
-- handles the SMTP connection. The OnReceive Event tacks new data onto the end of a buffer (a char * member var). It then calls a member function ProcessCommand, which inspects the buffer for a full line (ie characters ending with a CRLF pair). if it finds a line, it copies the command line to a different buffer. it then shrinks the main buffer and moves any other data forward (FIFO style). If we got a command line, then another function is called to handle the command... choose a response and so on.
I use mutexes extensively to ensure that only 1 thread a) reads or writes to the buffer at any one time, and b) sends or receives on the socket at any one time.
Anyway, it all works really well. Sort of. I can have my own SMTP conversation with it (using TELNET) and it's fine. I set up MX records for a dummy domain, and send mail to it using my regular mailserver (sendmail on UNIX) and it's fine. But, if i set my Microsoft Outlook to use it as it's outgoing SMTP server, it falls flat on it's face. In that it stalls.
R: "HELO WLBDP322[\r\n]"
S: "250 Why, hello to you too![\r\n]"
R: "MAIL FROM: <my@adress.com>[\r\n]"
S: "250 jon@monstereurope.com....Sender OK[\r\n]"
is what i get in my TRACE window. My app sends a (correct) response to the MAIL FROM command. the CASyncSocket::Send command returned successfully. But the input buffer is empty. The OnReceive function does not get called. If I force a Receive(), using MSG_PEEK, there is no more input to be had.
So it seems that for some reason, outlook just isn't talking to me after that last response. And I don't know why.
A long shot. Does anyone have any ideas???
Thanks
Jon
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
Fetch some TCP sniffer and have a look at a dialog between Outlook Express and a commercial SMTP server. My guess is that you'll spot some significative difference with your interaction that will explain the problem.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I did that! (there don't seem to be many (good) (free) packet sniffers out there though).
I was doing this: (simplified)
char p_strCmd[]="200 Ok\r\n";
Send(p_strCmd, sizeof(p_strCmd), 0);
But sizeof(p_strCmd) includes the terminating null, which i'd forgotton. so i was actuially sending "\r\n\0". Which was screwing outlook up halfway through the mail process.
It works fine now. Pretty quick too, i've impressed myself
Thanks (again!) Joaquin!
Jon
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
Can anyone help me figure out how to fix this syntax error. i am trying to transfer my Board Class to a MFC wizard generated application. the Board class was created before in another program but i decide to reuse it but it gives me this error:
fatal error C1010: unexpected end of file while looking for precompiled header directive
I know my class declaration and implementation is working fine. so i went and included my class to the CBoardView. but then it gave me this error. can anyone tell me ? what's wrong?
|
|
|
|
|
You forgot
#include "StdAfx.h"
|
|
|
|