锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲国产精品嫩草影院久久,伊人久久大香线蕉av不变影院,久久精品国产99国产电影网 http://www.shnenglu.com/Alina-zl/archive/2009/03/24/77702.htmlAlina-zlAlina-zlTue, 24 Mar 2009 03:19:00 GMThttp://www.shnenglu.com/Alina-zl/archive/2009/03/24/77702.htmlhttp://www.shnenglu.com/Alina-zl/comments/77702.htmlhttp://www.shnenglu.com/Alina-zl/archive/2009/03/24/77702.html#Feedback0http://www.shnenglu.com/Alina-zl/comments/commentRss/77702.htmlhttp://www.shnenglu.com/Alina-zl/services/trackbacks/77702.html 

璋冩暣鍒嗚鯨鐜囩殑浠g爜濡備笅錛?br>DEVMODE dm;
 dm.dmSize = sizeof(DEVMODE) ;
 EnumDisplaySettings(NULL,ENUM_CURRENT_SETTINGS,&dm);
 if(dm.dmPelsHeight!=1024||dm.dmPelsWidth!=1280){
  if(AfxMessageBox("涓轟簡杈懼埌鏈濂界殑鏄劇ず鏁堟灉錛屽緩璁偍浣跨敤1280*1024鐨勫垎杈ㄧ巼錛岀‘瀹氬悧錛?,MB_YESNO)==IDYES){
   LONG result;
   dm.dmBitsPerPel = 32;
   dm.dmPelsHeight = 1024;
   dm.dmPelsWidth = 1280;
   dm.dmFields = DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;
   result = ChangeDisplaySettings(&dm,0);
  }
 }
“濡傛灉瑕佸湪紼嬪簭鍚姩鏃惰嚜鍔ㄨ嚜鍔ㄨ皟鏁村埌鍚堥傜殑鍒嗚鯨鐜囷紝鍙互灝嗗叾鍔犲叆鍒癡iew鐨凮nInitialUpdate()涓紝騫惰褰曚笅dm.dmPelsHeight鍜宒m.dmPelsWidth鐨勫箋?br>瑕佸湪紼嬪簭緇撴潫鏃惰嚜鍔ㄨ皟鏁村洖鍘熸湁鍒嗚鯨鐜囷紝鍙湪MainFrame鐨凮nClose()涓敤浠ヤ笂浠g爜灝嗗叾鏀瑰洖鍘熷箋?#8221;

濡傛灉瑕佸湪紼嬪簭鍚姩鏃惰嚜鍔ㄨ嚜鍔ㄨ皟鏁村埌鍚堥傜殑鍒嗚鯨鐜囷紝鍙互灝嗗叾鍔犲叆鍒癮pp鐨処nitInstance()涓紝騫惰褰曚笅dm.dmPelsHeight鍜宒m.dmPelsWidth鐨勫箋?br>瑕佸湪紼嬪簭緇撴潫鏃惰嚜鍔ㄨ皟鏁村洖鍘熸湁鍒嗚鯨鐜囷紝鍙湪APP鐨凟xitInstance涓敤浠ヤ笂浠g爜灝嗗叾鏀瑰洖鍘熷箋?#8221;



Alina-zl 2009-03-24 11:19 鍙戣〃璇勮
]]>
vc2005涓病鏈塩lasswizard榪欎釜鍛戒護浜?2005涓嬫庝箞娣誨姞榧犳爣浜嬩歡http://www.shnenglu.com/Alina-zl/archive/2008/12/30/70757.htmlAlina-zlAlina-zlTue, 30 Dec 2008 03:51:00 GMThttp://www.shnenglu.com/Alina-zl/archive/2008/12/30/70757.htmlhttp://www.shnenglu.com/Alina-zl/comments/70757.htmlhttp://www.shnenglu.com/Alina-zl/archive/2008/12/30/70757.html#Feedback0http://www.shnenglu.com/Alina-zl/comments/commentRss/70757.htmlhttp://www.shnenglu.com/Alina-zl/services/trackbacks/70757.html
鍙栦唬classwizard 涓殑娣誨姞娑堟伅鏄犲皠錛屾坊鍔犵被錛岀瓑絳夌殑鍔熻兘涓昏鍦ㄥ睘鎬х獥鍙d腑

榧犳爣浜嬩歡涓嶈鎵嬪姩娣誨姞錛屾渶濂戒嬌鐢ㄤ笅榪版柟娉?/span>

姣斿娣誨姞娑堟伅鏄犲皠銆備綘閫夊畾浜嗕竴涓被鍚庯紝鍦ㄥ睘鎬х偣鍑誨彸閿?閫夋嫨灞炴?
鍦ㄥ睘鎬х獥鍙d腑鐐瑰嚮閭d釜鍍忛棯鐢墊牱鐨?鍥炬爣 灝變細鍑虹幇 涓緋誨垪鐨勬秷鎭緵浣犻夋嫨 錛岀偣鍑?灝忔柟蹇牱瀛愮殑鍥炬爣 灝變細鍑虹幇铏氬嚱鏁版垨鑰呴噸杞?

鑷充簬娣誨姞綾伙紝鐩存帴鍦ㄥ伐紼嬪悕縐頒笂鐐瑰彸閿?閫夋嫨 娣誨姞綾葷殑鍛戒護 鍗沖彲

娣誨姞鍙橀噺 錛屽彲浠ュ湪綾誨悕縐頒笂鐐瑰彸閿紝閫夋嫨娣誨姞鍙橀噺

