<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-17070175</id><updated>2011-04-21T18:18:28.965-07:00</updated><title type='text'>Technical Articles</title><subtitle type='html'>Writing/Linking/Debugging code is Nirvana in itself!!!Patience and Persistence is the name of the game.This page contains bugs encountered and its solution...I thought it will be cool to document these who knows I might face the same bugs again</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://technicalphilosopher-technical.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17070175/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://technicalphilosopher-technical.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Karthik Sankar</name><uri>http://www.blogger.com/profile/00995549408334380645</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/_caWjb-3XGho/TRgX_-A70kI/AAAAAAAADEQ/5IxUqLJHnmM/S220/Photo%2B33.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>6</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-17070175.post-6828978570107400496</id><published>2008-11-06T03:29:00.000-08:00</published><updated>2008-11-06T03:42:03.875-08:00</updated><title type='text'>c++ - A ready reckoner</title><content type='html'>&lt;div align="left"&gt;&lt;span style="font-family:lucida grande;"&gt;1)typedef syntax for function name:&lt;br /&gt;Usage : typedef return-type (classname::*fnname)(argument)&lt;br /&gt;2)Operators that cannot be used for overloading&lt;br /&gt;::               .               .*              .-&gt;&lt;br /&gt;Scope resolution member selection member selection through pointer to function&lt;br /&gt;3)int A::a=0; initializing static variables where a is a static int in class A&lt;br /&gt;4)explicit constructors dissallow use of automatically generated functions&lt;br /&gt;explicit stack(int a)&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;stack a=10;//will not call statck(int a ) since explicit is specified&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;5.Const members can be initialized only usuing initialization list&lt;br /&gt;stack():a(10) if a is of type const int a;&lt;br /&gt;trick:&lt;br /&gt;stack{&lt;br /&gt;enum{a=10};// initializes a to 10&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;6: const * char a=5; constant pointer&lt;br /&gt;const char * a=5;pointer to a constant&lt;br /&gt;7.Dynamic cast converts base class object to derived class object&lt;br /&gt;8.Virtual destructor is needed in Base class when Base class ptr points to derived object&lt;br /&gt;otherwise derived destructor will not get called&lt;br /&gt;9.Base ptr can be assigned to derived but not vice versa&lt;br /&gt;10.operator new can be overloaded&lt;br /&gt;11.To convert an object of type S to an int then we need to define a conversion operator()&lt;br /&gt;operator int()&lt;br /&gt;{&lt;br /&gt;return this-&gt;i; //where i is an int i member of class S&lt;br /&gt;}&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt;int i;&lt;br /&gt;S s;&lt;br /&gt;i=s;//calls operator int&lt;br /&gt;}&lt;br /&gt;12) Making a privately inherited member function public&lt;br /&gt;say fun is public in base class and we inherit this by private inheritance&lt;br /&gt;then declare base::fun(no arguments or return values) in public: of derived&lt;br /&gt;fun will be accesible to objects of derived class&lt;br /&gt;&lt;br /&gt;13) say top is a global var and top is also a variable inside a class then&lt;br /&gt;::top inside the class refers to the global variable&lt;br /&gt;14)protected member cannot be accessed from main&lt;br /&gt;15)derived():base() is the same as derived() cause anyway derived object will first call base class constructor&lt;br /&gt;16)class D:public B1,public B2&lt;br /&gt;construction:B1,B2,D&lt;br /&gt;destrcution:D,B2,B1&lt;br /&gt;17)Friends of a base class are not inherited by any classes derived from that base class&lt;br /&gt;18)The name of a friend function or class first introduced in a friend declaration is not in the scope of the class granting friendship (also called the enclosing class) and is not a member of the class granting friendship&lt;br /&gt;19)&lt;br /&gt;using directive - using namespace std //provides access to all members&lt;br /&gt;using declarative-using A::x&lt;br /&gt;explicit A::x&lt;br /&gt;20)&lt;br /&gt;When operator() is overloaded...The function call a('z') is interpreted as a.operator()('z').&lt;br /&gt;similarly A(obj_B) will be obj_B.operator A()&lt;br /&gt;21)A pseudo destructor has no effect at all&lt;br /&gt;22)Malloc fails with std::bad_alloc&lt;br /&gt;23)Virtual function mechanism does not work within the constructor&lt;br /&gt;i.e when a derived object is created first base class constructor is called and if a virtual fn is called from within&lt;br /&gt;the base class constructor it will still call only the base class version since the derived object is still not constructed&lt;br /&gt;24)Operator new(size_t sz)&lt;br /&gt;X * ptr=new X; is equivalent to new(Size(X))&lt;br /&gt;The statement delete ptr calls X::operator delete(void*) delete when overloaded accepts a void pointer&lt;br /&gt;25)const data are initialized in the initialization list....there is no const class&lt;br /&gt;26)copy constructor gets called in call and retun by value&lt;br /&gt;26a) When an object is passed to a function,the constructor does not get called even though a local temp object is created&lt;br /&gt;27)class A&lt;br /&gt;{&lt;br /&gt;void display const();&lt;br /&gt;};&lt;br /&gt;defn: A::display()const&lt;br /&gt;{}&lt;br /&gt;28)&lt;br /&gt;A copy constructor of a class A is a non-template constructor in which the first parameter is of type A&amp;amp;, const A&amp;amp;, volatile A&amp;amp;, or const volatile A&amp;amp;, and the rest of its parameters (if there are any) have default values.&lt;br /&gt;&lt;br /&gt;29)&lt;br /&gt;&lt;br /&gt;template syntax: template &lt;class&gt;class mycontainer { ... };&lt;br /&gt;specialization specialization syntax:template &lt;&gt; class mycontainer &lt;char&gt;{ ... };&lt;br /&gt;&lt;br /&gt;30)&lt;br /&gt;&lt;br /&gt;template &lt;class&gt;&lt;br /&gt;T mypair&lt;t&gt;::getmax ()&lt;br /&gt;Confused by so many T's? There are three T's in this declaration: The first one is the template parameter. The second T refers to the type returned by the function. And the third T (the one between angle brackets) is also a requirement: It specifies that this function's template parameter is also the class template parameter&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;31)&lt;br /&gt;A function try block on main() does not catch exceptions thrown in destructors of objects&lt;br /&gt;with i)static storage duration, or ii)constructors of namespace scope objects&lt;br /&gt;i) ex.&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt;A a;&lt;br /&gt;static B b;&lt;br /&gt;}&lt;br /&gt;if exception is thrown in Destructors of A and B only A's will be called.B is staic so will not be called&lt;br /&gt;ii)&lt;br /&gt;namespace N {&lt;br /&gt;class C {&lt;br /&gt;public:&lt;br /&gt;C() {&lt;br /&gt;cout &lt;&lt; "In C()" &lt;&lt; pilocal =" const_cast"&gt;(const_int_arg);&lt;br /&gt;*piLocal = iVal; //able change value of const int&lt;br /&gt;piLocal is int* type.&lt;br /&gt;static_cast:any standard conversion&lt;br /&gt;reinterpret_cast:converison to any other type&lt;br /&gt;int i;&lt;br /&gt;char *cpPtr = "Hello World";&lt;br /&gt;i = reinterpret_cast &lt;int&gt;(cpPtr);&lt;br /&gt;37)&lt;br /&gt;Sample s;&lt;br /&gt;s=i;(overload operator() to return int)&lt;br /&gt;s=s+10(overload +operator accepting sample parameter and provide one argument constructor)&lt;br /&gt;38)&lt;br /&gt;const function prevents the modification of the data members of the class within it&lt;br /&gt;39)&lt;br /&gt;conversion operators have the same name and return tyoe of the object to whic they are converted to&lt;br /&gt;ex.operator int(){&lt;br /&gt;return this-&gt;i;}&lt;br /&gt;operator circle(){ //inside operator circle() is in shape class&lt;br /&gt;return circle(data);} circle c;shape s;&lt;br /&gt;c=s;//calls conversion operator&lt;br /&gt;40)&lt;br /&gt;function pointer with typedef&lt;br /&gt;int fun(int,int);&lt;br /&gt;typedef int (*pftr)(int,int);&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt;pftr pf=fun;&lt;br /&gt;}&lt;br /&gt;function pointer without typedef//not that impor&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt;int(*pftr)(int,int);//prototype&lt;br /&gt;*pftr=fun&lt;br /&gt;}&lt;br /&gt;(*pftr)(10,2)&lt;br /&gt;&lt;br /&gt;41)If a pure virtual fn in Base is not implementedin Derived,the Derived class also becomes abstract and we cannot create objects of the Derived class also&lt;br /&gt;42)Unexpected throws bad_exception if the fn calling unexpected include std::bad_exception throw in the throw list&lt;br /&gt;If not included Unexpectd calls its default i.e terminate&lt;br /&gt;43)sequence&lt;br /&gt;try=&gt;throw=&gt;catch=&gt;unexpected=&gt;terminate=&gt;abort&lt;br /&gt;..................... (MyUnexpected)=&gt;(Myterminate)&lt;br /&gt;&lt;br /&gt;44)Dynamic cast:&lt;br /&gt;conversion between same types,conversion from base to derived if base*ptr points to derived&lt;br /&gt;const_cast convert from const to ordinary&lt;br /&gt;static_cast standard casting i.e int to double etc...&lt;br /&gt;reinterpret cast -fully different int to char etc...&lt;br /&gt;45)&lt;br /&gt;The STL provides 11 containers, divided into four categories.&lt;br /&gt;The sequential containers include the- vector (dynamic array), list, and deque.&lt;br /&gt;The container adapters -queue, priority_queue, and stack.&lt;br /&gt;The associative containers-map, multimap, set, and multiset.&lt;br /&gt;The final container, the bitset, is in a class of its own.&lt;br /&gt;46)&lt;br /&gt;&lt;br /&gt;STL algorithms:&lt;br /&gt;Utility-min,max,swap&lt;br /&gt;Non-Modifying-find,find_if&lt;br /&gt;Numeric:accumulate()&lt;br /&gt;Comparison:equal,mismatch,lexicographic_compare()&lt;br /&gt;operational:for_each()&lt;br /&gt;&lt;br /&gt;47)const objects can call only const member function&lt;br /&gt;48)In the diamond problem,the most derived i.e the class lowest in the list should initialize the VB class.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Extra:&lt;br /&gt;&lt;br /&gt;1)Call to pure virtual function directly will result in runtime exception&lt;br /&gt;class test&lt;br /&gt;{&lt;br /&gt;A()&lt;br /&gt;{&lt;br /&gt;fun();&lt;br /&gt;}&lt;br /&gt;virtual void fun()=0;&lt;br /&gt;};&lt;br /&gt;2)In the diamond problem the Virtual Base class value will be the one assigned by the constructor at the bottom of the diamond.&lt;br /&gt;3)Base class pointers cannot be passed to functions which take Derived class pointer.&lt;br /&gt;&lt;br /&gt;4)In templates for the ones with non type arguments like template &lt;class&gt;class test&lt;br /&gt;the following will work&lt;br /&gt;const int t;&lt;br /&gt;test&lt;int,t&gt; since t is const int if it is int t then it will give compilation error.const can be signed or unsigned&lt;br /&gt;5)&lt;br /&gt;Note that in const pointers, "const" always comes after the "*". For example:&lt;br /&gt;&lt;br /&gt;int *const p1 = q; // constant pointer to int variable&lt;br /&gt;int const* p2 = q; // pointer to constant int&lt;br /&gt;const int* p3 = q; // pointer to constant int&lt;br /&gt;6)int can be converted to signed char,unsigned char or char&lt;br /&gt;fn('A') will call int if char not available...it will not call short fn(0) will call fn(int)&lt;br /&gt;7)Fn&lt;&gt;(2,3) will also call Fn(T t,U u)&lt;br /&gt;8)An ordinary non template function is always given priority over the template instantiation function&lt;br /&gt;so fin(2,3) will call Fn(Tt,Uu) over Fn(in,int)...no compilation eror&lt;br /&gt;9)bitset::count gives no.of set bits&lt;br /&gt;10)In function overloading ,if there is polymorphism(base ptr pointing to derived) then the matching is as follows&lt;br /&gt;i)If base version has stronger match(send char and if base has double and derived has int...double&gt;int match to char)&lt;br /&gt;then base version gets called&lt;br /&gt;ii)if base and derived have equal strngth then base version is called&lt;br /&gt;11)ordinary fn always given priority over similar overloaded template ones&lt;br /&gt;12) class X&lt;br /&gt;{&lt;br /&gt;int f(X&amp;amp;){}&lt;br /&gt;}&lt;br /&gt;main(){ f(10);//error will call only if f takes const X&amp;amp; or X and not X&amp;amp;}&lt;br /&gt;13) w.r.to 12&lt;br /&gt;int &amp;amp;x=1;//error&lt;br /&gt;const int &amp;amp;x=1;//correct&lt;br /&gt;14)return by reference is ok as long as the refernce does not point to a local object&lt;br /&gt;15)Buffer&lt;char,20-10&gt;is same as Buffer&lt;char,10&gt;&lt;br /&gt;int&amp;amp; f(){int a;return a;//problem)&lt;br /&gt;16)A pure virtual fn should be overridden by derived class and till it is overridden the intermediate derived calsses are all abstarct classes i.e we cannot create objects of those classes(even if other functions are there)&lt;br /&gt;17)In templates,&lt;br /&gt;i)first instatiation is done,if exact match is there with a user defined specialisation(here int)then int is called&lt;br /&gt;ii)If there is no exact match then it calls the template instantiation(even though 'a',b' can be converted to int,still&lt;br /&gt;template version is called since instatiation gives char,char&lt;br /&gt;Hint:do instantiation and treat is as if that function is physically there and then apply operator overloding rules.&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17070175-6828978570107400496?l=technicalphilosopher-technical.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://technicalphilosopher-technical.blogspot.com/feeds/6828978570107400496/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17070175&amp;postID=6828978570107400496' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17070175/posts/default/6828978570107400496'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17070175/posts/default/6828978570107400496'/><link rel='alternate' type='text/html' href='http://technicalphilosopher-technical.blogspot.com/2008/11/c-ready-reckoner.html' title='c++ - A ready reckoner'/><author><name>Karthik Sankar</name><uri>http://www.blogger.com/profile/00995549408334380645</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/_caWjb-3XGho/TRgX_-A70kI/AAAAAAAADEQ/5IxUqLJHnmM/S220/Photo%2B33.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17070175.post-114524855597676421</id><published>2006-04-16T21:30:00.000-07:00</published><updated>2006-04-16T21:35:55.986-07:00</updated><title type='text'>Closing the dialog smoothly(fade out)</title><content type='html'>http://www.codeguru.com/cpp/w-d/dislog/animation/article.php/c5063/&lt;br /&gt;&lt;br /&gt;I "found" how to close a dialog box smoothly that is fade away.....&lt;br /&gt;&lt;br /&gt;code snippets:&lt;br /&gt;&lt;br /&gt;#include &lt;Winuser.h&gt; //for User32.dll&lt;br /&gt;HMODULE hUserDll;&lt;br /&gt;#define WS_EX_LAYERED 0x00080000&lt;br /&gt;#define LWA_ALPHA 0x00000002&lt;br /&gt;&lt;br /&gt;hUserDll = ::LoadLibrary(_T("USER32.dll"));&lt;br /&gt;//Change style to layered window style...&lt;br /&gt;::SetWindowLong(m_hWnd, GWL_EXSTYLE, ::GetWindowLong(m_hWnd, GWL_EXSTYLE) |  WS_EX_LAYERED );&lt;br /&gt;SetTransparent(m_hWnd, 0, 255 * 100/100 , LWA_ALPHA );&lt;br /&gt;&lt;br /&gt;//The above will set the window to a layered style and the initial transparency value is set&lt;br /&gt;&lt;br /&gt;void CMyDialog::SetTransparent(HWND hWnd, COLORREF crKey,&lt;br /&gt;                    BYTE  bAlpha, DWORD dwFlags)&lt;br /&gt;{&lt;br /&gt;  BOOL bRet = TRUE;&lt;br /&gt;  typedef BOOL (WINAPI* lpfnSetTransparent)(HWND hWnd,&lt;br /&gt;                                       COLORREF crKey,&lt;br /&gt;                                          BYTE bAlpha,&lt;br /&gt;                                       DWORD dwFlags);&lt;br /&gt;&lt;br /&gt;  // Check that "USER32.dll" library has been&lt;br /&gt;  // loaded successfully...&lt;br /&gt;  if (hUserDll )&lt;br /&gt;  {&lt;br /&gt;    lpfnSetTransparent pFnSetTransparent = NULL;&lt;br /&gt;    pFnSetTransparent =&lt;br /&gt;      (lpfnSetTransparent)GetProcAddress(hUserDll,&lt;br /&gt;                    "SetLayeredWindowAttributes");&lt;br /&gt;&lt;br /&gt;    if (pFnSetTransparent )&lt;br /&gt;       bRet = pFnSetTransparent(hWnd, crKey, bAlpha, dwFlags);&lt;br /&gt;    else&lt;br /&gt;       bRet = FALSE;&lt;br /&gt;  } // if( m_hUserDll )&lt;br /&gt;&lt;br /&gt;   return bRet;&lt;br /&gt;} // End of SetTransparent function&lt;br /&gt;&lt;br /&gt;//The above will set the transparency of the window(here dialog)&lt;br /&gt;void CMyDialog::CloseSmoothly()&lt;br /&gt;{&lt;br /&gt;  // Increase transparency one percent each time...&lt;br /&gt;  for(int nPercent=100; nPercent &gt;= 0 ;nPercent--)&lt;br /&gt;     SetTransparent( m_hWnd, 0, 255 * nPercent/100, LWA_ALPHA);&lt;br /&gt;  if( hUserDll )&lt;br /&gt;   FreeLibrary(hUserDll);&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17070175-114524855597676421?l=technicalphilosopher-technical.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://technicalphilosopher-technical.blogspot.com/feeds/114524855597676421/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17070175&amp;postID=114524855597676421' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17070175/posts/default/114524855597676421'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17070175/posts/default/114524855597676421'/><link rel='alternate' type='text/html' href='http://technicalphilosopher-technical.blogspot.com/2006/04/closing-dialog-smoothlyfade-out.html' title='Closing the dialog smoothly(fade out)'/><author><name>Karthik Sankar</name><uri>http://www.blogger.com/profile/00995549408334380645</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/_caWjb-3XGho/TRgX_-A70kI/AAAAAAAADEQ/5IxUqLJHnmM/S220/Photo%2B33.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17070175.post-114439048018185057</id><published>2006-04-06T23:07:00.000-07:00</published><updated>2006-04-06T23:14:40.200-07:00</updated><title type='text'>Creating a Tabbed Property Sheet with 2 embedded Property pages:</title><content type='html'>//This is a simple SDK approach u can also use CPropertypage&lt;br /&gt;&lt;br /&gt;Creating a Tabbed Property Sheet with 2 embedded Property pages:&lt;br /&gt;&lt;br /&gt;Description:&lt;br /&gt;============&lt;br /&gt;PROPSHEETHEADER m_PropSheet;&lt;br /&gt;PROPSHEETPAGE m_psp[2];&lt;br /&gt;&lt;br /&gt;LRESULT CALLBACK SheetProc(HWND, UINT, WPARAM, LPARAM);&lt;br /&gt;//callback for Property sheet&lt;br /&gt;LRESULT CALLBACK Page1DlgProc(HWND, UINT, WPARAM, LPARAM);&lt;br /&gt;//callback for Property Page 1&lt;br /&gt;LRESULT CALLBACK Page2DlgProc(HWND, UINT, WPARAM, LPARAM);&lt;br /&gt;//callback for Property Page 2&lt;br /&gt;&lt;br /&gt;memset(m_psp, 0, sizeof(m_psp));&lt;br /&gt;memset(&amp;m_PropSheet, 0, sizeof(m_PropSheet));&lt;br /&gt;&lt;br /&gt;//allocate memory for property pages&lt;br /&gt;//initialize property page structure&lt;br /&gt;    m_psp[0].dwSize = sizeof(PROPSHEETPAGE);&lt;br /&gt;    m_psp[0].dwFlags = PSP_DEFAULT|PSP_USETITLE;&lt;br /&gt;    m_psp[0].pszTemplate = (LPCSTR)IDD_PAGE1;&lt;br /&gt;//IDD_PAGE1 is the dialog box for page1,create it in the resource&lt;br /&gt;    m_psp[0].pszTitle = "Page 1";&lt;br /&gt;    m_psp[0].pfnDlgProc = (DLGPROC)Page1DlgProc;&lt;br /&gt;//Page1DlgProc is the callback procedure for Page1 dialog&lt;br /&gt;&lt;br /&gt;//do the same for page 2&lt;br /&gt;&lt;br /&gt;    m_psp[1].dwSize = sizeof(PROPSHEETPAGE);&lt;br /&gt;    m_psp[1].dwFlags = PSP_USETITLE;&lt;br /&gt;    m_psp[1].pszTemplate = (LPCSTR)IDD_PAGE2;&lt;br /&gt;    m_psp[1].pszTitle = "Page 2";&lt;br /&gt;    m_psp[1].pfnDlgProc = (DLGPROC)Page2DlgProc;&lt;br /&gt;&lt;br /&gt;//Initialize property sheet structure&lt;br /&gt;     m_PropSheet.dwSize = sizeof(PROPSHEETHEADER);&lt;br /&gt;    m_PropSheet.dwFlags = PSH_PROPSHEETPAGE | PSH_USECALLBACK;&lt;br /&gt;    m_PropSheet.pszCaption = (LPSTR) "Property Sheet";&lt;br /&gt;    m_PropSheet.nPages = 2;&lt;br /&gt;    m_PropSheet.nStartPage = 0;&lt;br /&gt;    m_PropSheet.ppsp = (LPCPROPSHEETPAGE)m_psp;&lt;br /&gt;    m_PropSheet.pfnCallback = (PFNPROPSHEETCALLBACK) SheetProc;&lt;br /&gt;    &lt;br /&gt;Call this code where required say froma  dialog or from a  window….pass the appropriate handle.&lt;br /&gt;    m_PropSheet.hwndParent = CPropSheetDlg::m_hWnd;&lt;br /&gt;    PropertySheet(&amp;m_PropSheet);//invokes the property sheet with 2 pages&lt;br /&gt;&lt;br /&gt;Source code:&lt;br /&gt;&lt;br /&gt;I have popped the property sheet from a Dialog PropsheetDialog on click of "Prop "button&lt;br /&gt;&lt;br /&gt;Create an MFC dialog application called PropSheetDlg and add the following code in PropSheetDlg.cpp&lt;br /&gt;This is the propsheetdlg.cpp code&lt;br /&gt;&lt;br /&gt;// PropSheetDlg.cpp : implementation file&lt;br /&gt;//&lt;br /&gt;&lt;br /&gt;#include "stdafx.h"&lt;br /&gt;#include "PropSheet.h"&lt;br /&gt;#include "PropSheetDlg.h"&lt;br /&gt;&lt;br /&gt;#ifdef _DEBUG&lt;br /&gt;#define new DEBUG_NEW&lt;br /&gt;#undef THIS_FILE&lt;br /&gt;static char THIS_FILE[] = __FILE__;&lt;br /&gt;#endif&lt;br /&gt;&lt;br /&gt;/////////////////////////////////////////////////////////////////////////////&lt;br /&gt;// CAboutDlg dialog used for App About&lt;br /&gt;&lt;br /&gt;class CAboutDlg : public CDialog&lt;br /&gt;{&lt;br /&gt;public:&lt;br /&gt; CAboutDlg();&lt;br /&gt;&lt;br /&gt;// Dialog Data&lt;br /&gt; //{{AFX_DATA(CAboutDlg)&lt;br /&gt; enum { IDD = IDD_ABOUTBOX };&lt;br /&gt; //}}AFX_DATA&lt;br /&gt;&lt;br /&gt; // ClassWizard generated virtual function overrides&lt;br /&gt; //{{AFX_VIRTUAL(CAboutDlg)&lt;br /&gt; protected:&lt;br /&gt; virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support&lt;br /&gt; //}}AFX_VIRTUAL&lt;br /&gt;&lt;br /&gt;// Implementation&lt;br /&gt;protected:&lt;br /&gt; //{{AFX_MSG(CAboutDlg)&lt;br /&gt; //}}AFX_MSG&lt;br /&gt; DECLARE_MESSAGE_MAP()&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)&lt;br /&gt;{&lt;br /&gt; //{{AFX_DATA_INIT(CAboutDlg)&lt;br /&gt; //}}AFX_DATA_INIT&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void CAboutDlg::DoDataExchange(CDataExchange* pDX)&lt;br /&gt;{&lt;br /&gt; CDialog::DoDataExchange(pDX);&lt;br /&gt; //{{AFX_DATA_MAP(CAboutDlg)&lt;br /&gt; //}}AFX_DATA_MAP&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)&lt;br /&gt; //{{AFX_MSG_MAP(CAboutDlg)&lt;br /&gt;  // No message handlers&lt;br /&gt; //}}AFX_MSG_MAP&lt;br /&gt;END_MESSAGE_MAP()&lt;br /&gt;&lt;br /&gt;/////////////////////////////////////////////////////////////////////////////&lt;br /&gt;// CPropSheetDlg dialog&lt;br /&gt;&lt;br /&gt;CPropSheetDlg::CPropSheetDlg(CWnd* pParent /*=NULL*/)&lt;br /&gt; : CDialog(CPropSheetDlg::IDD, pParent)&lt;br /&gt;{&lt;br /&gt; //{{AFX_DATA_INIT(CPropSheetDlg)&lt;br /&gt;  // NOTE: the ClassWizard will add member initialization here&lt;br /&gt; //}}AFX_DATA_INIT&lt;br /&gt; // Note that LoadIcon does not require a subsequent DestroyIcon in Win32&lt;br /&gt; m_hIcon = AfxGetApp()-&gt;LoadIcon(IDR_MAINFRAME);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void CPropSheetDlg::DoDataExchange(CDataExchange* pDX)&lt;br /&gt;{&lt;br /&gt; CDialog::DoDataExchange(pDX);&lt;br /&gt; //{{AFX_DATA_MAP(CPropSheetDlg)&lt;br /&gt;  // NOTE: the ClassWizard will add DDX and DDV calls here&lt;br /&gt; //}}AFX_DATA_MAP&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;BEGIN_MESSAGE_MAP(CPropSheetDlg, CDialog)&lt;br /&gt; //{{AFX_MSG_MAP(CPropSheetDlg)&lt;br /&gt; ON_WM_SYSCOMMAND()&lt;br /&gt; ON_WM_PAINT()&lt;br /&gt; ON_WM_QUERYDRAGICON()&lt;br /&gt; ON_BN_CLICKED(IDC_PROP, OnProp)&lt;br /&gt; //}}AFX_MSG_MAP&lt;br /&gt;END_MESSAGE_MAP()&lt;br /&gt;&lt;br /&gt;/////////////////////////////////////////////////////////////////////////////&lt;br /&gt;// CPropSheetDlg message handlers&lt;br /&gt;PROPSHEETHEADER m_PropSheet;&lt;br /&gt;PROPSHEETPAGE m_psp[2];&lt;br /&gt;LOGFONT m_lfont;&lt;br /&gt;&lt;br /&gt;LRESULT CALLBACK SheetProc(HWND, UINT, WPARAM, LPARAM);&lt;br /&gt;LRESULT CALLBACK Page1DlgProc(HWND, UINT, WPARAM, LPARAM);&lt;br /&gt;LRESULT CALLBACK Page2DlgProc(HWND, UINT, WPARAM, LPARAM);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;BOOL CPropSheetDlg::OnInitDialog()&lt;br /&gt;{&lt;br /&gt; CDialog::OnInitDialog();&lt;br /&gt;&lt;br /&gt; // Add "About..." menu item to system menu.&lt;br /&gt;&lt;br /&gt; // IDM_ABOUTBOX must be in the system command range.&lt;br /&gt; ASSERT((IDM_ABOUTBOX &amp; 0xFFF0) == IDM_ABOUTBOX);&lt;br /&gt; ASSERT(IDM_ABOUTBOX &lt; 0xF000);&lt;br /&gt;&lt;br /&gt; CMenu* pSysMenu = GetSystemMenu(FALSE);&lt;br /&gt; if (pSysMenu != NULL)&lt;br /&gt; {&lt;br /&gt;  CString strAboutMenu;&lt;br /&gt;  strAboutMenu.LoadString(IDS_ABOUTBOX);&lt;br /&gt;  if (!strAboutMenu.IsEmpty())&lt;br /&gt;  {&lt;br /&gt;   pSysMenu-&gt;AppendMenu(MF_SEPARATOR);&lt;br /&gt;   pSysMenu-&gt;AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; // Set the icon for this dialog.  The framework does this automatically&lt;br /&gt; //  when the application's main window is not a dialog&lt;br /&gt; SetIcon(m_hIcon, TRUE);   // Set big icon&lt;br /&gt; SetIcon(m_hIcon, FALSE);  // Set small icon&lt;br /&gt; &lt;br /&gt; // TODO: Add extra initialization here&lt;br /&gt;&lt;br /&gt; memset(m_psp, 0, sizeof(m_psp));&lt;br /&gt;    memset(&amp;m_PropSheet, 0, sizeof(m_PropSheet));&lt;br /&gt;&lt;br /&gt;    m_psp[0].dwSize = sizeof(PROPSHEETPAGE);&lt;br /&gt;    m_psp[0].dwFlags = PSP_DEFAULT|PSP_USETITLE;&lt;br /&gt;    //m_psp[0].hInstance = NULL;&lt;br /&gt;    m_psp[0].pszTemplate = (LPCSTR)IDD_PAGE1;&lt;br /&gt;    m_psp[0].pszTitle = "Page 1";&lt;br /&gt;    m_psp[0].pfnDlgProc = (DLGPROC)Page1DlgProc;&lt;br /&gt;    //m_psp[0].pfnCallback = (LPFNPSPCALLBACK) Page1Proc;&lt;br /&gt;&lt;br /&gt;    m_psp[1].dwSize = sizeof(PROPSHEETPAGE);&lt;br /&gt;    m_psp[1].dwFlags = PSP_USETITLE;&lt;br /&gt;    //m_psp[1].dwFlags = PSP_USETITLE | PSP_USECALLBACK;&lt;br /&gt;    //m_psp[1].dwFlags = PSP_USECALLBACK;&lt;br /&gt;    //m_psp[1].hInstance = hInstance;&lt;br /&gt;    m_psp[1].pszTemplate = (LPCSTR)IDD_PAGE2;&lt;br /&gt;    m_psp[1].pszTitle = "Page 2";&lt;br /&gt;    m_psp[1].pfnDlgProc = (DLGPROC)Page2DlgProc;&lt;br /&gt;    //m_psp[1].pfnCallback = (LPFNPSPCALLBACK) Page2Proc;&lt;br /&gt;&lt;br /&gt;    m_PropSheet.dwSize = sizeof(PROPSHEETHEADER);&lt;br /&gt;    m_PropSheet.dwFlags = PSH_PROPSHEETPAGE | PSH_USECALLBACK;&lt;br /&gt;    //m_PropSheet.dwFlags = PSH_PROPSHEETPAGE | PSH_USECALLBACK | PSH_MODELESS;&lt;br /&gt;//    m_PropSheet.hInstance = hInstance;&lt;br /&gt;    m_PropSheet.pszCaption = (LPSTR) "Property Sheet";&lt;br /&gt;    m_PropSheet.nPages = 2;&lt;br /&gt;    m_PropSheet.nStartPage = 0;&lt;br /&gt;    m_PropSheet.ppsp = (LPCPROPSHEETPAGE)m_psp;&lt;br /&gt;    m_PropSheet.pfnCallback = (PFNPROPSHEETCALLBACK) SheetProc;&lt;br /&gt;    &lt;br /&gt; return TRUE;  // return TRUE  unless you set the focus to a control&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void CPropSheetDlg::OnSysCommand(UINT nID, LPARAM lParam)&lt;br /&gt;{&lt;br /&gt; if ((nID &amp; 0xFFF0) == IDM_ABOUTBOX)&lt;br /&gt; {&lt;br /&gt;  CAboutDlg dlgAbout;&lt;br /&gt;  dlgAbout.DoModal();&lt;br /&gt; }&lt;br /&gt; else&lt;br /&gt; {&lt;br /&gt;  CDialog::OnSysCommand(nID, lParam);&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// If you add a minimize button to your dialog, you will need the code below&lt;br /&gt;//  to draw the icon.  For MFC applications using the document/view model,&lt;br /&gt;//  this is automatically done for you by the framework.&lt;br /&gt;&lt;br /&gt;void CPropSheetDlg::OnPaint() &lt;br /&gt;{&lt;br /&gt; if (IsIconic())&lt;br /&gt; {&lt;br /&gt;  CPaintDC dc(this); // device context for painting&lt;br /&gt;&lt;br /&gt;  SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);&lt;br /&gt;&lt;br /&gt;  // Center icon in client rectangle&lt;br /&gt;  int cxIcon = GetSystemMetrics(SM_CXICON);&lt;br /&gt;  int cyIcon = GetSystemMetrics(SM_CYICON);&lt;br /&gt;  CRect rect;&lt;br /&gt;  GetClientRect(&amp;rect);&lt;br /&gt;  int x = (rect.Width() - cxIcon + 1) / 2;&lt;br /&gt;  int y = (rect.Height() - cyIcon + 1) / 2;&lt;br /&gt;&lt;br /&gt;  // Draw the icon&lt;br /&gt;  dc.DrawIcon(x, y, m_hIcon);&lt;br /&gt; }&lt;br /&gt; else&lt;br /&gt; {&lt;br /&gt;  CDialog::OnPaint();&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// The system calls this to obtain the cursor to display while the user drags&lt;br /&gt;//  the minimized window.&lt;br /&gt;HCURSOR CPropSheetDlg::OnQueryDragIcon()&lt;br /&gt;{&lt;br /&gt; return (HCURSOR) m_hIcon;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;LRESULT CALLBACK SheetProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)&lt;br /&gt;{&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; // set a bold font to the tabs&lt;br /&gt; m_lfont.lfHeight         = 8;&lt;br /&gt; m_lfont.lfWeight         = FW_NORMAL;&lt;br /&gt; m_lfont.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;&lt;br /&gt; strcpy(m_lfont.lfFaceName, _T("Arial"));&lt;br /&gt; HWND hTabCtrl = PropSheet_GetTabControl(hDlg);&lt;br /&gt; SendMessage(hTabCtrl, WM_SETFONT, (WPARAM)&amp;m_lfont, 0);&lt;br /&gt; switch( message )&lt;br /&gt; {&lt;br /&gt;  case WM_INITDIALOG:&lt;br /&gt;   return TRUE;&lt;br /&gt; }&lt;br /&gt;    return FALSE;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// Dialog proc for page 1&lt;br /&gt;LRESULT CALLBACK Page1DlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt; switch (message)&lt;br /&gt; {&lt;br /&gt;  /*case WM_INITDIALOG:&lt;br /&gt;   {&lt;br /&gt;    //SetWindowText(GetDlgItem(hDlg, IDC_EDITX), "A * cos(u) * cos(v)");&lt;br /&gt;    //SetWindowText(GetDlgItem(hDlg, IDC_EDITY), "A * sin(u) * cos(v)");&lt;br /&gt;   // SetWindowText(GetDlgItem(hDlg, IDC_EDITZ), "A * sin(v)");&lt;br /&gt;    return TRUE;&lt;br /&gt;   }&lt;br /&gt;  case WM_COMMAND:&lt;br /&gt;   //if the textboxes are changed&lt;br /&gt;   if (HIWORD(wParam) == EN_CHANGE) {&lt;br /&gt;    SendMessage(GetParent(hDlg), PSM_CHANGED, (WPARAM)hDlg, 0);&lt;br /&gt;   }&lt;br /&gt;   break;&lt;br /&gt;  case WM_NOTIFY:&lt;br /&gt;   switch (((NMHDR FAR *) lParam)-&gt;code) {&lt;br /&gt;   case PSN_APPLY:&lt;br /&gt;    //user clicked APPLY&lt;br /&gt;    MessageBox(hDlg, "Apply", "Page1", 0);&lt;br /&gt;    break;&lt;br /&gt;   case PSN_KILLACTIVE: &lt;br /&gt;    //user clicked OK or selected another page&lt;br /&gt;    MessageBox(hDlg, "OK", "Page1", 0);&lt;br /&gt;    break;    &lt;br /&gt;   }*/&lt;br /&gt; }&lt;br /&gt;    return FALSE;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;LRESULT CALLBACK Page2DlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)&lt;br /&gt;{&lt;br /&gt; switch (message)&lt;br /&gt; {&lt;br /&gt;  /*case WM_INITDIALOG:&lt;br /&gt;   return TRUE;&lt;br /&gt;  case WM_NOTIFY:&lt;br /&gt;  // switch (((NMHDR FAR *) lParam)-&gt;code) {&lt;br /&gt;   //case PSN_APPLY:&lt;br /&gt;    //user clicked APPLY&lt;br /&gt;   // MessageBox(hDlg, "Apply", "Page2", 0);&lt;br /&gt;   //break;&lt;br /&gt;   case PSN_KILLACTIVE: &lt;br /&gt;    //user clicked OK or selected another page&lt;br /&gt;   // MessageBox(hDlg, "OK", "Page2", 0);&lt;br /&gt;   // break;    &lt;br /&gt;   }*/&lt;br /&gt; }&lt;br /&gt;    return FALSE;&lt;br /&gt;&lt;br /&gt;}// Page2DlgProc(HWND, UINT WPARAM, LPARAM)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;void CPropSheetDlg::OnProp() &lt;br /&gt;{&lt;br /&gt; // TODO: Add your control notification handler code here&lt;br /&gt; m_PropSheet.hwndParent = CPropSheetDlg::m_hWnd;&lt;br /&gt; PropertySheet(&amp;m_PropSheet);&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17070175-114439048018185057?l=technicalphilosopher-technical.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://technicalphilosopher-technical.blogspot.com/feeds/114439048018185057/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17070175&amp;postID=114439048018185057' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17070175/posts/default/114439048018185057'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17070175/posts/default/114439048018185057'/><link rel='alternate' type='text/html' href='http://technicalphilosopher-technical.blogspot.com/2006/04/creating-tabbed-property-sheet-with-2.html' title='Creating a Tabbed Property Sheet with 2 embedded Property pages:'/><author><name>Karthik Sankar</name><uri>http://www.blogger.com/profile/00995549408334380645</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/_caWjb-3XGho/TRgX_-A70kI/AAAAAAAADEQ/5IxUqLJHnmM/S220/Photo%2B33.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17070175.post-114239476217625999</id><published>2006-03-14T19:43:00.000-08:00</published><updated>2006-03-14T19:52:42.186-08:00</updated><title type='text'>My Own Edit Box(VC++)</title><content type='html'>We will see here how to create an Edit Box which say disallows CUT+COPY+PASTE&lt;br /&gt;&lt;br /&gt;The normal class CEdit does not have API corresponding to this so this essentially requires subclassing&lt;br /&gt;&lt;br /&gt;Say we have a Dialog CNoCutCopyPasteDialog&lt;br /&gt;&lt;br /&gt;and we have a control IDC_EDIT1 which is an EDIT BOX....&lt;br /&gt;&lt;br /&gt;We will have to route all messages coming to the IDC_EDIT1 control to our own class so that we can trap them in the way we want.&lt;br /&gt;&lt;br /&gt;This is simple enough.&lt;br /&gt;In DO Data Exchange of the CNoCutCopyPasteDialog&lt;br /&gt;add&lt;br /&gt;DDX_Control(pDX, IDC_EDIT1, m_Edit1);&lt;br /&gt;&lt;br /&gt;What this effectively does is routes all messages coming to IDC_EDIT1 to the object m_Edit1.&lt;br /&gt;&lt;br /&gt;Create a new class CMyEdit derived from CEdit&lt;br /&gt;Declare CMyEdit m_Edit1 in the CNoCutCopyPasteDialog&lt;br /&gt;&lt;br /&gt;In the CMyEdit class add the message handler&lt;br /&gt;&lt;br /&gt;LRESULT CMyEdit::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) &lt;br /&gt;{&lt;br /&gt; // TODO: Add your specialized code here and/or call the base class&lt;br /&gt; &lt;br /&gt; if((WM_PASTE==message)||&lt;br /&gt;            (WM_COPY==message)||&lt;br /&gt;            (WM_COPY==message))&lt;br /&gt; {&lt;br /&gt;        MessageBox("U cannot paste here",NULL,MB_OK);&lt;br /&gt;  return 0L;&lt;br /&gt; }&lt;br /&gt; else&lt;br /&gt; {&lt;br /&gt;  return CEdit::WindowProc(message,wParam,lParam);&lt;br /&gt; }&lt;br /&gt;        &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;This means that all Edit box messages are routed to CMyEdit class and CUT,COPY,PASTE messages are handled all other messages are returned to the parent CEdit class&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17070175-114239476217625999?l=technicalphilosopher-technical.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://technicalphilosopher-technical.blogspot.com/feeds/114239476217625999/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17070175&amp;postID=114239476217625999' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17070175/posts/default/114239476217625999'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17070175/posts/default/114239476217625999'/><link rel='alternate' type='text/html' href='http://technicalphilosopher-technical.blogspot.com/2006/03/my-own-edit-boxvc.html' title='My Own Edit Box(VC++)'/><author><name>Karthik Sankar</name><uri>http://www.blogger.com/profile/00995549408334380645</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/_caWjb-3XGho/TRgX_-A70kI/AAAAAAAADEQ/5IxUqLJHnmM/S220/Photo%2B33.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17070175.post-113360399099609568</id><published>2005-12-03T01:53:00.000-08:00</published><updated>2005-12-03T01:59:51.006-08:00</updated><title type='text'>"Pointers" to ponder</title><content type='html'>I think the word "pointer" is big in the heads of all softies...yep.But I guess there is an easy way to understand them...trick is to think them as mere numbers.&lt;br /&gt;So if that unique number is getting changed unnecessarily...we get a crash....similarly if that number is garbage we get a crash.&lt;br /&gt;&lt;br /&gt;ex.CPointerExample *cpe;&lt;br /&gt;   cpe-&gt;method();//crash cpe is not yet a number i.e no value assigned&lt;br /&gt;most cross referencing crashes can be avoided if we think of a pointer as numbers being passed around so if that number is being changed then there is a  crash....&lt;br /&gt;&lt;br /&gt;example:&lt;br /&gt;&lt;br /&gt;Module 1:&lt;br /&gt;CPointerExample *cpe;&lt;br /&gt;cpe=new CPointerExample();&lt;br /&gt;cpe-&gt;SomeUniqueMethod();&lt;br /&gt;&lt;br /&gt;Module....n&lt;br /&gt;has to use cpe of Module1&lt;br /&gt;&lt;br /&gt;but here does CPointerExample *cpe=new CPointerExample();&lt;br /&gt;cpe-&gt;SomeUniqueMethod();&lt;br /&gt;&lt;br /&gt;we have a crash because cpe has changed....&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17070175-113360399099609568?l=technicalphilosopher-technical.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://technicalphilosopher-technical.blogspot.com/feeds/113360399099609568/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17070175&amp;postID=113360399099609568' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17070175/posts/default/113360399099609568'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17070175/posts/default/113360399099609568'/><link rel='alternate' type='text/html' href='http://technicalphilosopher-technical.blogspot.com/2005/12/pointers-to-ponder.html' title='&quot;Pointers&quot; to ponder'/><author><name>Karthik Sankar</name><uri>http://www.blogger.com/profile/00995549408334380645</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/_caWjb-3XGho/TRgX_-A70kI/AAAAAAAADEQ/5IxUqLJHnmM/S220/Photo%2B33.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17070175.post-112755507063072068</id><published>2005-09-24T02:28:00.000-07:00</published><updated>2005-09-24T02:44:30.633-07:00</updated><title type='text'>Importing dll's into vc++(error LNK2001 Undefined External Symbol)</title><content type='html'>The best part of this problem is I did not know the error LNK2001 Undefined externals was problem with importing Dll's.So this title is a special one.&lt;br /&gt;Yes Identifying the problem solves most of the problem thaks to Google!!!&lt;br /&gt;Thanks to the post&lt;br /&gt;http://www.codeproject.com/dll/XDllPt1.asp&lt;br /&gt;&lt;br /&gt;I got this linkage error LNK2001 when I was trying to link a library to be used in my code.Most of it were API calls to that library.I tried to include in &lt;br /&gt;Tools-&gt;Options-&gt;Directories&lt;br /&gt;and had included all necessary libs,includes and executables...but it was still &lt;br /&gt;Om 'Bug'aaya namaha&lt;br /&gt;&lt;br /&gt;I was sitting on this problem and well out of the blue the word Dll crept into me...how &lt;br /&gt;no idea....God must have sympathised.So just searched for importing dlls into vc++&lt;br /&gt;and Bingo I came across this post.&lt;br /&gt;&lt;br /&gt;So if u want to link Dll's do following&lt;br /&gt;&lt;br /&gt;i)Make sure all includes are correct i.e &lt;br /&gt;   Go to Tools-&gt;Options-&gt;Directories&lt;br /&gt;      Under Include Files give include path..something like e:\MyDir\Include      Under Library Files give include path..something like e:\MyDir\bin&lt;br /&gt;      Under Executables give include path..something like e:\MyDir\bin&lt;br /&gt;ii)Go to Project-&gt;Settings-&gt;Link&lt;br /&gt;       Under Object/Library Modules&lt;br /&gt;       Enter path of the library like e:\MyDir\bin\My_lib.lib &lt;br /&gt;iii)Go to Project-&gt;Settings-&gt;c/c++&lt;br /&gt;       Category:Preprocessor&lt;br /&gt;       Under Additonal Include Directories give path of directory e:\Mydir\bin&lt;br /&gt;       where ur Dll,Lib etc are dumped&lt;br /&gt;iv)Copy the .dll file into the Debug folder of ur project&lt;br /&gt;&lt;br /&gt;Rebuild All and yep it works&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17070175-112755507063072068?l=technicalphilosopher-technical.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://technicalphilosopher-technical.blogspot.com/feeds/112755507063072068/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17070175&amp;postID=112755507063072068' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17070175/posts/default/112755507063072068'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17070175/posts/default/112755507063072068'/><link rel='alternate' type='text/html' href='http://technicalphilosopher-technical.blogspot.com/2005/09/importing-dlls-into-vcerror-lnk2001.html' title='Importing dll&apos;s into vc++(error LNK2001 Undefined External Symbol)'/><author><name>Karthik Sankar</name><uri>http://www.blogger.com/profile/00995549408334380645</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/_caWjb-3XGho/TRgX_-A70kI/AAAAAAAADEQ/5IxUqLJHnmM/S220/Photo%2B33.jpg'/></author><thr:total>0</thr:total></entry></feed>
