If you want to use the fucntion drag & drop in your program, please refer to
0. VC++ Code: Drag and Drop File in Dialog with WM_DROPFILES and WM_NCLBUTTONDOWN
1. MFC Drag Drop, MFC Cut, MFC Copy, MFC Paste, MFC Example, COleDropTarget, COleDataObject, COleDataSource, Drag Drop Files, VC++ Source Codes
2. InformIT: Visual C++ 6 Unleashed > Adding Drag and Drop to Your Application
3. OnDropFiles does not work for CDialog in MFC ActiveX control? (please help) - MSDN Forums
and
4. [MFC] 리스트 컨트롤이 WM_DROPFILES 메시지를 받지 못합니다.
Tuesday, May 5, 2009
Monday, May 4, 2009
Wish list of books
Wish list of books.
How many books can I read in this year?
The number is the wish order of reading.
4. The Psychology of Computer Programming,
by Gerald M. Weinberg (프로그래밍 심리학)
1. The Practice of Programming,
by Brian W. Kernighan and Rob Pike. (프로그래밍 수련법)
Programming Challenges,
by Steven S. Skiena, Miguel Revilla (프로그래머 두뇌 단련 퍼즐 44제)
2. The Pragmatic Programmer,
by Andrew Hunt, David Thomas (실용주의 프로그래머)
My Job Went to India: 52 Ways to Save Your Job,
by Chad Fowler (사랑하지 않으면 떠나라)
3. 겸손한 개발자가 만든 거만한 소프트웨어,
by
5. ship it,
by Jared Richardson, Will Gwaltney, Jr
0. 디테일의 힘,
by 왕중추
How many books can I read in this year?
The number is the wish order of reading.
4. The Psychology of Computer Programming,
by Gerald M. Weinberg (프로그래밍 심리학)
1. The Practice of Programming,
by Brian W. Kernighan and Rob Pike. (프로그래밍 수련법)
Programming Challenges,
by Steven S. Skiena, Miguel Revilla (프로그래머 두뇌 단련 퍼즐 44제)
2. The Pragmatic Programmer,
by Andrew Hunt, David Thomas (실용주의 프로그래머)
My Job Went to India: 52 Ways to Save Your Job,
by Chad Fowler (사랑하지 않으면 떠나라)
3. 겸손한 개발자가 만든 거만한 소프트웨어,
by
5. ship it,
by Jared Richardson, Will Gwaltney, Jr
0. 디테일의 힘,
by 왕중추
Monday, April 13, 2009
In the pipe five by five
- One by one,
- Two by two,
- Five by five.The famous saying is
1. "In the pipe five by five." you can hear this word in the game "Starcraft". but the original word in the movie "Aliens". "We're in the pipe, five by five."
2. In the bible, we can find "Noah brought all animals into the ark two by two"
Anything else?
Sunday, April 12, 2009
Code Complete 1, in the floating point
Thin book is a great, wonderful, and fantastic.
How can he write this book, is he a genious?In the floating point operation,
double dwNormal = 1.0;
double dwSum = 0;
int i = 0;
for (i=0; i<10; i++)
{
dwSum += 0.1;
TRACE("dwSum: %1.20f\n", dwSum);
}
if (dwSum == dwNormal)
{
TRACE("Numbers are the Same.");
}
else
{
TRACE("Numbers are Differnet.");
}
Can you guess the result?
dwSum == dwNormal is True or False?
In normal case, the result is False.
dwSum = 0.99999999999999989
In normal case, floating point precision, usually be represented to only 7 ot 15 digits of accuracy.
dwSum: 0.10000000000000001000
dwSum: 0.20000000000000001000
dwSum: 0.30000000000000004000
dwSum: 0.40000000000000002000
dwSum: 0.50000000000000000000
dwSum: 0.59999999999999998000
dwSum: 0.69999999999999996000
dwSum: 0.79999999999999993000
dwSum: 0.89999999999999991000
dwSum: 0.99999999999999989000
C code refactoring
refactoring & restructuring
refactoring is same input and output of function arguments
just change into the function's code
restructuring is same input and output of function argument or NOT.
In the project middle term, refactoring and/or restructuring
End of project, restructuring is NOT recommended, restructuring is recommended.
Saturday, March 28, 2009
Video Clips
Nowadays in the Internet we can download many video clips.
About 10 years ago, was it possible? In 1994 or 1995, at the university I downloaded many video clips from Broadcast companies or BBS. At that time I could not think, nowadays famous service, video clip streaming service. If I were known that service ...
So nowadays, through those service, I can watch many video clips such as Music video, TV show, Japan animation, and etc. Now it is related copyright, but it is possible ;-).
And more important information is,
I get more knowledge, I want to watch more video clips.
Nowadays, I like "Girl's generation".
Sunday, February 22, 2009
display calculation result, long expression
In the C code, if the input value is very large and include fraction expression,
for example 3.141592 or 6350.29318. And want to display those values exactly.
How can you deal those values?
Now, I'm thinking, I use value shift and divide integer part and decimal part.
3.141592 = 3 + 0.141592
6350.29318 = 6350 + 0.29318
In the C language
First, multiply big or large number
6350.29318 * E14 = 635029318000000000
and divide that value 6350 & 29318
and check the decimal point, i.e., 5
Second, use the sprintf(...) function
such as "sprintf(SzTestResult, "%d.%0*d", lInteger, nDecimalPoint, lDecimal);"
And my question is, if there is or are the C language exporter(s), how he or they deal(s) this issue?
#include
#define SHIFT_SIZE_MAX (14)
#define NUMBER_SHIFT(X) ((X)*pow(10, (SHIFT_SIZE_MAX)))
// ------------------------------------------------------------------------------
// NumberFraction
// Input
// dInputNumber: Real Number, ABC.DEF
// *plNaturalNumber: Value of Natural Numner, ABC
// *plDecimalNumber: Value of Decimal Number, DEF
// *pnDecimalPoint: Value of Decimal Point, 3
// Return
// Success: 0
// Fail: NOT 0
// ------------------------------------------------------------------------------
int NumberFraction(
double dInputNumber,
unsigned long *plNaturalNumber,
unsigned long *plDecimalNumber,
int *pnDecimalPoint)
{
int nReturnType = 0;
// Input Value
//double dInputNumber = 6350.29318;
// Return Value
unsigned long lNaturalNumber = 0;
unsigned long lDecimalNumber = 0;
double dDecimalNumberT = 0;
//int nDecimalPoint = 0;
double dShiftedValue = dInputNumber * pow(10, SHIFT_SIZE_MAX);
// Count Deciaml Number
int nCount = 0;
int nDecimalNumber = 0;
double dInputValue = dShiftedValue;
// Check Input Value
if (plNaturalNumber == NULL)
{
return nReturnType = 2;
}
if (plNaturalNumber == NULL)
{
return nReturnType = 3;
}
if (pnDecimalPoint == NULL)
{
return nReturnType = 4;
}
for(nCount=0; nCount
{
double dVal = 0;
double dFraction = 0;
dInputValue = dInputValue / 10.;
dFraction = modf(dInputValue, &dVal);
if (dFraction == 0.0)
{
continue;
}
else
{
break;
}
}
nDecimalNumber = SHIFT_SIZE_MAX - nCount;
lNaturalNumber = (unsigned long)(dShiftedValue / pow(10, SHIFT_SIZE_MAX));
dDecimalNumberT = dShiftedValue - (lNaturalNumber * pow(10, SHIFT_SIZE_MAX));
lDecimalNumber = (unsigned long)(dDecimalNumberT / pow(10, nCount));
// Set Return Value
*plNaturalNumber = lNaturalNumber;
*plDecimalNumber = lDecimalNumber;
*pnDecimalPoint = nDecimalNumber;
return nReturnType;
}
// ------------------------------------------------------------------------------
// NumberFraction2String
// Input
// dInputNumber: Real Number, ABC.DEF
// pOutputString: "ABC.DEF"
// nOutputStringSize: SHOULD 32 bytes or more
// Return
// Success: 0
// Fail: NOT 0
// ------------------------------------------------------------------------------
int NumberFraction2String(
double dInputNumber,
char* pOutputString,
int nOutputStringSize)
{
int nReturnType = 0;
char SzTestResult[32] = {0x00, };
char SzZeroString[16] = {0x00, };
char SzDecimalNumber[16] = {0x00, };
int nMaxZeroNumber = 0;
int i = 0;
unsigned long lInteger = 0;
unsigned long lDecimal = 0;
int nDecimalPoint = 0;
// Check Input Value
if (pOutputString == NULL)
{
nReturnType = 2;
}
// memset
memset(pOutputString, 0x00, nOutputStringSize*sizeof(char));
// Convert: InputNumber Fraction, NatualNumber + DecimalNumber
nReturnType = NumberFraction(dInputNumber, &lInteger, &lDecimal, &nDecimalPoint);
if (nReturnType == 0)
{
int nStringSize = 0;
#if 0 // OLD Method
sprintf(SzDecimalNumber, "%d", lDecimal);
nMaxZeroNumber = nDecimalPoint - strlen(SzDecimalNumber);
for (i=0; i
{
SzZeroString[i] = '0';
}
sprintf(SzTestResult, "%d.%s%d", lInteger, SzZeroString, lDecimal);
#else // NEW Method
sprintf(SzTestResult, "%d.%0*d", lInteger, nDecimalPoint, lDecimal);
#endif //
nStringSize = strlen(SzTestResult);
if (nOutputStringSize+1 >= nStringSize)
{
memcpy(pOutputString, SzTestResult, nStringSize*sizeof(char));
}
}
else
{
// error
nReturnType = nReturnType + 10;
}
return nReturnType;
}
// Test Code
//double dTest = 3280.8399;
//double dTest = 0.0000000009842;
double dTest = 1.01660469088;
char SzOutputBuffer[32] = {0x00, };
int nOutputBufferSize = 32;
NumberFraction2String(dTest, SzOutputBuffer, nOutputBufferSize);
Subscribe to:
Posts (Atom)