|
Guys,
Thanks to all of you for going to the trouble of answering my plea. CodeProject rules!
I plan to start investigating CSocket first as the next stage of development is a multi-machine version of the app anyway - GeMe you just saved me from another embarrassing post!
Thanks for all your great feedback though.
Simon
|
|
|
|
|
Does anyone know how to make a cube with a circular hole (Cylinder) across it?
Thanks
|
|
|
|
|
You can build "faces" with holes by using tesellators...
The code looks something like this:
GLUtesselator* pTess1 = gluNewTess();
glNewList(m_nIdDisplayList, GL_COMPILE);
gluTessCallback(pTess1, GLU_TESS_BEGIN, (void (CALLBACK *)()) glBegin);
gluTessCallback(pTess1, GLU_TESS_END, (void (CALLBACK *)()) glEnd);
gluTessCallback(pTess1, GLU_TESS_VERTEX, (void (CALLBACK *)()) glu_vertex);
gluTessCallback(pTess1, GLU_TESS_ERROR, (void (CALLBACK *)())tess_error_callback );
glNormal3f(0.f, 0.f, -1.f);
gluTessBeginPolygon(pTess1, NULL);
// Outer loop
gluTessBeginContour(pTess1);
gluTessVertex(pTess1,...);
gluTessEndContour(pTess1);
// Inner loops
gluTessBeginContour(pTess1);
gluTessVertex(pTess1, ...);
gluTessEndContour(pTess1);
...
gluTessEndPolygon(pTess1);
|
|
|
|
|
Thank you, but it doesn't work to me.
If you could put the hole code you will made me a grat favour. Thanks
|
|
|
|
|
Yep.
Download Getic Editor http://marius.homeunix.org:8000
Make a 'Solid' 'Box', Then Make a 'Cut' 'Solid' Cylinder with
20 faces (Horizontal Slides) and place it on top of the box.
Press 'Size' Toobar Bitton and maekit a bit smaller in diameter,
and a bit higher. Press Enter. Bingo. You have It.
|
|
|
|
|
I found some errors in Win95, in conjunction with MFC. One of them is that SetBkMode is not working properly.
1. How can I determine thename of component responsible for the function?
2. Can I transfer (and distribute) the working component from Win98 or XP to Win95?
|
|
|
|
|
Vancouver wrote:
1. How can I determine thename of component responsible for the function?
Are you talking about SetBkMode() itself, or the wrapper around it, CDC::SetBkMode() ? What is it that is not working? Perhaps a code snippet would better illustrate the problem.
Vancouver wrote:
2. Can I transfer (and distribute) the working component from Win98 or XP to Win95?
What do you mean by "working component?"
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Hi,
1. I found the error. I am working with the CDC wrapper. Under certain circumstances the BkMode was not set. Even though it worked well in Win98 and XP, despite that the default BkMode is per definition OPAQUE.
The reason not to set the BkMode was, that BkColor will not be set either. Painting occurs in the OnCtlColor function, and in the mentioned case it returns a bit map brush to paint the background. I thought BkMode does not apply here - and XP and Win98 think the same way. However XP does not take an offence when using SetBkMode in this situation, so now it's working in all three systems
2. "Working component": I'm using CRichEditCtrl. It's functionality has been gradually increased since Win95. I took the corresponding components, for example riched20.dll from XP or from Win98SE and installed them in Win98 1sted and Win95; they work fine.
I was thinking of a way like this.
Do you know of a cross-reference between functions and components (DLLs)?
In Win95 the GetWindowPlacement function always returns a negative value in rect.right (rect.buttom is ok). In my system it is always (correct value - 5428), but I'm not sure if it is an universal number like the gravitational constant. I would like to try to replace the respective component of Windows.
Thanks anyway
|
|
|
|
|
Hi
I have a directory where i want to get a directory listing of all files.
How can i achieve this by using MFC classes?
Greetings
Jens
|
|
|
|
|
Try CFileFind .
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
I've found something that is quite unusual happening to my VC source files. Occasionally, when I compile, I get errors due to one character having been changed in one of my source files, or the src or include files in my Visual Studio directories. Usually the character is simply changed from lower to upper case, it seems at random.
For instance, today I had this change in my xlocale file, which prevented me compiling:
***** goodXLOCALE
static const mask * __cdecl classic_table() _THROW0()
***** badXLOCALE
static coNst mask * __cdecl classic_table() _THROW0()
***** Has anyone else ever seen this? Does anyone have any clue as to what it might be?
I look forward to hearing suggestions!
Puzzled Paul.
"The way of a fool seems right to him, but a wise man listens to advice" - Proverbs 12:15 (NIV)
|
|
|
|
|
I have never seen it but it almost sounds like a virus or something similar if it is randomly changing data on the hard drive.
|
|
|
|
|
Hi
How i can to create my ones callback function????
Thank.
|
|
|
|
|
Are you wanting to know how to create a callback funtion? If so, it depends on the context. Generally, however, you'll want to use the CALLBACK data type.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Another solution is __stdcall.
unsigned int __stdcall Function(datatype param);
Kuphryn
|
|
|
|
|
(sorry for the repost but this is really bugging me still):
The first time i call EncryptString (below) I pass "asdf" it encrypts to to be a length of 25 and encrypts it right. But when i try to encrypt a 2539 length string it returns a string of a length of 225 and only partically encrypted. Why is this happening and how do I fix it?
CString CEncyptionClass::EncryptString(CString m_strUnencryptedString)
{
//variables
//Date:11 22 03
CString m_strResultingText;
HCRYPTPROV hProv = NULL;
HCRYPTKEY hKey = NULL;
HCRYPTHASH hHash = NULL;
DWORD dwLength;
BYTE * pbBuffer;
LPTSTR m_tContents=ConvertCStringToChar(m_strUnencryptedString);
TCHAR szLocalPassword[] = _T("alongrandompassword");
//
// Get handle to user default provider.
if (CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL, 0))
{
// Create hash object.
if (CryptCreateHash(hProv, CALG_MD5, 0, 0, &hHash))
{
// Hash password string.
dwLength = _tcslen(szLocalPassword);
if (CryptHashData(hHash, (BYTE *)szLocalPassword, dwLength, 0))
{
// Create block cipher session key based on hash of the password.
if (CryptDeriveKey(hProv, CALG_RC4, hHash, CRYPT_EXPORTABLE, &hKey))
{
dwLength= _tcslen(m_tContents);
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 \r\n(%s)\r\n %d %d", m_strResultingText,m_tContents,strlen((const char*) pbBuffer) ,dwLength);
MessageBox(strShow);
}
free(pbBuffer);
}
CryptDestroyKey(hKey); // Release provider handle.
}
}
CryptDestroyHash(hHash); // Destroy session key.
}
CryptReleaseContext(hProv, 0);
}
return m_strResultingText;
}
-Steven Hicks
CPACodeProjectAddict
|
|
|
|
|
You sure it's not MessageBox not showing full string?... I assume you may get not printable characters after encoding.
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
The length of pbBuffer and m_strResultText is 225 .. the plain text string is 2539
-Steven Hicks
CPACodeProjectAddict
|
|
|
|
|
That means according to your code:
LPTSTR m_tContents=ConvertCStringToChar(m_strUnencryptedString);
returns 225 length string...
Check ConvertCStringToChar function.
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
It's string is 2539 also, and its right.
-Steven Hicks
CPACodeProjectAddict
|
|
|
|
|
Now I'm a little bit confused:
You are saying:
I pass "asdf" it encrypts to to be a length of 25 and encrypts it right.
But according to your code:
dwLength= _tcslen(m_tContents);<br />
pbBuffer=(BYTE*)malloc(dwLength);<br />
if (pbBuffer != NULL)<br />
{<br />
memcpy(pbBuffer, m_tContents, dwLength);<br />
<br />
if (CryptEncrypt(hKey, 0, true, 0, pbBuffer, &dwLength, dwLength))
You are only allocating 4 bytes in pbBuffer, as dwLength=4. Right?
How you get 25?
Maybe I missunderstanding...
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
The first time that m_Contents is "<password>asdf" it is encrypted to a 25 string (dwLength==25 for the orginal and after ) but then i pass a 2539 character long string to it and it encrypts only 255 (the dwLenght is also at 2539 when it goes to crypt encrypt
-Steven Hicks
CPACodeProjectAddict
|
|
|
|
|
But according to your code with m_tContents="asdf":
dwLength= _tcslen(m_tContents); // <= will give you 4
pbBuffer=(BYTE*)malloc(dwLength); // <= pbBuffer should be allocated with 4 bytes
if (pbBuffer != NULL)
{
memcpy(pbBuffer, m_tContents, dwLength);
if (CryptEncrypt(hKey, 0, true, 0, pbBuffer, &dwLength, dwLength)) // <= should encrypt just 4 bytes
How you get 25, and if dwLength=25 after the call your pbBuffer is overrun!
However you passed dwLength = 4, your CryptEncrypt either should fail or your pbBuffer should be overrun
How are you getting 25?...
Could you be more specific?
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
noooo... m_tContents would equal "<password>asdf</password>" sorry about that .... ugh
-Steven Hicks
CPACodeProjectAddict
|
|
|
|
|
If interested: Please provide ConvertCStringToChar() implementation....
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|