Monday, June 26, 2006

MFC List Box

Inserting a list element at the end and wanted the list to show the item just put in. But it would not in its default behavior.

I could not find how to do this searching on the net. Had to dig through existing code. Even than what I tried did not work. The problem was with using LPSTR_TEXTCALLBACK and than trying to calling the EnsureVisible function. These things are mutually exclusive.

I had to send a message so that the function was called after the text callback functions had finished what they were doing.

Tuesday, June 20, 2006

Solution To Problem

The cpp related code must be in the same location as the .h code so that the including application can see everything it needs to see. Makes sense.

Nasty Linker Error

Ok, everything compiles but when I go to use I get this linker error

------ Build started: Project: MLVDialogs, Configuration: Debug Win32 ------

Compiling...
MLVDlg.cpp
Linking...
Creating library Debug/MLVDialogs.lib and object Debug/MLVDialogs.exp
MLVDlg.obj : error LNK2019: unresolved external symbol "public: __thiscall ClFIFO::ClFIFO(void)" (??0?$ClFIFO@USuProtoMsg@@@@QAE@XZ) referenced in function "public: __thiscall ClMLVDlg::ClMLVDlg(class ClMLVDlg * &,class CWnd *)" (??0ClMLVDlg@@QAE@AAPAV0@PAVCWnd@@@Z)
MLVDlg.obj : error LNK2019: unresolved external symbol "public: __thiscall ClFIFO::~ClFIFO(void)" (??1?$ClFIFO@USuProtoMsg@@@@QAE@XZ) referenced in function "public: virtual __thiscall ClMLVDlg::~ClMLVDlg(void)" (??1ClMLVDlg@@UAE@XZ)
Debug/MLVDialogs.dll : fatal error LNK1120: 2 unresolved externals

Build log was saved at "file://h:\Sandbox\Elsys\Products\Common_Software\CSCIs\MLVDialogs\Software\Debug\BuildLog.htm"
MLVDialogs - 3 error(s), 0 warning(s)


---------------------- Done ----------------------

Build: 0 succeeded, 1 failed, 0 skipped

Class Template

This is much easier than I thought.

template \ class class-name
{
// class Ttype can be anything
// class-name will be template class created
}

But the function definition is ugly.

template \ void className\::functionName(data_t ob)
{
}

Meta Functions


The following talks about 'Meta Functions'.

boost-consulting.com/mplbook/metafunctions.html

This is describe as "a long last delivering practical metaprogramming tools and techniques into the hands of the everyday programmer".

Templates and Generics

Found this here: www.comeaucomputing.com

This is not really too good.

temples are used to create 'generic' things like function or class.

generic function

template ret-type func-name(parameter list)
{
// body of function
}

generic class

template class class-name
{
}

Unions


I found this site look for information on unions under C++.

www.cplusplus.com

And this is some sample code for a union from the site.


union union_name
{
member_type1 member_name1;
member_type2 member_name2;
member_type3 member_name3;
.
.
} object_names;

Learning About C++

This is a blog about learning C++. I am trying to capture what I learn and what resources I use in learning.