Alina-zl 2008-12-30 11:51 鍙戣〃璇勮
]]>
'IDD_DIALOG1' : undeclared identifier http://www.shnenglu.com/Alina-zl/archive/2008/12/16/69594.htmlAlina-zlAlina-zlTue, 16 Dec 2008 11:20:00 GMThttp://www.shnenglu.com/Alina-zl/archive/2008/12/16/69594.htmlhttp://www.shnenglu.com/Alina-zl/comments/69594.htmlhttp://www.shnenglu.com/Alina-zl/archive/2008/12/16/69594.html#Feedback1http://www.shnenglu.com/Alina-zl/comments/commentRss/69594.htmlhttp://www.shnenglu.com/Alina-zl/services/trackbacks/69594.html  C2065:   'IDD_DIALOG1'    undeclared   identifier  

瑙e喅鍔炴硶:

鍔?include   'resource.h'



Alina-zl 2008-12-16 19:20 鍙戣〃璇勮
]]>
MFC涓巒amespace鐨勫啿紿侀棶棰?/title><link>http://www.shnenglu.com/Alina-zl/archive/2008/11/21/67468.html</link><dc:creator>Alina-zl</dc:creator><author>Alina-zl</author><pubDate>Fri, 21 Nov 2008 03:21:00 GMT</pubDate><guid>http://www.shnenglu.com/Alina-zl/archive/2008/11/21/67468.html</guid><wfw:comment>http://www.shnenglu.com/Alina-zl/comments/67468.html</wfw:comment><comments>http://www.shnenglu.com/Alina-zl/archive/2008/11/21/67468.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/Alina-zl/comments/commentRss/67468.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/Alina-zl/services/trackbacks/67468.html</trackback:ping><description><![CDATA[<p>鎶婁唬鐮佷粠QT縐繪鍒癕FC鐨勬椂鍊欙紝榪欎釜鏂囦歡vecmat.h錛屽嚭鐜頒簡濡備笅閿欒錛?br>error C2143: syntax error : missing ',' before ')'<br>error C2143: syntax error : missing ';' before '}'<br>error C2059: syntax error : ')'<br>fatal error C1004: unexpected end-of-file found<br>絳夌瓑銆?br><font style="BACKGROUND-COLOR: #cce8cf">vecmat.h婧愪唬鐮佸涓? </font></p> <p>#ifndef  VECMAT_H<br># define VECMAT_H</p> <p># include <cmath><br># include <vector><br># include <iostream></p> <p> </p> <p>namespace vecmat {</p> <p> namespace internal {</p> <p>  template <bool B><br>  struct is_false {};</p> <p>  template <><br>  struct is_false<false> {<br>   static inline void ensure() {}<br>  };</p> <p> } // end of namespace internal</p> <p> //<br> //  Vector class<br> //    - T: value type<br> //    - N: dimension<br> //<br> /////////////////////////////////////////////////////////////////////////////</p> <p> template <class T, unsigned N><br> class Vector<br> {<br> public:</p> <p>  typedef T value_type;</p> <p>  // constructors</p> <p>  inline Vector() {<br>   for (unsigned i = 0; i < N; i++)<br>    _coord[i] = 0;<br>  }</p> <p>  ~Vector() {<br>   internal::is_false<(N == 0)>::ensure();<br>  }</p> <p>  template <class U><br>  explicit inline Vector(const U tab[N]) {<br>   for (unsigned i = 0; i < N; i++)<br>    _coord[i] = (T)tab[i];<br>  }</p> <p>  template <class U><br>  explicit inline Vector(const std::vector<U>& tab) {<br>   for (unsigned i = 0; i < N; i++)<br>    _coord[i] = (T)tab[i];<br>  }</p> <p>  template <class U><br>  explicit inline Vector(const Vector<U, N>& v) {<br>   for (unsigned i = 0; i < N; i++)<br>    _coord[i] = (T)v[i];<br>  }</p> <p>  // accessors</p> <p>  inline value_type  operator[](const unsigned i) const {<br>   return _coord[i];<br>  }</p> <p>  inline value_type& operator[](const unsigned i) {<br>   return _coord[i];<br>  }</p> <p>  static inline unsigned dim() {<br>   return N;<br>  }</p> <p>  // various useful methods</p> <p>  inline value_type norm() const {<br>   return (T)sqrt(squareNorm());<br>  }</p> <p>  inline value_type squareNorm() const {<br>   return (*this) * (*this);<br>  }</p> <p>  inline Vector<T, N>& normalize() {<br>   value_type n = norm();<br>   for (unsigned i = 0; i < N; i++)<br>    _coord[i] /= n;<br>   return *this;<br>  }</p> <p>  inline Vector<T, N>& normalizeSafe() {<br>   value_type n = norm();<br>   if (n)<br>    for (unsigned i=0; i < N; i++)<br>     _coord[i] /= n;<br>   return *this;<br>  }</p> <p>  inline Vector<T, N>& min(const Vector<T, N>& v) {<br>   for (unsigned i=0; i < N; i++)<br>    if (_coord[i]  > v._coord[i])<br>     _coord[i] = v._coord[i];<br>   return *this;<br>  }</p> <p>  inline Vector<T, N>& max(const Vector<T, N>& v) {<br>   for (unsigned i=0; i < N; i++)<br>    if (_coord[i]  < v._coord[i])<br>     _coord[i] = v._coord[i];<br>   return *this;<br>  }</p> <p>  inline const value_type* address() const {<br>   return _coord;<br>  }</p> <p>  // classical operators</p> <p>  template <class U><br>  inline Vector<T, N>& operator=(const Vector<U, N>& v) {<br>   if (this != &v)<br>    for (unsigned i = 0; i < N; i++)<br>     _coord[i] = (T)v[i];<br>   return *this;<br>  }</p> <p>  template <class U><br>  inline Vector<T, N>& operator+=(const Vector<U, N>& v) {<br>   for (unsigned i = 0 ; i < N; i++)<br>    _coord[i] += (T)v[i];<br>   return *this;<br>  }</p> <p>  template <class U><br>  inline Vector<T, N>& operator-=(const Vector<U, N>& v) {<br>   for (unsigned i = 0 ; i < N; i++)<br>    _coord[i] -= (T)v[i];<br>   return *this;<br>  }</p> <p>  template <class U><br>  inline Vector<T, N>& operator*=(const U r) {<br>   for (unsigned i = 0 ; i < N; i++)<br>    _coord[i] *= r;<br>   return *this;<br>  }</p> <p>  template <class U><br>  inline Vector<T, N>& operator/=(const U r) {<br>   if (r)<br>    for (unsigned i = 0 ; i < N; i++)<br>     _coord[i] /= r;<br>   return *this;<br>  }</p> <p><br>  inline bool operator==(const Vector<T, N>& v) const {<br>   for(unsigned i = 0; i < N; i++)<br>    if (_coord[i] != v[i])<br>     return false;<br>   return true;<br>  }</p> <p>  inline bool operator!=(const Vector<T, N>& v) const {<br>   for(unsigned i = 0; i < N; i++)<br>    if (_coord[i] != v[i])<br>     return true;<br>   return false;<br>  }</p> <p>  inline bool operator<(const Vector<T, N>& v) const {<br>   for (unsigned i = 0; i<N; i++) {<br>    if (_coord[i] < v[i])<br>     return true;<br>    if (_coord[i] > v[i])<br>     return false;<br>    if (_coord[i] == v[i])<br>     continue;<br>   }<br>   return false;  <br>  }</p> <p>  inline bool operator>(const Vector<T, N>& v) const {<br>   for (unsigned i=0; i<N; i++) {<br>    if(_coord[i] > v[i])<br>     return true;<br>    if(_coord[i] < v[i])<br>     return false;<br>    if(_coord[i] == v[i])<br>     continue;<br>   }<br>   return false;  <br>  }</p> <p> protected:</p> <p>  value_type _coord[N];<br>  enum {<br>   _dim = N,<br>  };<br> };</p> <p><br> //<br> //  Vec2 class (2D Vector)<br> //    - T: value type<br> //<br> /////////////////////////////////////////////////////////////////////////////</p> <p> template <class T><br> class Vec2 : public Vector<T, 2><br> {<br> public:</p> <p>  typedef typename Vector<T, 2>::value_type value_type;</p> <p>  inline Vec2() : Vector<T, 2>() {}</p> <p>  template <class U><br>  explicit inline Vec2(const U tab[2]) : Vector<T, 2>(tab) {}</p> <p>  template <class U><br>  explicit inline Vec2(const std::vector<U>& tab) : Vector<T, 2>(tab) {}</p> <p>  template <class U><br>  inline Vec2(const Vector<U, 2>& v) : Vector<T, 2>(v) {}</p> <p>  inline Vec2(const value_type x,<br>   const value_type y = 0) : Vector<T, 2>() {<br>    this->_coord[0] = (T)x;<br>    this->_coord[1] = (T)y;<br>  }</p> <p>  inline value_type x() const {<br>   return this->_coord[0];<br>  }</p> <p>  inline value_type& x() {<br>   return this->_coord[0];<br>  }</p> <p>  inline value_type y() const {<br>   return this->_coord[1];<br>  }</p> <p>  inline value_type& y() {<br>   return this->_coord[1];<br>  }<br> };</p> <p><br> //<br> //  HVec3 class (3D Vector in homogeneous coordinates)<br> //    - T: value type<br> //<br> /////////////////////////////////////////////////////////////////////////////</p> <p> template <class T><br> class HVec3 : public Vector<T, 4><br> {<br> public:</p> <p>  typedef typename Vector<T, 4>::value_type value_type;</p> <p>  inline HVec3() : Vector<T, 4>() {}</p> <p>  template <class U><br>  explicit inline HVec3(const U tab[4]) : Vector<T, 4>(tab) {}</p> <p>  template <class U><br>  explicit inline HVec3(const std::vector<U>& tab) : Vector<T, 4>(tab) {}</p> <p>  template<class U><br>  inline HVec3(const Vector<U, 4>& v) : Vector<T, 4>(v) {}</p> <p>  inline HVec3(const value_type sx,<br>   const value_type sy = 0,<br>   const value_type sz = 0,<br>   const value_type s = 1) {<br>    this->_coord[0] = sx;<br>    this->_coord[1] = sy;<br>    this->_coord[2] = sz;<br>    this->_coord[3] = s;<br>  }</p> <p>  template <class U><br>  inline HVec3(const Vector<U, 3>& sv) {<br>   this->_coord[0] = (T)sv[0];<br>   this->_coord[1] = (T)sv[1];<br>   this->_coord[2] = (T)sv[2];<br>   this->_coord[3] = (T)1;<br>  }</p> <p><br>  template <class U><br>  inline HVec3(const Vector<U, 3>& sv,<br>   const U) {<br>    this->_coord[0] = (T)sv[0];<br>    this->_coord[1] = (T)sv[1];<br>    this->_coord[2] = (T)sv[2];<br>    this->_coord[3] = (T)s;<br>  }</p> <p>  inline value_type sx() const {<br>   return this->_coord[0];<br>  }</p> <p>  inline value_type& sx() {<br>   return this->_coord[0];<br>  }</p> <p>  inline value_type sy() const {<br>   return this->_coord[1];<br>  }</p> <p>  inline value_type& sy() {<br>   return this->_coord[1];<br>  }</p> <p>  inline value_type sz() const {<br>   return this->_coord[2];<br>  }</p> <p>  inline value_type& sz() {<br>   return this->_coord[2];<br>  }</p> <p>  inline value_type s() const {<br>   return this->_coord[3];<br>  }</p> <p>  inline value_type& s() {<br>   return this->_coord[3];<br>  }</p> <p>  // Acces to non-homogeneous coordinates in 3D</p> <p>  inline value_type x() const {<br>   return this->_coord[0] / this->_coord[3];<br>  }</p> <p>  inline value_type y() const {<br>   return this->_coord[1] / this->_coord[3];<br>  }</p> <p>  inline value_type z() const {<br>   return this->_coord[2] / this->_coord[3];<br>  }<br> };</p> <p><br> //<br> //  Vec3 class (3D Vector)<br> //    - T: value type<br> //<br> /////////////////////////////////////////////////////////////////////////////</p> <p> template <class T><br> class Vec3 : public Vector<T, 3><br> {<br> public:</p> <p>  typedef typename Vector<T, 3>::value_type value_type;</p> <p>  inline Vec3() : Vector<T, 3>() {}</p> <p>  template <class U><br>  explicit inline Vec3(const U tab[3]) : Vector<T, 3>(tab) {}</p> <p>  template <class U><br>  explicit inline Vec3(const std::vector<U>& tab) : Vector<T, 3>(tab) {}</p> <p>  template<class U><br>  inline Vec3(const Vector<U, 3>& v) : Vector<T, 3>(v) {}</p> <p>  template<class U><br>  inline Vec3(const HVec3<U>& v) {<br>   this->_coord[0] = (T)v.x();<br>   this->_coord[1] = (T)v.y();<br>   this->_coord[2] = (T)v.z();<br>  }</p> <p>  inline Vec3(const value_type x,<br>   const value_type y = 0,<br>   const value_type z = 0) : Vector<T, 3>() {<br>    this->_coord[0] = x;<br>    this->_coord[1] = y;<br>    this->_coord[2] = z;<br>  }</p> <p>  inline value_type x() const {<br>   return this->_coord[0];<br>  }</p> <p>  inline value_type& x() {<br>   return this->_coord[0];<br>  }</p> <p>  inline value_type y() const {<br>   return this->_coord[1];<br>  }</p> <p>  inline value_type& y() {<br>   return this->_coord[1];<br>  }</p> <p>  inline value_type z() const {<br>   return this->_coord[2];<br>  }</p> <p>  inline value_type& z() {<br>   return this->_coord[2];<br>  }<br> };</p> <p><br> //<br> //  Matrix class<br> //    - T: value type<br> //    - M: rows<br> //    - N: cols<br> //<br> /////////////////////////////////////////////////////////////////////////////</p> <p> // Dirty, but icc under Windows needs this<br># define _SIZE (M * N)</p> <p> template <class T, unsigned M, unsigned N><br> class Matrix<br> {<br> public:</p> <p>  typedef T value_type;</p> <p>  inline Matrix() {<br>   for (unsigned i = 0; i < _SIZE; i++)<br>    this->_coord[i] = 0;<br>  }</p> <p>  ~Matrix() {<br>   internal::is_false<(M == 0)>::ensure();<br>   internal::is_false<(N == 0)>::ensure();<br>  }</p> <p>  template <class U><br>  explicit inline Matrix(const U tab[M][N]) {<br>   for (unsigned i = 0; i < M; i++)<br>    for (unsigned j = 0; j < N; j++)<br>     this->_coord[i * N + j] = tab[i][j];<br>  }</p> <p>  template <class U><br>  explicit inline Matrix(const U tab[_SIZE]) {<br>   for (unsigned i = 0; i < _SIZE; i++)<br>    this->_coord[i] = tab[i];<br>  }</p> <p>  template <class U><br>  explicit inline Matrix(const std::vector<U>& tab) {<br>   for (unsigned i = 0; i < _SIZE; i++)<br>    this->_coord[i] = tab[i];<br>  }</p> <p>  template <class U><br>  inline Matrix(const Matrix<U, M, N>& m) {<br>   for (unsigned i = 0; i < M; i++)<br>    for (unsigned j = 0; j < N; j++)<br>     this->_coord[i * N + j] = (T)m(i, j);<br>  }</p> <p>  inline value_type operator()(const unsigned i, const unsigned j) const {<br>   return this->_coord[i * N + j];<br>  }</p> <p>  inline value_type& operator()(const unsigned i, const unsigned j) {<br>   return this->_coord[i * N + j];<br>  }</p> <p>  static inline unsigned rows() {<br>   return M;<br>  }</p> <p>  static inline unsigned cols() {<br>   return N;<br>  }</p> <p>  inline Matrix<T, M, N> transpose() const {<br>   Matrix<T, N, M> res;<br>   for (unsigned i = 0; i < M; i++)<br>    for (unsigned j = 0; j < N; j++)<br>     res(j,i) = this->_coord[i * N + j];<br>   return res;<br>  }</p> <p>  inline void getArray(value_type res[M][N]) const {<br>   for (unsigned i = 0; i < M; i++)<br>    for (unsigned j = 0; j < N; j++)<br>     res[i][j] = this->_coord[i * N + j];<br>  }</p> <p>  inline void getArray(value_type res[_SIZE]) const {<br>   for (unsigned i = 0; i < _SIZE; i++)<br>    res[i] = this->_coord[i];<br>  }</p> <p>  inline const value_type* address() const {<br>   return this->_coord;<br>  }</p> <p>  template <class U><br>  inline Matrix<T, M, N>& operator=(const Matrix<U, M, N>& m) {<br>   if (this != &m)<br>    for (unsigned i = 0; i < M; i++)<br>     for (unsigned j = 0; j < N; j++)<br>      this->_coord[i * N + j] = (T)m(i, j);<br>   return *this;<br>  }</p> <p>  template <class U><br>  inline Matrix<T, M, N>& operator+=(const Matrix<U, M, N>& m) {<br>   for (unsigned i = 0; i < M; i++)<br>    for (unsigned j = 0; j < N; j++)<br>     this->_coord[i * N + j] += (T)m(i, j);<br>   return *this;<br>  }</p> <p>  template <class U><br>  inline Matrix<T, M, N>& operator-=(const Matrix<U, M, N>& m) {<br>   for (unsigned i = 0; i < M; i++)<br>    for (unsigned j = 0; j < N; j++)<br>     this->_coord[i * N + j] -= (T)m(i, j);<br>   return *this;<br>  }</p> <p>  template <class U><br>  inline Matrix<T, M, N>& operator*=(const U lambda) {<br>   for (unsigned i = 0; i < M; i++)<br>    for (unsigned j = 0; j < N; j++)<br>     this->_coord[i * N + j] *= lambda;<br>   return *this;<br>  }</p> <p>  template <class U><br>  inline Matrix<T, M, N>& operator/=(const U lambda) {<br>   if (lambda)<br>    for (unsigned i = 0; i < M; i++)<br>     for (unsigned j = 0; j < N; j++)<br>      this->_coord[i * N + j] /= lambda;<br>   return *this;<br>  }</p> <p> protected:</p> <p>  value_type _coord[_SIZE];<br> };</p> <p><br> //<br> //  SquareMatrix class<br> //    - T: value type<br> //    - N: rows & cols<br> //<br> /////////////////////////////////////////////////////////////////////////////</p> <p> // Dirty, but icc under Windows needs this<br># define __SIZE (N * N)</p> <p> template <class T, unsigned N><br> class SquareMatrix : public Matrix<T, N, N><br> {<br> public:</p> <p>  typedef T value_type;</p> <p>  inline SquareMatrix() : Matrix<T, N, N>() {}</p> <p>  template <class U><br>  explicit inline SquareMatrix(const U tab[__SIZE]) : Matrix<T, N, N>(tab) {}</p> <p>  template <class U><br>  explicit inline SquareMatrix(const std::vector<U>& tab) : Matrix<T, N, N>(tab) {}</p> <p>  template <class U><br>  inline SquareMatrix(const Matrix<U, N, N>& m) : Matrix<T, N, N>(m) {}</p> <p>  static inline SquareMatrix<T, N> identity() {<br>   SquareMatrix<T, N> res;<br>   for (unsigned i = 0; i < N; i++)<br>    res(i, i) = 1;<br>   return res;<br>  }<br> };</p> <p><br> //<br> // Vector external functions<br> //<br> /////////////////////////////////////////////////////////////////////////////</p> <p> template <class T, unsigned N><br> inline Vector<T, N> operator+(const Vector<T, N>& v1,<br>  const Vector<T, N>& v2) {<br>   Vector<T, N> res(v1);<br>   res += v2;<br>   return res;<br> }</p> <p> template <class T, unsigned N><br> inline Vector<T, N> operator-(const Vector<T, N>& v1,<br>  const Vector<T, N>& v2) {<br>   Vector<T, N> res(v1);<br>   res -= v2;<br>   return res;<br> }<br> template <class T, unsigned N><br> inline Vector<T, N> operator*(const Vector<T, N>& v,<br>  const typename Vector<T, N>::value_type r) {<br>   Vector<T, N> res(v);<br>   res *= r;<br>   return res;<br> }</p> <p> template <class T, unsigned N><br> inline Vector<T, N> operator*(const typename Vector<T, N>::value_type r,<br>  const Vector<T, N>& v) {<br>   Vector<T, N> res(v);<br>   res *= r;<br>   return res;<br> }</p> <p> template <class T, unsigned N><br> inline Vector<T, N> operator/(const Vector<T, N>& v,<br>  const typename Vector<T, N>::value_type r) {<br>   Vector<T, N> res(v);<br>   if (r)<br>    res /= r;<br>   return res;<br> }</p> <p> // dot product<br> template <class T, unsigned N><br> inline typename Vector<T, N>::value_type operator*(const Vector<T, N>& v1,<br>  const Vector<T, N>& v2) {<br>   typename Vector<T, N>::value_type sum = 0;<br>   for (unsigned i = 0; i < N; i++)<br>    sum += v1[i] * v2[i];<br>   return sum;<br> }</p> <p> // cross product for 3D Vectors<br> template <typename T><br> inline Vec3<T> operator^(const Vector<T, 3>& v1,<br>  const Vector<T, 3>& v2) {<br>   Vec3<T> res(v1[1] * v2[2] - v1[2] * v2[1],<br>    v1[2] * v2[0] - v1[0] * v2[2],<br>    v1[0] * v2[1] - v1[1] * v2[0]);<br>   return res;<br> }</p> <p> // stream operator<br> template <class T, unsigned N><br> inline std::ostream& operator<<(std::ostream& s,<br>  const Vector<T, N>& v) {<br>   unsigned i;<br>   s << "[";<br>   for (i = 0; i < N - 1; i++)<br>    s << v[i] << ", ";<br>   s << v[i] << "]";<br>   return s;<br> }</p> <p><br> //<br> // Matrix external functions<br> //<br> /////////////////////////////////////////////////////////////////////////////</p> <p> template <class T, unsigned M, unsigned N><br> inline Matrix<T, M, N><br>  operator+(const Matrix<T, M, N>& m1,<br>  const Matrix<T, M, N>& m2) {<br>   Matrix<T, M, N> res(m1);<br>   res += m2;<br>   return res;<br> }</p> <p> template <class T, unsigned M, unsigned N><br> inline Matrix<T, M, N><br>  operator-(const Matrix<T, M, N>& m1,<br>  const Matrix<T, M, N>& m2) {<br>   Matrix<T, M, N> res(m1);<br>   res -= m2;<br>   return res;<br> }</p> <p> template <class T, unsigned M, unsigned N><br> inline Matrix<T, M, N><br>  operator*(const Matrix<T, M, N>& m1,<br>  const typename Matrix<T, M, N>::value_type lambda) {<br>   Matrix<T, M, N> res(m1);<br>   res *= lambda;<br>   return res;<br> }</p> <p> template <class T, unsigned M, unsigned N><br> inline Matrix<T, M, N><br>  operator*(const typename Matrix<T, M, N>::value_type lambda,<br>  const Matrix<T, M, N>& m1) {<br>   Matrix<T, M, N> res(m1);<br>   res *= lambda;<br>   return res;<br> }</p> <p> template <class T, unsigned M, unsigned N><br> inline Matrix<T, M, N><br>  operator/(const Matrix<T, M, N>& m1,<br>  const typename Matrix<T, M, N>::value_type lambda) {<br>   Matrix<T, M, N> res(m1);<br>   res /= lambda;<br>   return res;<br> }</p> <p> template <class T, unsigned M, unsigned N, unsigned P><br> inline Matrix<T, M, P><br>  operator*(const Matrix<T, M, N>& m1,<br>  const Matrix<T, N, P>& m2) {<br>   unsigned i, j, k;<br>   Matrix<T, M, P> res;<br>   typename  Matrix<T, N, P>::value_type scale;</p> <p>   for (j = 0; j < P; j++) {<br>    for (k = 0; k < N; k++) {<br>     scale = m2(k, j);<br>     for (i = 0; i < N; i++)<br>      res(i, j) += m1(i, k) * scale;<br>    }<br>   }<br>   return res;<br> }</p> <p> template <class T, unsigned M, unsigned N><br> inline Vector<T, M><br>  operator*(const Matrix<T, M, N>& m,<br>  const Vector<T, N>& v) {</p> <p>   Vector<T, M> res;<br>   typename Matrix<T, M, N>::value_type scale;</p> <p>   for (unsigned j = 0; j < M; j++) {<br>    scale = v[j];<br>    for (unsigned i = 0; i < N; i++)<br>     res[i] += m(i, j) * scale;<br>   }<br>   return res;<br> }</p> <p> // stream operator<br> template <class T, unsigned M, unsigned N><br> inline std::ostream& operator<<(std::ostream& s,<br>  const Matrix<T, M, N>& m) {<br>   unsigned i, j;<br>   for (i = 0; i < M; i++) {<br>    s << "[";<br>    for (j = 0; j < N - 1; j++)<br>     s << m(i, j) << ", ";<br>    s << m(i, j) << "]" << std::endl;<br>   }<br>   return s;<br> }</p> <p>} // end of namespace vecmat</p> <p>#endif // VECMAT_H<br><br><br><span style="COLOR: red">鍘熷洜鏄湪windows鐨勫ご鏂囦歡閲宮ax錛宮in宸茬粡琚畾涔夋垚瀹忎簡錛屾墍浠ヨ鍑洪棶棰?<br>瑙e喅鏂規硶錛?br>鐢?br>#ifdef max<br>#undef max<br>#endif<br>鍘繪帀max鐨勫畾涔夈?br>min鍚屼笂銆?/span></p> <p style="COLOR: red">闂瑙e喅銆?/p> <img src ="http://www.shnenglu.com/Alina-zl/aggbug/67468.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/Alina-zl/" target="_blank">Alina-zl</a> 2008-11-21 11:21 <a href="http://www.shnenglu.com/Alina-zl/archive/2008/11/21/67468.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>CString, QString, char*涔嬮棿鐨勮漿鎹?/title><link>http://www.shnenglu.com/Alina-zl/archive/2008/11/19/67323.html</link><dc:creator>Alina-zl</dc:creator><author>Alina-zl</author><pubDate>Wed, 19 Nov 2008 13:39:00 GMT</pubDate><guid>http://www.shnenglu.com/Alina-zl/archive/2008/11/19/67323.html</guid><wfw:comment>http://www.shnenglu.com/Alina-zl/comments/67323.html</wfw:comment><comments>http://www.shnenglu.com/Alina-zl/archive/2008/11/19/67323.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.shnenglu.com/Alina-zl/comments/commentRss/67323.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/Alina-zl/services/trackbacks/67323.html</trackback:ping><description><![CDATA[<p><font style="BACKGROUND-COLOR: #ffffff" color=#0000ff>浼犵粰鏈垎閰嶅唴瀛樼殑const char* 錛圠PCTSTR錛夋寚閽?<br>   CString cstr(asdd);<br>   const char* ch = (LPCTSTR)cstr;<br>   ch鎸囧悜鐨勫湴鍧鍜宑str鐩稿悓銆備絾鐢變簬浣跨敤const淇濊瘉ch涓嶄細淇敼錛屾墍浠ュ畨鍏?2.浼犵粰鏈垎閰嶅唴瀛樼殑鎸囬拡.<br>    CString cstr = "ASDDSD";<br>    char *ch = cstr.GetBuffer(cstr1.GetLength() + 1);<br>    cstr.ReleaseBuffer();<br>    //淇敼ch鎸囧悜鐨勫肩瓑浜庝慨鏀筩str閲岄潰鐨勫?<br>    //PS:鐢ㄥ畬ch鍚?涓嶇敤delete ch,鍥犱負榪欐牱浼氱牬鍧廲str鍐呴儴絀洪棿,瀹規槗閫犳垚紼嬪簭宕╂簝.<br>3.絎簩縐嶇敤娉曘傛妸CString 鍊艱祴緇欏凡鍒嗛厤鍐呭瓨鐨刢har *銆?br>    CString cstr1 = "ASDDSD";<br>    int strLength = cstr1.GetLength() + 1;<br>    char *pValue = new char[strLength];<br>    strncpy(pValue, cstr1, strLength);<br>4.絎笁縐嶇敤娉?鎶奀String 鍊艱祴緇欏凡鍒嗛厤鍐呭瓨char[]鏁扮粍.<br>    CString cstr2 = "ASDDSD";<br>    int strLength1 = cstr1.GetLength() + 1;<br>    char chArray[100];<br>    memset(chArray,0, sizeof(bool) * 100); //灝嗘暟緇勭殑鍨冨溇鍐呭娓呯┖.<br>    strncpy(chArray, cstr1, strLength1);</font></p> <p><font style="BACKGROUND-COLOR: #ffffff" color=#0000ff>濡傛灉涓婅堪閮戒笉琛岋細<br>CString杞崲涓篶har*<br>        CString origCString("Hello, World!");<br>        wchar_t* wCharString = origCString.GetBuffer(origCString.GetLength()+1);<br>        size_t origsize = wcslen(wCharString) + 1;<br>        size_t convertedChars = 0;<br>        char *CharString;<br>        CharString=new char(origsize);<br>        wcstombs_s(&convertedChars, CharString, origsize, wCharString , _TRUNCATE);<br>        cout << CharString << endl; <br>鎴愬姛杈撳嚭瀛楃涓?Hello,World" </font></p> <p><font style="BACKGROUND-COLOR: #ffffff" color=#0000ff>鍘熷洜錛?br>鍘熸潵鍦╒C++ 2005浠ュ墠錛屽簲鐢ㄧ▼搴忛粯璁ら兘鏄叧闂Unicode鐨勬敮鎸佺殑錛岃屽湪VC2005涓紝榛樿鎵撳紑浜嗗瀹冪殑鏀寔錛孋String瀵瑰簲鐨勫瓧絎︿覆搴旇鏄疶CHAR錛孴CHAR鐨勫畾涔夋槸榪欐牱鐨勶紝<br>        #ifdef _UNICODE<br>        typedef wchar_t TCHAR    ;<br>        #else<br>        typedef char TCHAR;<br>        #endif <br>鎵浠ュ湪宸ョ▼涓簲璇ュ彲浠ュ叧闂浜嶶nicode鐨勬敮鎸侊紝浠庤屽彲浠ョ洿鎺ヨ漿鎹€傝繖涓仛娉曟槸鍙沖嚮宸ョ▼鍚嶁斻塒roperty鈥斻塆eneral涓殑character set涓夋嫨notset錛岃繖鏍鳳紝鏈枃寮澶寸殑閭f浠g爜灝卞彲浠ユ紜殑鎵ц浜嗐?/font></p> <font style="BACKGROUND-COLOR: #ffffff" color=#0000ff> <p><br>濡備綍灝哘String杞崲涓篶har *鎴栬呯浉鍙?</p> <p>How can I convert a QString to char* and vice versa ?(trolltech)</p> <p>Answer:<br>In order to convert a QString to a char*, then you first need to get a latin1 representation of the string by calling toLatin1() on it which will return a QByteArray. Then call data() on the QByteArray to get a pointer to the data stored in the byte array. See the documentation:</p> <p>See the following example for a demonstration:</p> <p>int main(int argc, char **argv)<br>{<br> QApplication app(argc, argv);<br> QString str1 = "Test";<br> QByteArray ba = str1.toLatin1();<br> const char *c_str2 = ba.data();<br> printf("str2: %s", c_str2);<br> return app.exec();   <br>}<br>Note that it is necessary to store the bytearray before you call data() on it, a call like the following<br>const char *c_str2 = str2.toLatin1().data();</p> <p>will make the application crash as the QByteArray has not been stored and hence no longer exists.</p> <p><br>To convert a char* to a QString you can use the QString constructor that takes a QLatin1String, e.g:</p> <p>QString string = QString(QLatin1String(c_str2)) ;</p> <p> </p> <p>榪樻湁鍏朵粬澶氱鏂規硶錛?/p> <p>鏂規硶涓 -----------------------------------------<br>#define G2U(s) ( QTextCodec::codecForName("GBK")->toUnicode(s) )<br>#define U2G(s) ( QTextCodec::codecForName("GBK")->fromUnicode(s) )</p> <p>QString str;<br>QCString cstr;</p> <p>str = G2U("涓枃杈撳叆");<br>cstr = U2G(str);</p> <p>QCString鏈夎繖鏍蜂竴涓噸杞借繍綆楃<br>operator const char * () const</p> <p>鍙互榪欐牱<br>printf("%s\n", (const char*) cstr);<br>鎴栨槸copy鍑烘潵<br>char buf[1024];<br>strcpy(buf, (const char*) cstr);</p> <p> </p> <p>鏂規硶浜?-----------------------------------------<br>濡傛灉鏄腑鏂囩郴緇?/p> <p>鐩存帴鐢?nbsp;  (const char*) str.local8Bit()<br>渚嬪<br>printf("%s", (const char*) str.local8Bit());</p> <p>str鏄竴涓猀String</p> <p>鏂規硶涓?-----------------------------------------<br>char str[64];<br>QTextCodec *textcod = QTextCodec::codecForName("GBK");<br>        QCString string1 = textcod ->fromUnicode(listbox1->currentText());<br>        strcpy(str,string1);</p> <p>QString鍜孲td::string</p> <p> 浠巆har*鍒?QString鍙互浠巉romLocal8Bit()杞寲<br>std::string鏈塩_str()鐨勫嚱鏁頒嬌鍐嶈漿鍖栦負char*</p> <p>QString鏈塼oAscii()璁頒笉娓呬簡</p> <p><br>浣犲彲浠ョ湅鐪? </p> <p><br>鍙堟槸鎴戠殑綺楀績閰挎垚澶ч敊錛屾垜閲嶆柊鏌ョ湅浜嗕竴涓婹t鏂囨。錛屽師鏉t鍙互鐩存帴浠巗td::wstring浜х敓涓涓猀String錛岀敤QString::fromStdWString(const std::wstring &)榪欎釜闈欐佹垚鍛樺嚱鏁板嵆鍙傛垜璇曚簡璇曠敤std::string鐨刢_str()榪斿洖鐨刢har *鏋勯犵殑QString涓嶈兘鍐嶄繚瀛樺師鍏堢殑涓枃淇℃伅錛岃岀敤std::wstring鏋勯犵殑QString鍒欏彲浠ョ敤qDebug()杈撳嚭鍘熷厛鐨勪腑鏂囦俊鎭?<br>GB緙栫爜涓嶶TF8緙栫爜鐨勮漿鎹?br>鍦ㄤ富鍑芥暟app鍚庡姞涓婅繖鍙ワ細</p> <p>QUOTE:</p> <p>QTextCodec::setCodecForLocale(QTextCodec::codecForName("GB18030"));</p> <p> </p> <p>鐒跺悗鏄粠UTF8緙栫爜鍒癎B緙栫爜鐨勫瓧絎︿覆杞崲鏂規硶錛?/p> <p>QUOTE:</p> <p><br>QString Utf8_To_GB(QString strText)<br>{<br>    return QString::fromUtf8(strText.toLocal8Bit().data());<br>}</p> <p> </p> <p>鑷充簬浠嶨B鍒癠TF8錛岄偅澶у灝辯粡甯哥敤浜嗭細</p> <p>QUOTE:</p> <p>QString GB_To_Utf8(char *strText)<br>{<br>    return QString::fromLocal8Bit(strText);<br>}</font><font color=#0000ff></font></p> <img src ="http://www.shnenglu.com/Alina-zl/aggbug/67323.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/Alina-zl/" target="_blank">Alina-zl</a> 2008-11-19 21:39 <a href="http://www.shnenglu.com/Alina-zl/archive/2008/11/19/67323.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <p>感谢您访问我们的网站,您可能还对以下资源感兴趣:</p> <a href="http://www.shnenglu.com/" title="精品视频久久久久">精品视频久久久久</a> <div class="friend-links"> </div> </div> </footer> <a href="http://www.jianhua365.cn" target="_blank">色婷婷综合久久久中文字幕</a>| <a href="http://www.yyfeixiang.cn" target="_blank">久久亚洲精品中文字幕</a>| <a href="http://www.07sn.cn" target="_blank">久久国产精品波多野结衣AV</a>| <a href="http://www.fzcxpc.cn" target="_blank">狠狠色伊人久久精品综合网 </a>| <a href="http://www.c825.cn" target="_blank">国产婷婷成人久久Av免费高清</a>| <a href="http://www.bjxcst.cn" target="_blank">午夜精品久久久久久中宇</a>| <a href="http://www.08fq.cn" target="_blank">韩国无遮挡三级久久</a>| <a href="http://www.wsjpt.cn" target="_blank">久久亚洲国产成人精品无码区</a>| <a href="http://www.bestfarms.cn" target="_blank">狠狠色丁香久久婷婷综合图片</a>| <a href="http://www.h3cedu.cn" target="_blank">久久99国产精品尤物</a>| <a href="http://www.thesmarterwaytofaster.cn" target="_blank">久久国产乱子伦精品免费午夜</a>| <a href="http://www.odbgw.cn" target="_blank">亚洲av日韩精品久久久久久a</a>| <a href="http://www.pzpt369.cn" target="_blank">久久亚洲国产午夜精品理论片</a>| <a href="http://www.ozkz.cn" target="_blank">国产精品久久久久久久久软件</a>| <a href="http://www.ylssmedia.cn" target="_blank">久久国产精品99精品国产</a>| <a href="http://www.093156.net.cn" target="_blank">精品久久综合1区2区3区激情</a>| <a href="http://www.vcfh.cn" target="_blank">久久亚洲AV成人无码电影</a>| <a href="http://www.ggfuns.cn" target="_blank">天天影视色香欲综合久久</a>| <a href="http://www.h2ofood.cn" target="_blank">91麻豆精品国产91久久久久久</a>| <a href="http://www.dnf-video.cn" target="_blank">狠狠综合久久综合88亚洲</a>| <a href="http://www.pp4f.cn" target="_blank">亚洲精品美女久久久久99小说</a>| <a href="http://www.by6463.cn" target="_blank">精品国产一区二区三区久久</a>| <a href="http://www.pc168.com.cn" target="_blank">精品人妻伦九区久久AAA片69</a>| <a href="http://www.mllp.net.cn" target="_blank">久久久久99精品成人片三人毛片</a>| <a href="http://www.kwig.cn" target="_blank">2020久久精品国产免费</a>| <a href="http://www.ctcscs.cn" target="_blank">无码人妻久久一区二区三区</a>| <a href="http://www.fiyhigh.com.cn" target="_blank">武侠古典久久婷婷狼人伊人</a>| <a href="http://www.clkj168.cn" target="_blank">国产亚洲色婷婷久久99精品91</a>| <a href="http://www.ljhn.com.cn" target="_blank">久久A级毛片免费观看</a>| <a href="http://www.cnnsmi.org.cn" target="_blank">久久精品国产99国产精品亚洲</a>| <a href="http://www.xishuixian.com.cn" target="_blank">久久九九久精品国产</a>| <a href="http://www.udyq.cn" target="_blank">久久se精品一区二区影院</a>| <a href="http://www.rszgrh2.cn" target="_blank">91久久香蕉国产熟女线看</a>| <a href="http://www.nbblack.cn" target="_blank">欧美精品一本久久男人的天堂</a>| <a href="http://www.yadangxiawa.cn" target="_blank">国产成人精品免费久久久久</a>| <a href="http://www.abensky.cn" target="_blank">久久综合精品国产二区无码</a>| <a href="http://www.icaew.com.cn" target="_blank">亚洲精品无码久久久久去q</a>| <a href="http://www.mynyf8.cn" target="_blank">一本色道久久99一综合</a>| <a href="http://www.wz65.cn" target="_blank">亚洲AV成人无码久久精品老人</a>| <a href="http://www.65it.cn" target="_blank">熟妇人妻久久中文字幕</a>| <a href="http://www.vrfx.cn" target="_blank">久久天堂AV综合合色蜜桃网</a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>