|
could someone post the executable source code of c++ encryption & decryption??
thanks in advance
|
|
|
|
|
"XOR encryption" doesn't exist, but I think you meant applying the key directly using the XOR operation to a buffer. Note that this way of "encrypting" something is VERY insecure and can be cracked on every computer in a few seconds (of course, if you use XOR encryption as a one-time-pad it cannot, but that's another thing).
Here's a source code snippet of using key-XOR to encrypt a buffer:
void XorEncryptDecrypt(unsigned char *pBuf, unsigned long uBufLen, char *pszPassword)
{
unsigned long i;
unsigned long j = 0, uMaxKey;
uMaxKey = (unsigned long)strlen(pszPassword);
for(i = 0; i < uBufLen; i++)
{
pBuf[i] ^= (unsigned char)pszPassword[j];
j++;
if(j == uMaxKey) j = 0;
}
}
This function encrypts and decrypts a buffer (i.e. there aren't two different functions for either encrypting and decrypting). But again: this method is very insecure. If possible, search the web for AES or Rijndael, that's a very secure cipher.
Best regards,
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
size_type rfind(E c, size_type pos = npos) const;
What exactly the rfind function does, explain with example
|
|
|
|
|
don't you want to have a look at the MSDN ?
TOXCCT >>> GEII power
|
|
|
|
|
|
Is it possiible to set font for not integer size ?
i.t font size = 10,556,
and it shows whith pixel precision, but not font interger precision ?
thanks
|
|
|
|
|
Hi
I had download one sample from Codeguru of Loading resource from .dll in main applications this is it's link :-
http://www.codeguru.com/Cpp/W-P/dll/article.php/c3637
In this sample Author has Made one MDI application in .dll and calling it's from Main application .In this .dll all resource in this .dll.
Now My question is How to Maintain Class information from .dll ? Because Like OnitDialog:: or OnMouseButton Event will included with dialog and dialog is in .dll But i dont' want to add events in .dll because it'll be same like .exe ...
I want to load only resource from .dll and for otherfucntion i want to add in main applications Because My project is Big ..So i want to add some directx function in Main application and resource will be .dll
So how can i do ?
thanx
|
|
|
|
|
I could really use some advice on how to implement a complex dialog I want to create.
Functionally, I would like an interface very similar to the new XP type MS common dialog FileOpen, even though it isn’t to be used for opening files.
Spy tells me that the FileOpen dialog has a couple of "Command Bars" a list control, and then some custom base class container.
As far as I know, the command bar approach requires docking the bar, which isn't easy to do in a dialog - you need a frame window to do that.
Here's what I would like to have in my dialog:
1) It should be a modal dialog.
2) The dialog should be resizable.
3) A vertical “command bar” type interface on the left with 5 main buttons. These should be drop targets so that the user can pick something from a listbox, drag and drop it onto one of the buttons. Looking as nice as the FileOpen control would be extra credit, but nice.
4) To the right of the command bar, I want to put a tree control and a list control in place, with a splitter between them. In one mode I might hide the tree window, but in other modes, I want them both to be visible and functional.
5) At top would be some controls, probably in a toolbar – a combo box is the main control needed.
6) At the bottom, similar controls as the common dialog – an edit box, and the OK/Cancel/Help buttons.
Again, my functional model seems a lot like the MS FileOpen dialog.
I’ve been working on this for some time, trying different tacks, and I’ve not yet succeeded in getting all the functionality I need.
For example, using articles from Code Project and Code Guru (thanks!) a resizable dialog with splitters and combos. I had problems getting the “control bar” working. I tried using bitmapped buttons, but was getting strange errors on redraw (they were owner drawn.) This is the route I’m still working on, but I’m not as happy with the “look” of the buttons, and was re-thinking the “control bar” approach.
I would welcome input! Thanks very much,
Gene Sewell
|
|
|
|
|
I'm writing some code to identify the class of CDialog controls.
I'm doing this within OnInitDialog().
My first hack at this is to loop through all of the children,
and do the following (Assuming children don't have children here):
CWnd* pChild = NULL;
pChild = (CWnd*)this->GetWindow(GW_CHILD);
....
while(pChild != NULL)
{
cName = pChild->GetRuntimeClass()->m_lpszClassName;
pChild = (CWnd*)pChild->GetNextWindow(GW_HWNDNEXT);
}
....
Ok, despite any errors in the code above, the code works and
loops through all of the children. The problem is that
"CTempWnd" is always returned. The reason this is a problem
is that it obscures the true identity of the control. I've
even tried using GetDlgItem(int nID). The return is always
"CTempWnd". I can't identify the class this way. Keep
in mind that I can access the control ID (IDOK/etc). If
there was some way of finding out the class by using the
dialog control ID, I'd do it.
Any help? In my dialog, in OnInitDialog(), I need to identify
all of the button controls (CButton). This is for the reason
that I want to Subclass them, though I don't know how many or
by what ID they carry.
Jon Wayne
|
|
|
|
|
Nevermind, did a search and found hte answer.
http://www.codeproject.com/script/comments/forums.asp?msg=514676&forumid=1647&XtraIDs=1647&searchkw=CTempWnd&sd=3%2F25%2F2003&ed=3%2F25%2F2004#xx517191xx
I don't know why CTempWnd was returned instead, although technically its true.
|
|
|
|
|
great !
if everybody could do so... and ask only interesting questions...
TOXCCT >>> GEII power
|
|
|
|
|
You are confusing MFC classes (e.g., CButton , CEdit , CDialog ) with Window classes (Button, Edit, #32770). The former is unknown at runtime, while the latter can be retrieved using GetClassName() .
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Load Resource's Bitmap To HBITMAP
I want to replace frame.LoadBmp("TextFrame.bmp") by frame.LoadBmp(IDB_BITMAP).
On other words,Original loaded picture by function "LoadImage", I want to load picture by Resouce's Bitmap.
HBITMAP hBitmap;//is member variable of CDibSection
hBitmap=uknownfunction(IDB_BITMAP)
How do I rewrite CDibSection::LoadBmp to Load Resource's Bitmap To HBITMAP?
PS:IDB_BITMAP is a Bitmap of Resoucre.
CDibSection frame;
////////////////
if (frame.LoadBmp("TextFrame.bmp")) {
HRGN h = frame.CreateRgn();
if (h)
SetWindowRgn(h, TRUE);
}
////////////////
// Loading BMP file
//
BOOL CDibSection::LoadBmp(const char *path)
{
Destroy();
hBitmap = (HBITMAP)::LoadImage(::GetModuleHandle(0), path, IMAGE_BITMAP, 0, 0,
LR_CREATEDIBSECTION | LR_LOADFROMFILE);
if (!hBitmap)
return FALSE;
DIBSECTION dib;
if (::GetObject(hBitmap, sizeof(DIBSECTION), &dib) != sizeof(DIBSECTION)) {
::DeleteObject(hBitmap);
hBitmap = 0;
return FALSE;
}
Header.Info = dib.dsBmih;
for (int i=0; i<3; i++)
Header.BitField[i] = dib.dsBitfields[i];
bytes_per_pixel = PixelBytes(dib.dsBmih.biBitCount);
bytes_per_line = ScanBytes(dib.dsBmih.biWidth, dib.dsBmih.biBitCount);
Bits = dib.dsBm.bmBits;
return TRUE;
}
|
|
|
|
|
I have an app using the CHtmlView to drive the user inteface.
I have a web page black.html, which is exactly that, a plain black page.
I have maximized the mainframe window but there is a 'very' thin white border around the 'right' and 'bottom' of the page. - How do i set this to black?
This is not an issue with margins etc in the web page. If i view the page in IE, the border disappears. It seems to be the Mainframe border.
I have tried:
Overriding OnEraseBkGround - for both CHtmlView + MainFrame
CBrush backBrush(RGB(0,0,0));
// Save old brush
CBrush* pOldBrush = pDC->SelectObject(&backBrush);
CRect rect;
pDC->GetClipBox(&rect); // Erase the area needed
pDC->PatBlt(rect.left, rect.top, rect.Width(), rect.Height(),
PATCOPY);
pDC->SelectObject(pOldBrush);
I still can't get rid of the thin white border - please help
Carl
|
|
|
|
|
I have a rtf app bsed on CRichEditCtrl ( an dialog box based app) and i want to paste a CF_METAFILEPICT in my app.How can I do this?Can anyone help me?
Thanks a lot.
|
|
|
|
|
How to convert a CHAR which contain a number to a INT or WORD ?
|
|
|
|
|
If it's char data, then strtol should help.
Steve S
|
|
|
|
|
if you have ONE digit in the CHAR '7' or '9'
you can do this:
char cCharValue = '9';
int nValue = cCharValue-'0';
if it is a CHAR* (a string)
you must use
atoi()
|
|
|
|
|
All the responses below are correct, but if you want to be extra-nice about it, have a look Boost Lexical cast[^]
|
|
|
|
|
<br />
int num = atoi("65");<br />
<code> <br />
<br />
Pain is a weakness living the body
|
|
|
|
|
Hi,
I want to convert a CString to COleDateTime. I'm using COleDateTime::ParseDateTime()and passing it the string as _T("1/25/1996 8:30:00") which is a valid format acc. to MSDN. But still, it is not working.
Does anyone have any idea of what could be wrong or what setting do I need to change in my workspace (or on my system) to use COleDateTime properly?
Regards,
Pravin
|
|
|
|
|
Are you sure the regional settings for the date on your computer are set to 'MM/dd/yyyy' (or somethoing like that )??
This may be the source of the problem...
|
|
|
|
|
From my testing, ParseDateTime() does not care about the regional settings. I use dd-MMM-yyyy H:mm for mine and I can pass a dozen different formats to ParseDateTime() all yielding correct results.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I haven't used enums in C++ for a while and now I am using one, but I'm running into something that I don't get. I'm using my enum in a switch statment and I'm doing this
switch (m_eDataType) {
case VerifyType::Ticket :
valid = VerifyTicket ();
break;
} When I compile this it tells me that "Ticket" is not a value of VerifyType. If I take off the type and scope identifier and it works fine, but isn't what I have above a valid way to identify an enum value? I know in C# I could qualify an enum value with it's type, but I guess that's because in C# the enumerator type is a full fledged class. The enum is declared in my classes header file outside the class declaration.
Thanks.
- Aaron
|
|
|
|
|
No. I experienced this myself and found out that an enum in C++ does not declare a new named scope, and so shouldnt be preceded with the type name.
You could convert the enum into a class and have it work the C# way - the enum could be unamed within a class, or as static member variables.
|
|
|
|