|
hi,
refer http://www.naughter.com for smtp class. smtp class code is there. it's working fine. this problem is not occured there. very nice code.
Have A Nice Day
Murali.M
|
|
|
|
|
hi everybody,
does anyone of you all know how to write covariance matrix and eig function in Visual C++?
or anyone of you noe any website got the Visual C++ maths function algorithm free for use?
thank you very much.
vincent sim
|
|
|
|
|
I am using a CTreeView and need to move the tree nodes using Drag and drop . Any ideas for sample code to move nodes. Help is appreciated .
|
|
|
|
|
Here[^]'s an useful article. HTH,
K.
There are many here among us who feel that life is but a joke.
But you and I, we've been through that, and this is not our fate,
So let us not talk falsely now,
the hour is getting late
|
|
|
|
|
I have a question regarding scrolling on rich edit controls. I want to scroll to the bottom of the control like when you click the vertical scroll bar. I tried the linescroll func with getlincount, but it only work when I 1st start the progam. When the user uses the scroll bar, this method does not work as expected. Instead, it give me a blank page (blank page but scroll bar at bottom). Is there Cwnd function that I should used instead. Thank you for any help.
|
|
|
|
|
Hi, i'm trying to implement the Darkside mini SQL library in my ISAPI extension DLL. I tested the library before with a console application and it worked great, but not with my ISAPI dll... I get the following errors:
MHExtension.cpp
c:\dsqlm_1\include\dsql_m_structs.h(46) : error C2059: syntax error : 'constant'
c:\dsqlm_1\include\dsql_m_structs.h(46) : error C2143: syntax error : missing ';' before '}'
c:\dsqlm_1\include\dsql_m_structs.h(47) : error C2377: 'INT' : redefinition; typedef cannot be overloaded with any other symbol
c:\program files\microsoft visual studio\vc98\include\windef.h(161) : see declaration of 'INT'
c:\dsqlm_1\include\dsql_m_structs.h(47) : error C2377: 'FLOAT' : redefinition; typedef cannot be overloaded with any other symbol
c:\program files\microsoft visual studio\vc98\include\windef.h(145) : see declaration of 'FLOAT'
c:\dsqlm_1\include\dsql_m_structs.h(47) : error C2377: 'CHAR' : redefinition; typedef cannot be overloaded with any other symbol
c:\program files\microsoft visual studio\vc98\include\winnt.h(134) : see declaration of 'CHAR'
c:\dsqlm_1\include\dsql_m_structs.h(48) : error C2377: 'BOOL' : redefinition; typedef cannot be overloaded with any other symbol
c:\program files\microsoft visual studio\vc98\include\windef.h(142) : see declaration of 'BOOL'
c:\dsqlm_1\include\dsql_m_structs.h(64) : error C2146: syntax error : missing ';' before identifier 'unique'
c:\dsqlm_1\include\dsql_m_structs.h(64) : error C2501: 'boolean' : missing storage-class or type specifiers
c:\dsqlm_1\include\dsql_m_structs.h(64) : error C2501: 'unique' : missing storage-class or type specifiers
c:\dsqlm_1\include\dsql_m_structs.h(65) : error C2146: syntax error : missing ';' before identifier 'indexed'
c:\dsqlm_1\include\dsql_m_structs.h(65) : error C2501: 'boolean' : missing storage-class or type specifiers
c:\dsqlm_1\include\dsql_m_structs.h(65) : error C2501: 'indexed' : missing storage-class or type specifiers
c:\dsqlm_1\include\dsql_m_structs.h(66) : error C2146: syntax error : missing ';' before identifier 'nullable'
c:\dsqlm_1\include\dsql_m_structs.h(66) : error C2501: 'boolean' : missing storage-class or type specifiers
c:\dsqlm_1\include\dsql_m_structs.h(66) : error C2501: 'nullable' : missing storage-class or type specifiers
c:\dsqlm_1\include\dsql_m_structs.h(67) : error C2146: syntax error : missing ';' before identifier 'in_active'
c:\dsqlm_1\include\dsql_m_structs.h(67) : error C2501: 'boolean' : missing storage-class or type specifiers
c:\dsqlm_1\include\dsql_m_structs.h(67) : error C2501: 'in_active' : missing storage-class or type specifiers
c:\dsqlm_1\include\dsql_m_structs.h(70) : error C2629: unexpected 'class Column ('
c:\dsqlm_1\include\dsql_m_structs.h(70) : error C2238: unexpected token(s) preceding ';'
c:\dsqlm_1\include\dsql_m_structs.h(83) : error C2061: syntax error : identifier 'boolean'
c:\dsqlm_1\include\dsql_m_structs.h(84) : error C2146: syntax error : missing ';' before identifier 'isUnique'
c:\dsqlm_1\include\dsql_m_structs.h(84) : error C2501: 'boolean' : missing storage-class or type specifiers
c:\dsqlm_1\include\dsql_m_structs.h(85) : error C2061: syntax error : identifier 'boolean'
c:\dsqlm_1\include\dsql_m_structs.h(86) : error C2146: syntax error : missing ';' before identifier 'isIndexed'
c:\dsqlm_1\include\dsql_m_structs.h(86) : error C2501: 'boolean' : missing storage-class or type specifiers
c:\dsqlm_1\include\dsql_m_structs.h(87) : error C2061: syntax error : identifier 'boolean'
c:\dsqlm_1\include\dsql_m_structs.h(88) : error C2146: syntax error : missing ';' before identifier 'isNullable'
c:\dsqlm_1\include\dsql_m_structs.h(88) : error C2501: 'boolean' : missing storage-class or type specifiers
c:\dsqlm_1\include\dsql_m_structs.h(99) : error C2143: syntax error : missing ';' before '*'
c:\dsqlm_1\include\dsql_m_structs.h(99) : error C2501: 'Database' : missing storage-class or type specifiers
c:\dsqlm_1\include\dsql_m_structs.h(99) : error C2501: 'db' : missing storage-class or type specifiers
c:\dsqlm_1\include\dsql_m_structs.h(103) : error C2629: unexpected 'class Table ('
c:\dsqlm_1\include\dsql_m_structs.h(103) : error C2238: unexpected token(s) preceding ';'
c:\dsqlm_1\include\dsql_m_structs.h(151) : error C2143: syntax error : missing ';' before '}'
c:\dsqlm_1\include\dsql_m_structs.h(151) : error C2143: syntax error : missing ';' before '}'
c:\dsqlm_1\include\dsql_m_structs.h(151) : error C2143: syntax error : missing ';' before '}'
c:\dsqlm_1\include\sql_lexer.h(39) : error C2143: syntax error : missing ';' before '{'
c:\dsqlm_1\include\sql_lexer.h(39) : error C2447: missing function header (old-style formal list?)
c:\dsqlm_1\include\bridge.h(101) : error C2079: 'table' uses undefined class 'Table'
D:\Programming\Projects\VC++ Projects\MordredsHaven\MHExtension.cpp(18) : error C2143: syntax error : missing ';' before '__stdcall'
D:\Programming\Projects\VC++ Projects\MordredsHaven\MHExtension.cpp(18) : error C2501: 'BOOL' : missing storage-class or type specifiers
D:\Programming\Projects\VC++ Projects\MordredsHaven\MHExtension.cpp(18) : error C2371: 'BOOL' : redefinition; different basic types
c:\dsqlm_1\include\dsql_m_structs.h(48) : see declaration of 'BOOL'
D:\Programming\Projects\VC++ Projects\MordredsHaven\MHExtension.cpp(38) : error C2143: syntax error : missing ';' before '__stdcall'
D:\Programming\Projects\VC++ Projects\MordredsHaven\MHExtension.cpp(38) : error C2501: 'BOOL' : missing storage-class or type specifiers
D:\Programming\Projects\VC++ Projects\MordredsHaven\MHExtension.cpp(38) : error C2371: 'BOOL' : redefinition; different basic types
c:\dsqlm_1\include\dsql_m_structs.h(48) : see declaration of 'BOOL'
D:\Programming\Projects\VC++ Projects\MordredsHaven\MHExtension.cpp(425) : error C2143: syntax error : missing ';' before 'tag::id'
D:\Programming\Projects\VC++ Projects\MordredsHaven\MHExtension.cpp(425) : error C2501: 'BOOL' : missing storage-class or type specifiers
D:\Programming\Projects\VC++ Projects\MordredsHaven\MHExtension.cpp(425) : error C2371: 'BOOL' : redefinition; different basic types
c:\dsqlm_1\include\dsql_m_structs.h(48) : see declaration of 'BOOL'
D:\Programming\Projects\VC++ Projects\MordredsHaven\MHExtension.cpp(425) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
Something to do with the types already defined in windef.h.. but i don't see why it says that since there's no type redefinition, just an enum, like this (dsql_m_structs.h):
class MyDate;
namespace dsqlm {
class Database;
enum boolean { FALSE=0,TRUE=1 };
enum DsqlType {SMALLINT,INT,BIGINT,FLOAT,DOUBLE,CHAR,VARCHAR,
DATE,TIME,TIMESTAMP,BOOL,AUTOID,UID};
enum ComparissonOperator {EQUALS,NOT_EQUALS,GREATER_THAN,LESSER_THAN,
GREATER_THAN_OR_EQUAL_TO,LESSER_THAN_OR_EQUAL_TO,
LIKE};
enum LogicalOperator {AND,OR};
...
Does anyone see how i could fix it? I really need the database..
Thanks
Kuniva
--------------------------------------------
|
|
|
|
|
Hello,
Here is the question:
Is it possible to modify an exception inside a catch block and then rethrow it ?
Under
http://www.codeproject.com/cpp/ANSI-cpp-dec96/except.asp
the only point I see connected to this question is:
19When the handler declares a non-constant object, any changes to that
object will not affect the temporary object that was initialized by
execution of the throw-expression. When the handler declares a refer-
ence to a non-constant object, any changes to the referenced object
are changes to the temporary object initialized when the throw-expres-
sion was executed and will have effect should that object be rethrown.
But this is confusing to me because it seems that is possible to modify a
const exception while it is not possible to modify a non const exception:
which is exactly the contrary that I would expect !
like:
<br />
catch ( BasicException& e ) {<br />
e.setMessage( e->getMessage() + " some more informations here " );
throw;
}<br />
<br />
catch ( const BasicException& e ) {<br />
e.setMessage( e->getMessage() + " some more informations here " );
throw;
}
Thank you in advance for any answer
Marcello
P.S.
If it is not clear enough what I need to do, here is an example:
<br />
typedef std::basic_string<VCFChar> String;<br />
<br />
class BasicException : public std::exception {<br />
public:<br />
BasicException( const VCF::String & message ) {<br />
message_ = message;<br />
}<br />
<br />
void setMessage( const VCF::String & message ) {<br />
message_ = message;<br />
}<br />
String getMessage () {<br />
return message_;<br />
}<br />
String message_;<br />
}<br />
<br />
<br />
class A {<br />
void f() {<br />
bool error = true;<br />
if ( error ) {<br />
throw BasicException( "original message" );<br />
}<br />
}<br />
<br />
void g() {<br />
try {<br />
f();<br />
}<br />
catch ( BasicException& e ) {<br />
e.setMessage( e->getMessage() + " some more informations here " );<br />
throw;
}<br />
};<br />
<br />
int main(int argc, char *argv[])<br />
{<br />
A a;<br />
try {<br />
a.g();<br />
}<br />
catch ( BasicException& e ) {<br />
cout << e.getMessage() << endl;<br />
}<br />
}<br />
|
|
|
|
|
The paragraph states precisely what one would expect, i.e that non-const references to exception objects allow for modyfing and the changes will go up the stack if the object is rethrown. That is, no surprises here.
If you read it carefully, the first part says a non-constant object, as in
catch(BasicException e) and the second refers to non-constant references as in
catch(BasicException& e) In the first case, what the catch handler gets is a copy of the thrown object, exactly as when you call a regular function with signature foo(BasicExceotion e) . In the second case, you get a reference to the original object and modifying can be done freely.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thank you very much
I guess my neurons started crossing with each other
Sometimes the C++ specifications language is very hard to follow
Now this is very clear
Cheers,
Marcello
|
|
|
|
|
Hello there,
I'm getting these linker errors when I compile and execute my VC++ MFC OpenGL application.
I've included the header files for OpenGL.
I've checked all functions for correct parameter type.
Open.obj : error LNK2001: unresolved external symbol __imp__wglMakeCurrent@8
Open.obj : error LNK2001: unresolved external symbol __imp__wglCreateContext@4
Open.obj : error LNK2001: unresolved external symbol _gluPerspective@32
Open.obj : error LNK2001: unresolved external symbol __imp__glLoadIdentity@0
Open.obj : error LNK2001: unresolved external symbol __imp__glMatrixMode@4
Open.obj : error LNK2001: unresolved external symbol __imp__glViewport@16
Open.obj : error LNK2001: unresolved external symbol __imp__glHint@8
Open.obj : error LNK2001: unresolved external symbol __imp__glDepthFunc@4
Open.obj : error LNK2001: unresolved external symbol __imp__glEnable@4
Open.obj : error LNK2001: unresolved external symbol __imp__glClearDepth@8
Open.obj : error LNK2001: unresolved external symbol __imp__glClearColor@16
Open.obj : error LNK2001: unresolved external symbol __imp__glShadeModel@4
Open.obj : error LNK2001: unresolved external symbol __imp__glEnd@0
Open.obj : error LNK2001: unresolved external symbol __imp__glVertex3f@12
Open.obj : error LNK2001: unresolved external symbol __imp__glColor3f@12
Open.obj : error LNK2001: unresolved external symbol __imp__glBegin@4
Open.obj : error LNK2001: unresolved external symbol __imp__glTranslatef@12
Open.obj : error LNK2001: unresolved external symbol __imp__glClear@4
Debug/Gest_Rep.exe : fatal error LNK1120: 18 unresolved externals
Any ideas whats wrong?
Thanks in advance.
|
|
|
|
|
Looks like you forgot to actually link to the opengl libraries. Do it and the errors will go away.
--
I am perpetual, I keep the country clean.
|
|
|
|
|
Did it and the errors went away
|
|
|
|
|
Given an executable compiled using VC++ (unmanaged), is there a way to identify if the EXE is a debug or release build? Obviously, if you had the two builds side by side, the larger would be the debug, but is there a way to detect if the EXE is a debug build?
Regards
|
|
|
|
|
Well one way would be to check its DLL dependancies and if it was using the MFC/CRT Debug DLL's you'd now. There are probably better ways.
IMO Debug .EXE's should be able to identified by their filename, in the same way Debug DLL's are.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
how about
#ifdef _DEBUG
/* do something here */
#endif
is that what you were asking?
~LizardWiz()
|
|
|
|
|
No, I was looking more for something to determine if a selected EXE is a debug build or not. Not from within code, but if someone just hands you an EXE, how can I determine if it is a DEBUG build.
I think Neville answered my question...just wish there was a little easier solution. I was hoping for something more programmatic...an app I could drag and drop an EXE into or a shell extension that I could use to right click and select on an EXE in Explorer.
thanks for the response, though.
|
|
|
|
|
I have some code that I am having problems with. In the destructor. It is pretty straight forward:
[quote]
{
if( m_pData != NULL )
{
delete [] m_pData;
}
}
[/quote]
I am compiling and running this through MS Visual C++ 6.0. When I create a debug version, and then step through it, it fails at the delete [] m_pData line. I get the following error:
[quote]
"Debug Error!
Program: D:\MyProg\Debug\MyProg.exe
DAMAGE: after Normal block (#55) at 0x04730068.
(Press Retry to debug the application)"
[/quote]
I then hit retry, and I recieve:
[quote]
"User Breakpoint called from code at 0x40cecf"
[/quote]
The debugger is now pointing to:
[quote]
if (!CheckBytes(pbData(pHead) + pHead->nDataSize, _bNoMansLandFill, nNoMansLandSize))
_RPT3(_CRT_ERROR, "DAMAGE: after %hs block (#%d) at 0x%08X.\n",
szBlockUseName[_BLOCK_TYPE(pHead->nBlockUse)],
pHead->lRequest,
(BYTE *) pbData(pHead));
[/quote]
in VC98\CRT\SRC\DBGHEAP.C
When I switch to build a release version, I do not get this error.
What is going on, and how can I fix this.
-Drew
|
|
|
|
|
You need to fix the likely underlying buffer overrun.
(You don't get this error in release because the debug checks are turned off.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
This is what I was afraid of. This is code I have used before(I haven't changed anything). But it has worked fine before without this error. I have located the place where I am filling m_pData and it reads:
[quote]
m_pData = new unsigned char[bitmapInfoHeader->biSizeImage];
if( m_pData == NULL )
{
return false;
}
fread( m_pData, 1, bitmapInfoHeader->biSizeImage, fp );
fclose( fp );
[/quote]
if I change the initial line to:
m_pData = new unsigned char[bitmapInfoHeader->biSizeImage+1];
it works fine.
How is the fread reading in extra data?
Am I misunderstanding how fread works? Am I looking at the wrong part of my code, and this fixes it, but isn't really what causes the problem?
-Drew
|
|
|
|
|
It doesn't look like the fread is causing the problem. One way to verify this is to delete m_pData immediately after the fread() and see if an error is emitted.
(This is where BoundsChecker is invaluable, but its hard to convince the people with the money into getting it. I've been trying for months at my current job to no avail.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Thanks for helping with this. I do:
delete [] m_pData;
right after the fread function. Now I am getting the following error:
"The instruction at "0x00405f3b" refereced memory at "0x04731000". The memory could not be "read"."
This is familiar, but I still can't figure out why fread is doing this. If I do the delete later after I manipulate the memory, I get the previously mentioned error. Does this prompt any ideas about what might be going on?
-Drew
|
|
|
|
|
Are you opening the file in binary mode?
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Yes, I am opening it in binary. I believe it is supposed to be(this is an image file). I am using:
if( ( fp = fopen( fileName, "rb" ) ) == NULL )
{
return false;
}
I changed it to "r", and the same problem happened.
|
|
|
|
|
bool CTexture::LoadBMPTexture( char *fileName )
{
BITMAPINFOHEADER texInfo;
if( m_pData != NULL )
{
delete [] m_pData;
m_pData = NULL;
}
if( !LoadBMPFile( fileName, &texInfo ) )
{
if( m_pData != NULL )
{
delete [] m_pData;
m_pData = NULL;
}
return false;
}
if( m_pData == NULL )
{
delete [] m_pData;
m_pData = NULL;
return false;
}
m_nWidth = texInfo.biWidth;
m_nHeight = texInfo.biHeight;
m_pPalette = NULL;
m_nScaledHeight = 0;
m_nScaledWidth = 0;
m_TextureType = BMP;
return true;
}
bool CTexture::LoadBMPFile( char *fileName, BITMAPINFOHEADER *bitmapInfoHeader )
{
FILE *fp;
BITMAPFILEHEADER bitmapFileHeader;
unsigned int imageIdx = 0;
unsigned char tempRGB;
if( ( fp = fopen( fileName, "rb" ) ) == NULL )
{
return false;
}
fread( &bitmapFileHeader, sizeof( BITMAPFILEHEADER ), 1, fp );
if( bitmapFileHeader.bfType != BITMAP_ID )
{
fclose( fp );
return false;
}
fread( bitmapInfoHeader, sizeof( BITMAPINFOHEADER ), 1, fp );
fseek( fp, bitmapFileHeader.bfOffBits, SEEK_SET );
if( m_pData != NULL )
{
delete [] m_pData;
m_pData = NULL;
}
m_pData = new unsigned char[bitmapInfoHeader->biSizeImage];
if( m_pData == NULL )
{
return false;
}
fread( m_pData, 1, bitmapInfoHeader->biSizeImage, fp );
fclose( fp );
if( m_pData == NULL )
{
delete [] m_pData;
m_pData = NULL;
return false;
}
for( imageIdx = 0; imageIdx < bitmapInfoHeader->biSizeImage; imageIdx += 3 )
{
tempRGB = m_pData[imageIdx];
m_pData[imageIdx] = m_pData[imageIdx + 2];
m_pData[imageIdx + 2] = tempRGB;
}
return true;
}
|
|
|
|
|
The problem is that you are overrunning the buffer in your last for loop.
Even if you were handling the image correctly, which you are not, the correct for statement should be:
for( imageIdx = 0; imageIdx < bitmapInfoHeader->biSizeImage - 2; imageIdx += 3 )
(Note the "-2", in the loop you read/write "imageIdx + 2")
A bigger problem is all rows in a bitmap are aligned to a DWORD boundary. You algorithm will fail if ((width * 3) % 4 != 0)
The loop fails because there are padded bytes which means that biSizeImage is not divisable by three.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|