|
Hello,
this occurs when i try to sort my vector, and no other place!
int compare_f(CMyObject a, CMyObjectb)
{
if(0 > a.csName.Compare(b.csName))
return -1;
else if(0 < a.csName.Compare(b.csName))
return 1;
else
return 0;
}
regards
termal
|
|
|
|
|
Can anyone help me with saving a text introduced in a text button in a different file?
|
|
|
|
|
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
Anka_Ame wrote: Can anyone help me with saving a text introduced in a text button in a different file?
WTF?
|
|
|
|
|
Can you be more specific.
|
|
|
|
|
Hi
I have created db with fields as -
<br />
properties[0].wVersion = CEPROPSPEC_VERSION;<br />
properties[0].propid = MAKELONG(CEVT_LPWSTR, 0x0001);<br />
properties[0].pwszPropName = TEXT("ImagePath");<br />
properties[0].cchPropName = 9;<br />
properties[1].wVersion = CEPROPSPEC_VERSION;<br />
properties[1].propid = MAKELONG(CEVT_I4, 0x0002);<br />
properties[1].pwszPropName = TEXT("ImageStatus");<br />
properties[1].cchPropName = 11;<br />
<br />
m_pSortOrderList[0].wVersion = SORTORDERSPECEX_VERSION; <br />
m_pSortOrderList[0].wNumProps = 1;<br />
m_pSortOrderList[0].wKeyFlags = 0;<br />
m_pSortOrderList[0].wReserved = 0;<br />
m_pSortOrderList[0].rgPropID[0] = MAKELONG(CEVT_LPWSTR, 0x0001);<br />
m_pSortOrderList[0].rgdwFlags[0] = CEDB_SORT_CASEINSENSITIVE;<br />
<br />
it will sucessfully create db.
I inserted followeing element as .
<br />
record[0].propid = MAKELONG(CEVT_LPWSTR, 0x0001);<br />
record[0].val.lpwstr = TEXT("test1.bmp");<br />
<br />
record[0].propid = MAKELONG(CEVT_LPWSTR, 0x0001);<br />
record[0].val.lpwstr = TEXT("test2.bmp");<br />
<br />
record[0].propid = MAKELONG(CEVT_LPWSTR, 0x0001);<br />
record[0].val.lpwstr = TEXT("book1.bmp");<br />
<br />
record[0].propid = MAKELONG(CEVT_LPWSTR, 0x0001);<br />
record[0].val.lpwstr = TEXT("book2.bmp");<br />
when i search in db as -
<br />
CEPROPVAL seek_record[1];
::ZeroMemory(seek_record , sizeof(CEPROPVAL)*1);<br />
seek_record[0].propid = MAKELONG(CEVT_LPWSTR, 0x0001);<br />
seek_record[0].val.lpwstr = TEXT("test1.bmp");<br />
<br />
oidSeek = CeSeekDatabaseEx(m_hDBase, CEDB_SEEK_BEGINNING, 0, 0, NULL);<br />
if(oidSeek == NULL){<br />
return(false); <br />
}<br />
oidSeek = CeSeekDatabaseEx(m_hDBase, CEDB_SEEK_VALUEFIRSTEQUAL, (DWORD) <br />
seek_record, 1, NULL);<br />
It will sucessfully return oid of record.
But if search for book1 as -
seek_record[0].val.lpwstr = TEXT("book1.bmp");
then it will return zero for oidSeek,it gives me the ERROR_INVALID_PARAMETER as an error.
Does any one has any idea why this is happen.
If u have any suggestion or solution then please reply.
Thanks
-- modified at 9:51 Thursday 26th April, 2007
|
|
|
|
|
Hi,
I need some help. I'm trying to figure out the correct way to expose a "static const CString" value belonging to a class defined in an MFC DLL.
I have a class that I've encapsulated in a regular MFC DLL. The associated ".h" file looks like this:
class __declspec(dllexport) MyClass
{
public:
static const CString MY_CONST_STRING;
MyClass();
virtual ~MyClass();
void myFunc();
};
I have defined the value of MY_CONST_STRING in the class' ".cpp" file:
#include "MyClass.h"
const CString MyClass::MY_CONST_STRING = "Hello";
Although clients using the DLL can access the class (e.g., instantiate objects, call its member functions), they cannot seem to access the definition of the CString constant I have defined. When they try, they receive the following linker error:
error LNK2001: unresolved external symbol
I've defined CString constants this way in the past and referenced them without any problems, but this is the first time I've used one that was defined in an external MFC DLL class. I'm sure there's a simple answer.
Any and all help appreciated.
Thanks.
Peter
|
|
|
|
|
It is not good solution to export objects, better would be a native type (here const char*). There are same case in which object export leads to trouble: delay-load, and different version of the object (Linker-Builds).
This isnt an anwser, but a solution.
Greetings from Germany
|
|
|
|
|
A static object (or basic type) cannot be exported from a DLL. Your problem here is the static keyword, the variable will have internal linkage.
|
|
|
|
|
Thanks for your response.
Any suggestions on how I could expose a constant "string" value within my DLL?
Peter
|
|
|
|
|
I've done the exact same thing except that I'm not using an MFC Dll. I'm using a regular DLL with MFC enabled. I had no problem with it there ...
|
|
|
|
|
My "MFC DLL" is a regular DLL that uses the MFC library (in a shared DLL) created using "Add/New Project/Visual C++ Projects/MFC DLL"...
How did you create your "regular DLL with MFC enabled"?
Peter
|
|
|
|
|
I'm using VC2005 - I created a Win32 project, then selected "DLL" and checked the MFC check-box.
|
|
|
|
|
I'm using Visual Studio .NET 2003 to build my VC++ application.
When I attempt to create a "Add.../New Project.../Win32/Win32 Project" with an "Application type" of "DLL", the "Add support for: MFC" checkbox is greyed out (i.e., unavailable).
According to MSDN "You cannot add MFC or ATL support to a DLL application" - using the Win32 Project wizard anyway.
I guess in VC2005 they changed this restriction.
Peter
|
|
|
|
|
Remove the static keyword and initialize the variable in the constructor initialization list (errr... I always forget how this is called ):
MyClass::MyClass() :
MY_CONST_STRING("Constant String"),
MY_SECOND_CONST_STRING("Another String")
{
}
|
|
|
|
|
I appreciate your help but defining the string constant as you have suggested will yield the following error when a DLL client attempts to reference it:
error C2597: illegal reference to non-static member 'MyClass::MY_CONST_STRING'
I would like clients using my DLL to be able to reference the string constant directly like this:
CString newString(MyClass::MY_CONST_STRING);
or say, like this:
::AfxMessageBox(MyClass::MY_CONST_STRING);
...without having to create an instance of MyClass or having MyClass define any static methods which return the value of MY_CONST_STRING.
Any ideas?
Peter
|
|
|
|
|
Hi,
In my project simply encrypt data using XOR operator ,Then write encrypted data in file using fwrite function in MFC.
Problem is occure only possible to decrypt pice of data from encrypted file.
For example ,
File1:Input File size(6kb)
FIle2:Encrypt File size(5kb)
File3:Decrypt File size(1kb)
coding:
Encrypt:
while(!feof(file1))
{
int iout;
fread(&iout,sizeof(iout),1,file1);
iout^=1300;
fwrite(&iout,sizeof(iout),1,file2);
}
Decrypt:
while(!feof(file2))
{
int iout;
fread(&iout,sizeof(iout),1,file2);
iout^=1300;
fwrite(&iout,sizeof(iout),1,file3);
}
Note :
NoProblem occur when if XOR with value of 10
while(!feof(file1))
{
int iout;
fread(&iout,sizeof(iout),1,file1);
iout^=10;
fwrite(&iout,sizeof(iout),1,file2);
}
Please replay me urgently
-- modified at 8:40 Thursday 26th April, 2007
|
|
|
|
|
mohindar_kks wrote: Problem is occure only possible to decrypt pice of data from encrypted file.
This is a bit unclear. What exactly is the problem? Are you concerned that file1 (the original) and file3 (the decrypted) are not the same? You'll likely see the same problem even if you omitted the XOR statement.
Try:
while (! feof(file1))
{
char iout;
if (fread(&iout, sizeof(iout), 1, file1) == 1)
{
iout ^= 1300;
fwrite(&iout, sizeof(iout), 1, file2);
}
}
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi,
In my project simply encrypt data using XOR operator ,Then write encrypted data in file using fwrite function in MFC.
No problem in Decryption if successfully retrive data from encrypted file until EOF. But some time encrypted file automatically return EOF after postion of data retrive this data also decrypted successfully.
For example ,
File1:Input File size(6kb)
FIle2:Encrypt File size(5kb)
File3:Decrypt File size(1kb)
coding:
Encrypt:
while(!feof(Inputfile))
{
int iout;
fread(&iout,sizeof(iout),1,Inputfile);
iout^=1300;
fwrite(&iout,sizeof(iout),1,encryptfile);
}
Decrypt:
while(!feof(encryptfile))
{
int iout;
fread(&iout,sizeof(iout),1,encryptfile);
iout^=1300;
fwrite(&iout,sizeof(iout),1,decryptfile);
}
Note :
NoProblem occur when if XOR with value of 10
while(!feof(Inputfile))
{
int iout;
fread(&iout,sizeof(iout),1,Inputfile);
iout^=10;
fwrite(&iout,sizeof(iout),1,encryptfile);
}
Please replay me urgently
|
|
|
|
|
char iout;
...
iout ^= 1300;
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Bad, yes. Part of the problem, no. His two major problems were not checking the return value from fread() , and trying to read byte s from the disk as int s.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi all,
When using the SHFileOperation function to copy a folder from one destination to another, but the folder already exists, and the SHFileOperation function brings up a dialog that asks whether or not to replace the existsing folder, Q: is it possible to send a message to that dialog to answer the question, so that the user is not involved.
Makes sense??
Many Thanks.
Regards,
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
My Blog: ^_^
|
|
|
|
|
|
Yeah I'd recommend using the FOF_SILENT flag
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|