|
Where do you call AfxInitRichEdit()?
You must call it before the dialog is displayed!
A typical place to call this function is in your program’s InitInstance member function.
|
|
|
|
|
Thank you. I had put it in OnInitDialog() but now i have removed it to InitInstance() and i works so long.
Thanks again.
WBR
Edi
|
|
|
|
|
I have to translate the following statement from VB to VC++:
CodeKey = "TheKey"
For i = 1 To Len(DataIn)
intXOrValue1 = Asc(Mid(DataIn, i, 1))
intXOrValue2 = Asc(Mid(CodeKey, ((i Mod Len(CodeKey)) + 1), 1))
strDataOut = strDataOut + chr(intXOrValue1 XOr intXOrValue2)
Next
This is an encryption algorithm, composing strDataOut by xoring characters from the original string and the string to be encrypted.
I tryed to convertit like this:
CString CodeKey = "TheKey"
for(int i=0;i
|
|
|
|
|
char *lpCode = (char*)malloc(256 /* <> ??? */ * sizeof(char));
char *p = lpCode; // p points to lpCode's end
strcpy(lpCode, "TheKey");
int i1, i2;
for(int i = 0; i < DataIn.GetLength(); i++)
{
i1 = DataIn.GetAt(i);
i2 = *(lpCode + (i % (int)(p - lpCode));
strDataOut += (i1 ^i2);
}
this may not work because of the modulus operator. but the main thing is: CStrings::GetLength() returns the difference between the position of the NULL char in the string and the beginning of it. use pointers instead like p to count manually the bytes that were added so one knows through the difference (p - lpCode) lpCode's length.
hope this helps
|
|
|
|
|
How do I get the number of serial ports available under Windows 2000?
Prefer to have a solution using win32.
|
|
|
|
|
Look at HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM and see if that's at all helpful.
Tim
|
|
|
|
|
See Joaquín M López Muñoz's article here on CodeProject: Another serial port enumerator[^]
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Whether does exist Microsoft Visual C ++ for Windows64-bit (no PreRelease)? If yes, how to receive it.
VladimirH
|
|
|
|
|
I don't think there's even a pre-release. For the moment, you need to use the compiler from the Driver Development Kit[^].
|
|
|
|
|
You are mistaken. Pre-release exists.
|
|
|
|
|
Hi
I have a problem with PKZIP using MFC.
I run the PKZIP program but it gives me an error:
PKZIP: <e7> Can't create: PKBACK# 001
I have looked into 'E7' ... not enough permittions put i have all permittions to write in the needed folder.
Any ideas?
Jens
|
|
|
|
|
Are you using spanning?
Normally PKZIP labels the media it uses as it progresses.
Steve S
|
|
|
|
|
yes i use -span indeed
can i send you a print screen of the error to your email address if your willing to give it to me ?
Greetings
Jens
|
|
|
|
|
No point. The error message is concise and accurate, and unless it displays an error code wouldn't give me any more information.
How are you exec-ing PKZIP from within your app?
(Source more useful than a screen dump;))
Steve S
|
|
|
|
|
GURU's only!
I have a class "hidden" inside my main class, a kind of inner class if U like.
class a : public CObject<br />
{<br />
DECLARE_DYNCREATE(a)<br />
public:<br />
a();<br />
<br />
class b : public CObject<br />
{<br />
DECLARE_DYNCREATE(b)<br />
public:<br />
b();<br />
};<br />
};<br />
But the IMPLEMENT_DYNAMIC macro expansion baffles the compiller's brain
<br />
IMPLEMENT_DYNCREATE(a, CObject)<br />
IMPLEMENT_DYNCREATE(b, CObject)<br />
with the following messages:
error C2653: 'b' : is not a class or namespace name
error C2061: syntax error : identifier 'b'
I have tried everything but write my own body for CreateObject() so I can get runtime class info, doing
IMPLEMENT_DYNCREATE(a::b, CObject)<br />
Seems logical, but does not hel, since a is nit a namespace or so the compiller says.
Conrad - conradb@adroit.co.za
Always do badly to start off, that way when you get the hang of it suddenly, everyone is surprised.
|
|
|
|
|
I have since tried.....
<br />
typedef a::b NestedBase;<br />
<br />
IMPLEMENT_DYNCREATE(a, CObject)<br />
<br />
#define MYRUNTIME_CLASS(class_name) ((CRuntimeClass*)&a::b::b())<br />
<br />
#ifdef _AFXDLL<br />
<br />
#define MY_IMPLEMENT_RUNTIMECLASS(class_name, base_class_name, wSchema, pfnNew) \<br />
CRuntimeClass* PASCAL class_name::_GetBaseClass() \<br />
{ return RUNTIME_CLASS(base_class_name); } \<br />
CRuntimeClass* class_name::GetRuntimeClass() const \<br />
{ return MYRUNTIME_CLASS(class_name); } <br />
<br />
#else<br />
#define MY_IMPLEMENT_RUNTIMECLASS(class_name, base_class_name, wSchema, pfnNew) \<br />
CRuntimeClass* PASCAL class_name::_GetBaseClass() \<br />
{ return RUNTIME_CLASS(base_class_name); } \<br />
CRuntimeClass* class_name::GetRuntimeClass() const \<br />
{ return MYRUNTIME_CLASS(class_name); } <br />
<br />
#endif<br />
<br />
<br />
#define MYIMPLEMENT_DYNCREATE(class_name, base_class_name) \<br />
CObject* PASCAL class_name::CreateObject() \<br />
{ return new class_name; } \<br />
MY_IMPLEMENT_RUNTIMECLASS(class_name, base_class_name, 0xFFFF, \<br />
class_name::CreateObject)<br />
<br />
<br />
<br />
MYIMPLEMENT_DYNCREATE(NestedBase, CObject) <br />
...
but to no avail, since I cannot get the last bit of my MY_IMPLEMENT_RUNTIMECLASS macro to work (commented out)
hELP hELP HeLP HElp.
Conrad - conradb@adroit.co.za
Always do badly to start off, that way when you get the hang of it suddenly, everyone is surprised.
|
|
|
|
|
I have a list control with LVS_EX_HEADERDRAGDROP property.
Which Window Message or Control Notification Message is related when there is a change detected in HEADER order? OnColumnClick doesnt handle.
Thanks in advance
|
|
|
|
|
Hai
i would like to know how to write a CString object into file;
Please help me!!
Thanks
JP
|
|
|
|
|
You can use MFC serialization or you can do it directly using MFCC File object
CFile myFile('test.dat', CFile::modeWrite);
CString buff;
buff = "This is some text";
myFile.Write(buff, buff.GetLength());
p.s- you can also use Windows SDK functions or the CRT functions so your code works on all platforms (most anyways)
HTH
Cheers
The word of the day is legs, let's go back to my house and spread the word
|
|
|
|
|
hi
Thanks for ur reply.Did u check this code,since it is not working.
Thanks
JP
|
|
|
|
|
Typically code I write here on CP is psuedo code, just to get you started on the right direction, I hardly never test code.
try this instead:
CFile myFile('test.dat', CFile::modeWrite);
CString buff;
buff = "This is some text";
myFile.Write(buff.GetBuffer(buff.GetLength()), buff.GetLength());
The word of the day is legs, let's go back to my house and spread the word
|
|
|
|
|
Try to write like this!
CFile myFile('test.dat', CFile::modeWrite);<br />
CString buff;<br />
buff = "This is some text";<br />
myFile.Write(str.operator LPCTSTR(),buff.GetLength());
Abhishek Srivastava
Software Engineer (VC++)
India ,Noida
Mobile no 9891492921
|
|
|
|
|
hi
Thanks for ur solution!!
But if u use above code..it is not giving any error while executing..but this writes our data with some junk value...So we can't retrieve it properly.
Cheers
JP
|
|
|
|
|
I developed a drawing application which draws colored rectangles,circles etc...when i place one object on other i need to see the beneath object and must change the transparency level from full transparent to opaque with the same color of the object...how can i do it...?
|
|
|
|
|
AlphaBlend() API or you will have to write you own or find pre-written code to do it for you.
There is probably something available here on CP under bitmap section if you look hard.
Cheers
The word of the day is legs, let's go back to my house and spread the word
|
|
|
|