Katex

顯示具有 Program 標籤的文章。 顯示所有文章
顯示具有 Program 標籤的文章。 顯示所有文章

2012年1月28日 星期六

MFC : Linker error


Link error message:

nafxcwd.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new[](unsigned int)" (??_U@YAPAXI@Z) already defined in libcpmtd.lib(newaop.obj)

修正方式:

Project->Property->configuration Properties->Linker->Input->Additional Dependencies  

Project->Property->configuration Properties->Linker->Input->Ignore Specific Library  
加入:
nafxcwd.lib
libcpmtd.lib

 如下:


2012年1月26日 星期四

MFC : SetROP2


        一般用 R2_NOT, 在畫第二次時就會把第一次畫的清為底色

afx_msg void OnMouseMove(UINT, CPoint point)
{
if (this == GetCapture() )
{
CClientDC aDC(this);
aDC.SetROP2(R2_NOT);

aShape->draw(aDC);
aShape->SetEndPoint(point);
aShape->draw(aDC, lcolor);
}
}




  • R2_BLACK   Pixel is always black.
  • R2_WHITE   Pixel is always white.
  • R2_NOP   Pixel remains unchanged.
  • R2_NOT   Pixel is the inverse of the screen color.
  • R2_COPYPEN   Pixel is the pen color.
  • R2_NOTCOPYPEN   Pixel is the inverse of the pen color.
  • R2_MERGEPENNOT   Pixel is a combination of the pen color and the inverse of the screen color (final pixel = (NOT screen pixel) OR pen).
  • R2_MASKPENNOT   Pixel is a combination of the colors common to both the pen and the inverse of the screen (final pixel = (NOT screen pixel) AND pen).
  • R2_MERGENOTPEN   Pixel is a combination of the screen color and the inverse of the pen color (final pixel = (NOT pen) OR screen pixel).
  • R2_MASKNOTPEN   Pixel is a combination of the colors common to both the screen and the inverse of the pen (final pixel = (NOT pen) AND screen pixel).
  • R2_MERGEPEN   Pixel is a combination of the pen color and the screen color (final pixel = pen OR screen pixel).
  • R2_NOTMERGEPEN   Pixel is the inverse of the R2_MERGEPEN color (final pixel = NOT(pen OR screen pixel)).
  • R2_MASKPEN   Pixel is a combination of the colors common to both the pen and the screen (final pixel = pen AND screen pixel).
  • R2_NOTMASKPEN   Pixel is the inverse of the R2_MASKPEN color (final pixel = NOT(pen AND screen pixel)).
  • R2_XORPEN   Pixel is a combination of the colors that are in the pen or in the screen, but not in both (final pixel = pen XOR screen pixel).
  • R2_NOTXORPEN   Pixel is the inverse of the R2_XORPEN color (final pixel = NOT(pen XOR screen pixel)).



C++ - 判斷同類別

例如:

有基本物件
class MyShape;

和三個繼承物件
class MyLine : MyShape;
class MyRect : MyShape;
class MyEllipse : MyShape;

MyShape *aShape = (MyShape*)new MyLine;
MyShape *aShape = (MyShape*)new MyRect;
MyShape *aShape = (MyShape*)new MyEllipse;


要判斷 aShape 是哪種類別, 可用:

typeid(*aShape) == typeid(MyLine)

使用時要

#include 

是 class type_info
也可以用 cout << typeid(*aShape).name() << endl;  
直接印出類別名稱.

2002年11月6日 星期三

C language

C 是由美國 Dennis Ritchie 所設計, 為了和 K. Thompson 發展 Unix 而開發的電腦語言.


C language keywords
    struct
    enum
    union

運算 Operation
    函數 Function
    http://www.cplusplus.com/reference/clibrary/


資料結構 Data Structure
    linked list
    STL


演算法 Algorithm
http://caterpillar.onlyfun.net/Gossip/AlgorithmGossip/AlgorithmGossip.htm


資料庫

速度
(auto) int v.s. register int

Design
top down / bottom up

Design Pattern

-- 懷舊 --

Borland

熱門文章