|
dwLength = sizeof(TCHAR)*_tcslen(m_tContents);
BYTE *pbBuffer = (BYTE *)malloc(dwLength);
if (pbBuffer != NULL)
{
memcpy(pbBuffer, m_tContents, dwLength);
if (CryptEncrypt(hKey, 0, TRUE, 0, pbBuffer, &dwLength, dwLength))
{
m_strResultingText.Format("%s",pbBuffer);
CString strShow;
strShow.Format("After: %s %d %d ", m_strResultingText, dwLength, m_strResultingText.GetLength());
MessageBox(strShow);
}
why does this show:
After: encrypted-text 2359 225
Its been really buging me (no pun intended)
-Steven Hicks
CPACodeProjectAddict
|
|
|
|
|
There's probably a zero byte at position 225 in the encrypted data. Once encrypted, you should treat the encrypted data as just any other array of bytes, not as a C-style string.
If you need to pass the data through some channel that isn't fully 8-bit clean, you should encode it, perhaps using hex, Base64, UUEncode, ...
|
|
|
|
|
Hi,
I have two LPCWSTR and I want to compare them to find if they are same string. How do I use trim() function on LPCWSTR so that I can trim them before comparing?
|
|
|
|
|
// This program is a test to verify whether or not the theory illustrated
// in Digital Fundamentals pg60 of 32 bit binary number recognition, is
// applicable with regards to an AMD 1.4 Ghz processor.
#include<iostream>
#include<climits>
#include<cmath>
using namespace std;
int mantissa;
int max_integer=0;
int temp=0;
int main()
{
mantissa = 30;
while(mantissa!= -1)
{
temp = pow(2,mantissa);
max_integer = max_integer + temp;
--mantissa;
}
cout<
|
|
|
|
|
// So if the maximum integer possible on this machine uses 31 bits, and this is a 32 bit
// processor, what is the other bit used for?
For the sign. Compare this with unsigned int s, which, as they do not store any sign, can be twice as large (plus one) as the maximum int .
PS: I don't really understand the code, though, looks interesting, will have a look at it.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi
I have a program that needs to open a file.
the name of the file will be typed in a textBox in the form.
my question is how can i open this file?
working with console application. I usually asked the user to input a char array. and then
char file[20];
cin>>file;
infile.open(file, ios::binary | ios::in);
but now what I get from a text box is :
String *s=textBox->Text;
and I dont know how to convert this CAPITAL Strint to a normal char array?
by the way does any one have a folder browsing code with c++?
thanks;)
maryam
|
|
|
|
|
1. when i SetFont() for a CEdit, it'll show only fonts larger than the 8pt (i specifically use "MS Sans Serif"). how can i cure this?
2nd issue is how to shrink the "selected" CEdit rectangle (single line), it seems it has nothing to do with actual CEdit window size?
Much obliged.
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
Email: y_becker@netvision.net.il
|
|
|
|
|
I want to prevent the rebar from dropping onto the next line when my main window is resized.
I tried handling CMainFrame::OnChildNotify() and returning FALSE for RBN_AUTOSIZE...i've specified RBS_AUTOSIZE when creating a Rebar, what am I doing wrong...?
Anyone have any idea what I"m doing wrong...?
Thanks
The word of the day is legs, let's go back to my house and spread the word
|
|
|
|
|
Does anyone know the right way to get the ASCII code to a character. Because i made a program that reads in a string of text and then uses keybd_event() to output all the characters again, but it gets all messed up when i just use the integer value of the characters in my program...
Kuniva
--------------------------------------------
|
|
|
|
|
Can you post the section of code?
|
|
|
|
|
char message[1024];
cout << "Message: ";
cin >> message;
for(int t=0;t<(strlen(message));t++)
{
keybd_event(message[t]-32,0,0,0);
keybd_event(message[t]-32,0,KEYEVENTF_KEYUP,0);
}
The -32 is to make lowercase letters work, but thats it.
Kuniva
--------------------------------------------
|
|
|
|
|
I want to do add a "working" animated bitmap or avi that plays in the top right of my application when it's working.
This would be the same functionality that Internet Explorer has at the top right of it's application.
Looking at IE, the animation is actually at the far right of the main menu bar.
I sort of remember that in old versions of windows, you could position a help menu at the far right. Presumably this technique might be combined with adding a new control, but I've not figured out how to do this.
I've done some searching on various sites, and found nothing. I thought that was surprising, since most applications want to emulated IE.
Can anyone point me to a technique that might bear fruit?
Thanks!
Gene
|
|
|
|
|
IE uses toolbars for everything - its frame window doesn't have an actual menu. That little logo is actually a nonresizable band in the rebar.
If your app has an actual menu, you can set the "Help" style on the rightmost item in the main menu, and owner-draw it.
--Mike--
Ericahist | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber
Four fonts walk into a bar. The bartender says "Hey - get out! We don't want your type in here."
|
|
|
|
|
Funny, because I've just done that
Great minds think alike
Cheers
The word of the day is legs, let's go back to my house and spread the word
|
|
|
|
|
You mean that every one who does owner drawn menus are great?????
Destroy the constitution coz they make the politicians.
|
|
|
|
|
I have a 16-bit application to which I've manually added some new controls to a form in the .rc file. I've also updated the resource.h file and the relevant implementation files. The project builds but with the result that the form no longer displays itself when invoked. I've managed to establish that OnInitialUpdate does not get called. However, when the form is opened in the resource editor (I'm using VC++ 1.51) the added controls are visible.
Does anyone know of any issues to be aware of when performing manual edits to a .rc file?
If I remove the entries from the .rc file and comment out the referneces in the .cpp file, the form shows itself as usual.
My additions to the .rc file look like this:
LTEXT "Term",IDC_STATIC,145,22,18,8
CONTROL "%nW###",IDC_EDIT_TERM,"HEdit",WS_BORDER | WS_TABSTOP |
0x200,168,22,19,12
CONTROL "",IDC_SCROLL_TERM,"MicroScroll",0x1,188,22,11,12
Kevin
|
|
|
|
|
Did you remember to register the HEdit and MicroScroll window classes? From my dim recollection of Win16 (and I have to ask - why the heck are you extending a Win16 application??) you only have to register a window class once, when the first instance of your application starts up.
Otherwise, no suggestions, sorry.
|
|
|
|
|
What do you mean by register? Do you mean stuff like this?
#include "spin.h"
IMPLEMENT_DYNAMIC(CSpinControl, CWnd)<br />
<br />
BOOL CSpinControl::Create(DWORD dwStyle, const RECT& rect,<br />
CWnd* pParentWnd, UINT nID)<br />
{<br />
return CWnd::Create("MicroScroll", NULL, dwStyle, rect, pParentWnd, nID);<br />
}<br />
<br />
WNDPROC* CSpinControl::GetSuperWndProcAddr()<br />
{<br />
static WNDPROC pfnSuper;<br />
return &pfnSuper;<br />
}
The reason I'm extending a Win16 application is because that's what the client wants!
Kevin
|
|
|
|
|
I mean a call to RegisterClass for that window class, or a call to a function provided by the library that performs that task.
All you initially get in Win16 are the classes registered by USER: the basic "Button", "Combobox", "Edit", "ListBox", "ScrollBar", "Static" etc. MFC registers a number of classes for you as well; it automatically registers a window class for your main frame window, for example.
|
|
|
|
|
Hi,
In my program I want to use List Separators according to the regional settings ("," for english, ";" default for german etc). Can anyone tell me where to find any API to use the regional settings for the list separator.
Thanks.
|
|
|
|
|
GetLocaleInfo, passing LOCALE_SLIST for the LCType parameter.
|
|
|
|
|
|
Does anyone know how I could color a specific piece of text in a listbox? For instance, I'm doing this:
sprintf(buf1, "%s%s%s", retrace, saved_item, forward);
SendMessage(result_list,LB_ADDSTRING,0,(LPARAM) (LPCTSTR) buf1);
I would like to color the middle string as red or something. It was my hope that there was some sort of color code I could simply place before the %s, like.. the old fashioned \x1B[31m or whatnot.. but that doesn't work. I can't find a list of any codes anywhere.. not even for symbol replacement (for instance, simply putting in \x1B will translate to an arrow-type of thing).
Any and all help would be appreciated..
Thanks guys
Kelly
|
|
|
|
|
One way to do this would be to create an owner drawn list box and interpret the color codes in the displayed string. This article will provide an introduction to writing an owner drawn listbox if you're not familiar with them.
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
|