|
I'm surprised no-one answered this already - I had to wait to get home and look at code where I did it.
I'm using SetItemText to put them in, but GetItemText takes them back out the same way:
// Create list view columns
LV_COLUMN listColumn;
LV_ITEM listItem;
char* arColumns[2] = { "Account", "Password"};
listColumn.mask = LVCF_FMT|LVCF_WIDTH|LVCF_TEXT|LVCF_SUBITEM;
listColumn.fmt = LVCFMT_LEFT;
int Width[2]={190,63};
listColumn.cx = 180;
for ( int nColumn = 0;nColumn<2;nColumn++)
{
listColumn.cx = Width[nColumn];
listColumn.iSubItem = nColumn;
listColumn.pszText = arColumns[nColumn];
m_listCtrl.InsertColumn(nColumn,&listColumn);
}
// Add list items
listItem.mask = LVIF_TEXT | LVIF_IMAGE;
listItem.iSubItem = 0;
TCWACCOUNT* pCurrent;
pCurrent = m_TCWACCOUNT.pNext;
int nItem = 0;
while(pCurrent != NULL)
{
listItem.iItem = nItem;
listItem.pszText = pCurrent->pCustName;
CString Check = (CString)pCurrent->pPasswd;
if (Check.Left(4) == "NuLl")
{
listItem.iImage = 1;
m_listCtrl.InsertItem (&listItem);
m_listCtrl.SetItemText (nItem, 1, "No");
}
else
{
listItem.iImage = 0;
m_listCtrl.InsertItem (&listItem);
m_listCtrl.SetItemText (nItem, 1, "Yes");
}
pCurrent = pCurrent->pNext;
nItem++;
}
Ignore all the account stuff, it's just stepping through a linked list. The important part is that the item is the row, the sub item is the column. GetItemText looks like this in the MSDN:
int GetItemText( int nItem, int nSubItem, LPTSTR lpszText, int nLen ) const;
CString GetItemText( int nItem, int nSubItem ) const;
So you can do this
for (int i = 0; i < listsize; i++)
{
Column1[i] = m_List.GetItemText(i, 0);
Column2[i] = m_List.GetItemText(i, 1);
Column3[i] = m_List.GetItemText(i, 2);
}
Of course, you'd be better putting them in a struct ( or class ) but that is another story....
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
lets say I got a listctrl with items from A-Z
and i want to walk up/down left/right the lista with more then the arrow keys
like 'A' and 'D' (left/right). but the problem is that as soon as a press 'D' the selections
jumps to the items that begin with 'D' and with 'A' i get to the item starting with A,
this is often a very good thing.. but I dont want it..
i Tried to catch the message in the OnKeyDown and there move the selection up/down but the
autoselection feature is activated later on.. how do i disable / override it ??
Mathias S.
mathias@isalive.com
|
|
|
|
|
Hi
In the developer edition of Office 2000 its says it includes the "Royalty free runtime distribution libraries for Access2000". If I use a Access database in my app. does this mean I need these libraries to run the software on applications that don't have Access2000? If not, what is it?
Thanks
|
|
|
|
|
Yes,
Most (if not all) MS Windows versions do not support DAO out of the box and you need to install the drivers when you plan to use Access databases in your application.
Peter
|
|
|
|
|
Thanks for the reply Peter. Unfortunately I'm still not quite clear on this:
1/ Does this mean I *do* have to pay royalties if I don't buy the Developer Office 2000?
2/ I would have thought just installing the right drivers (MDAC?) was good enough? I don't need the user to be able to open the database (its all just through ADO and the Jet 4.0 engine).
Thanks
|
|
|
|
|
No you do not have to pay royalties, but you have to include the DAO redistribution disks together with your application's install.
|
|
|
|
|
|
Dear all,
Does anyone know whether a MFC program can get the URL at the activating
Internet Explorer or not? If yes, how can I get the URL?
Thanks a lot!
Vickie
|
|
|
|
|
http://codeguru.earthweb.com/ieprogram/enumIE.html
good luck,
Dror
|
|
|
|
|
I have a dialog based app and when I call ShowWindow(SW_HIDE) it hides the window and removes the taskbar button. I need a way to keep the taskbar button there even though the window is hidden.
Any ideas?
Thanks
Peter Papanikolaou
|
|
|
|
|
instead of hiding the window, remember it's position and move it offscreen.
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
The problem with your solution is, what if a user has multiple monitors?
You might be moving the window right onto another screen, not exactly what you had in mind.
|
|
|
|
|
I have two monitors myself, it is possible to enumerate them and thus make sure you move the window outside their bounds. But I admit your suggestion of minimising is more obvious, more elegant and generally less of a hassle.
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
Why don't you just minimize it instead?
|
|
|
|
|
minimize only
or
what about taskbar-tray icon?
|
|
|
|
|
I have a dialog based app and when I call ShowWindow(SW_HIDE) it hides the window and removes the taskbar button. I need a way to keep the taskbar button there even though the window is hidden.
Any ideas?
Thanks
Peter Papanikolaou
|
|
|
|
|
With CRecordSet and Memo AssertionFailed when
CString > 255 characters and < 65535 characters into Memo
The memo type get max 65535 characters in Access.
Why??
|
|
|
|
|
There's a new feature in VC6 that adds a length param to RFX_Text - it defaults to 255. Class wizard doesn't know about it.
You might try revising the DoFieldExchange code to add this fourth parameter:
pFX->SetFieldType(CFieldExchange::outputColumn);
RFX_Long(pFX, _T("[ID]"), m_ID);
RFX_Text(pFX, _T("[Name]"), m_Name);
RFX_Text(pFX, _T("[Notes]"), m_Notes, 32768);
|
|
|
|
|
Hello all,
I've written a dialog based application that uses several bitmap images on them. I wrote the application with a high resolution (1280 x 1024). Now I'm testing the application on machines with lower resolutions and all of the bitmap pictures don't correctly line up with the components on the form! Shouldn't the images increase/decrease with changes in the screen resolution at the same rate as other form components? It makes the form look really unprofessional, so I would like to figure out a fix for this. Thanks in advance!
--Tale
|
|
|
|
|
No, bitmaps do not automatically scale. How are you placing them ? In your OnPaint, or in a bitmap holder static ? Either way, it would appear you need to write some code to size them according to the size of the other objects on your dialog.
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
I'm placing them using a static control. Can you explain the best way to resize the bitmaps? What method do I adjust the bitmaps in?
--Tale
|
|
|
|
|
Hello, can anyone help a beginner in c++? I want to create a database using DAO, accessing data from Microsoft Access. I'm using visual 6, and Microsoft Access 2000. I've done the tutorials using stdreg32.mdb but obviously I want my own data, fields, tables etc. But everytime I create a new database saved as .mdb and I try to create my own exe using the appwizard it just won't accept it, I've tried registering it, I tried the stdreg.exe program. I just keep on running up against walls. Can anyone help me. Please.
Crusty
|
|
|
|
|
Crusty,
I think you will have much less headaches when you do not create a 'bound' MFC application, app created with app wizard that connects to a DAO database.
You will be better off creating and handling your own CDAODAtabase, CDAORecorset, CDAO..., objects. This way you have control what you want to connect to and what to use at run time. Also the CDAODatabase object contains abilities to create a Access database.
Peter
|
|
|
|
|
First, I'm sorry for my English.
Now, I have really big problem for me!
I have two kind of source.
First one is coded with C(which one uses singlethread), and second one is coded with C++( MFC )--(which one uses Multithread).
What I did to make one application, I just open new project with Visual C++, and making a dialog box, some buttons, and just include C codes.
And, I had many Errors! So, I added some statement to use C code in MFC ( extern "C" ... )
But, and then I had real problem.
That is different kind thread can not be use for one application......
So, this is my problem.
How can I solve this problem?
Or, is there any way to make one application with two kind of codes?
please answer me..
|
|
|
|
|
Every C statement in existance is valid C++, so I'd suggest this was not the problem. You should probably put up some code or an example of the sort of errors you are having, it's impossible to give specififc advice without specific problems to solve.
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|