Re: Steganography MFC program problem...
On Sat, 09 Jun 2007 14:35:54 -0700, anantnigam03@rediffmail.com wrote:
Thanks for the reply.
That is fixed and working now.
You're welcome.
...it gives me error saying "encrypted_message.steg NOT FOUND."...
well what could be the problem in this case...the code snippet is same
rr.Remove(_T("encrypted_message.steg")); //ERROR->
"encrypted_message.steg NOT FOUND"
The error is explicit: the file "encrypted_message.steg" cannot be
found. Have you created this file in previous part of your code? You
also might want to explore the folder with Windows shell, to see if
this file exists (it should not exist, considering the above error
message).
which i posted in my last post ..and ya ill also copy my OnHide button
code and commenting exactly where i am getting error...
Also if you ll see right at the bottom of my last code snippet there
are 2 while loops (i.e. while(message_encrypt_file)) well cursor is
jumping out from this loop. It is not getting this file....
message_encrypt_file.open("encrypted_message.steg", ios::in|
ios::binary);
i=0;
while(message_encrypt_file)
message_encrypt_file.open("encrypted_message.steg",ios::in|
ios::binary);
i = 0;
while(message_encrypt_file)
message_encrypt_file.get(message[i++]);
Are you speaking about this code?
Well, you're trying to open the file "encrypted_message.steg" for
reading in binary mode. Does this file exist? Did you create this
file?
If you want to check if the file really exists, you could use the
is_open method after calling open method, i.e.:
message_encrypt_file.open("encrypted_message.steg", ios::in|
ios::binary);
if ( ! message_encrypt_file.is_open() )
{
// *** ERROR HERE ***
// Cannot open the file, maybe the file does not exist.
...
... manage error ...
...
}
Moreover, your code structure seems to me not correct; I don't
understand why you put a while and then the .open method call inside
the while body...
Instead, the code could be like this:
//
// Try opening the file for reading
//
message_encrypt_file.open("encrypted...." ... );
if ( ! message_encrypt_file.is_open() )
{
... Manage error ...
}
//
// File open successfully.
// Read data from file
//
i = 0;
while ( message_encrypt_file )
message_encrypt_file.get(...);
void CSTEGANOGRAPHYDlg::OnHide()
{
// TODO: Add your control notification handler code here
UpdateData();
CProgressCtrl *Progress = new CProgressCtrl;
Progress =
reinterpret_cast<CProgressCtrl*>(GetDlgItem(IDC_PROGRESS1));
CEdit *kk;
kk = reinterpret_cast<CEdit *>(GetDlgItem(IDC_STATIC575));
This code has several things that need to be fixed...
For example: you created a new CProgressCtrl using 'new', but then you
assign to the pointer 'Progress' the result of a GetDlgItem call. In
this way, you are loosing the original pointer to CProgressCtrl
allocated with 'new', so you are having a *memory leak* here.
Moreover, I would reccommend to *not* use GetDlgItem, but instead use
*control variables* (you might want to see other threads in this
newsgroup about using control variables instead of GetDlgItem, like
the recent thread with subject "Check a radio button").
MrAsm