|
In OnInitalUpdate just call CenterWindow();
|
|
|
|
|
>In OnInitialUpdate just call CenterWindow();
That might just work... for an MDI child window, not a SDI view!!
Yours,
Brian Hart
|
|
|
|
|
Hi folks,
I am writting a program that Encrypts/Decrypts files (using CFile). It works fine when I do Text files, but when I do an .exe (Decrypting), it puts a different char?? could this have to do with the way I'm reading in the File (mode)?
I have tried using it in Binary Mode and still the same!
NOTE: All of the characters (placement) are correct, its just that in the .exe there is NOT all of the little rectangular chars...its empty (visually) space (see below).
===========================================================
MZÿÿ¸@躴 Í!¸LÍ!This program cannot be run in DOS mode.
===========================================================
Here is some code:
// Open the file to be read
if( cfEnFile.Open( LPCTSTR(csFileName), CFile::modeReadWrite | CFile::typeBinary, &e ) ) {
// Get the length of the file
DWORD dwSize = cfEnFile.GetLength();
cfEnFile.SeekToBegin();
// fill the buffer with the information from file
UINT nBytesRead = cfEnFile.Read( szBufRead, (UINT)dwSize); //(UINT) dwSize );
...
...
...
for (int n=0; n<(int)nBytesRead; n++) {
CString csEnByte = szBufRead[n];
m_AESCrypt.TransformString(csRegUPPRead, csEnByte);
csBufBytes += csEnByte;
}
sprintf(szBufWrite, "%s", csBufBytes);
cfEnFile.SeekToBegin();
// Write the buffer to the file
cfEnFile.Write( szBufWrite, (UINT)dwSize);
}
Is there anyone who can help!!!!!
Thanks in advance!
Dan
|
|
|
|
|
Since you indicate that it works with TEXT files but not EXE files, likely there is a 7 bit character dependancy within your code. However I can not see that from the code that you have posted. Possibly something within the 'TransformString' method is not dealing with the 8th bit correctly.
HTH.
|
|
|
|
|
Hey Dan,
Not to burst your bubble or anything, but posting an encryption hash algorithm with full commenting to the Web is not going to make your program very secure.
(Or I suppose you trust us fellow programmers!) Anyway, I suppose it won't hurt, since this cryptography scheme is already published in "Applied Cryptography."
Brian Hart
|
|
|
|
|
in my program, i call a stored procedure in a SQL 7.0 database by executing an ADO command object, everything
goes well and the recordset is returned correctlly,but
i just could not update the recordset using PutCollect
method and the error complains that the provider dose
not surport the operation.
maybe someone can give me help.
|
|
|
|
|
Is there any way of printing an adobe pdf file using visual c++ 5.0 or higher?
Please, any response any one can give me will be greatly appreciated.
Sincerely,
Erich J. Ruth (an overworked graduate student)
|
|
|
|
|
Do a ShellExecute() on the PDF file, passing a verb of "print".
|
|
|
|
|
Mike,
Thank you for your reply. I can print a pdf file. Is there any way I can print text on top of the printed pdf file? That is, the user will input certain information. I want to print that information on top of the printed pdf file as it is printing. Is this possible?
Please, please, any response you can give me will be greatly appreciated. Details are cherished.
Sincerely,
Erich J. Ruth (an overworked graduate student)
|
|
|
|
|
hmm... That sounds like it'd be tricky. Since Acrobat (or the reader) does the printing all on its own, you'd have to modify the PDF file or something for your idea to work.
Either that, or tell the user to reinsert the paper the PDF gets printed on so you can print your own text.
|
|
|
|
|
Erich,
I don't know if this is going to help you, but I noticed on http://www.activepdf.com that they offer .pdf construction and manipulation tools. I was looking at them from the ASP component (server side) perspective, but I'm sure they would have stuff you could use on the client side too. Maybe you should check them out.
|
|
|
|
|
Check out http://www.planetpdf.com . There are a lot of libraries for manipulating PDF files.
|
|
|
|
|
Can anyone recommend a class which will write to both a Windows 95 and a Windows 98 registry?
|
|
|
|
|
CRegKey in ATL.
This article: http://www.codeproject.com/system/chklm.asp
Other registry articles here and over at CodeGuru.
|
|
|
|
|
Hi
I`m in trouble with setting a bitmap in any row I want in ClistCtrl.
I have no problem to make a ImageList, but it put the same bitmap
in every row. I need to put any bitmap in any row I want.
The CListCtrl was made by MFC-Wizzard.
Can anybody help me ?
thanks,
Sascha
|
|
|
|
|
Post your code related to SetImage and imageList
|
|
|
|
|
I'm not sure, but I think that if you don't set an image explicitly for an item it gets the first from the imagelist.
Be sure to pass LVIF_IMAGE to SetItem in the 'mask' argument only for those items you want to have images.
I have no other ideas.
|
|
|
|
|
Hi,
Is it possible to change the menu which resides in the menu bar in run-time? I would to enable/disable pop-up menus which resides in the command bar menu.
I know how to modify menu item inside a menu but I don't know how to change the top pop-up menu.
Thanks,
Shai
|
|
|
|
|
Dear Shai,
Here's something that might help:
BOOL CMainFrame::DoChangeMenu()
{
CMenu menu;
if (!menu.LoadMenu(IDR_MYMENU))
return FALSE;
if (!SetMenu(&menu))
return FALSE;
DrawMenuBar(); // refresh menu bar with new menu
return;
}
Hope that helps!
|
|
|
|
|
Hi,
how can I detect whether an integer operation like a+b or exp(i) generates an overflow? When adding two big numbers like INT_MAX-4 and INT_MAX-25, the result will be negative and no error is generated. In mathematics, such overflows can also happen when using __int64 data type. Who has a solution?
Thanks
Andreas
|
|
|
|
|
You can test the overflow flag with the _asm instructions jno and jo. You can also explicitly invoke the integer overflow trap if you want to use exceptions:
void CTestDirDlg::OnButton2()
{
int a, b, c;
a = INT_MAX - 4;
b = INT_MAX - 25;
try {
c = a + b;
_asm {
jno wereOk;
int 4;
}
}
catch(...) {
MessageBox( "Overflow!", "Error");
}
wereOk:
return;
}
I realize there is the issue of portability here, but its one possible solution - could be refined. Using SEH you might be able to identify the EXCEPTION_INT_OVERFLOW exception with more certainty than the catch(...), and avoid the _asm.
You might not even want to throw the exception, just test the flag.
I think there is code out there somewhere that can convert these kinds of traps to C++ exceptions - or perhaps it would be better to just throw our own exception object, rather than invoking the processor trap. The trap might be useful if you want to enable first-chance exception handling for c0000095.
I can't seem to find a way to enable this trap in the way that we can enable floating point exceptions with controlfp.
|
|
|
|
|
OK, works fine. But what is with other operations like multiplication, and other data type like long or __int64?
|
|
|
|
|
How can I change resource for dialog form a meny in that dialog.
|
|
|
|
|
hi,
i am using MFC, i create a CDialogBar in a CRebar and my CDialogBar has 3~4 editboxes, however, i cannot uses ctrl+c or ctrl+v in these textboxes anymore and also cannot tabs thru the controls. the problem is so obvious so i think it must be something i missed.
pls help!!
gordon
|
|
|
|
|
Can someone please enlighten me about how to maximize the app's mainframe at startup? I have tried calling ShowWindow() from the InitInstance() and that doesn't do it. I've looked through the MS docs in the Visual Studio 6 and not come accross anything relevant (like a code snippet, for example!) Some pointers would be greatly appreciated!
One person suggested setting the style to WS_MAXIMIZE in PreCreateWindow() but that does not do it.
|
|
|
|