|
Hey this is the situation now but it is not sorting when i click on the header column.
//Set up Record Status
Holder = pRecordSet->GetCollect("RecordStatus");
status = Holder.iVal;
m_RecordList->SetItemData(iNew,status);
// setup record status
lvI.mask=LVIF_IMAGE ;
lvI.iItem= iNew;
lvI.iSubItem=5;
if(status == eCIT_STATUS_COMPLETE)
lvI.iImage = 1;
else if(status == eCIT_STATUS_VOID)
lvI.iImage = 3;
else
lvI.iImage = 0;
m_RecordList->SetItem(&lvI);
Any Suggestion
Thanks
|
|
|
|
|
aman2006 wrote:
...it is not sorting when i click on the header column
And what does the handler code for that look like?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
David this the full code
while(!pRecordSet->EndOfFile)
{
// Insert the first item
lvI.mask = LVIF_TEXT| LVIF_PARAM | LVIF_STATE;
lvI.state = 0;
lvI.stateMask = 0;
lvI.iItem = counter;
lvI.iSubItem = 0;
Holder = pRecordSet->GetCollect("CitationID");
if(Holder.vt!=VT_NULL)
{
temp = (char*)_bstr_t(Holder);
lvI.pszText = (LPTSTR)(LPCTSTR)(temp);
}
else
lvI.pszText = _T("");
//lvI.pszText = _T("");
lvI.lParam = counter;
int iNew = m_RecordList->InsertItem(&lvI);
Holder = pRecordSet->GetCollect("CitationNo");
if(Holder.vt!=VT_NULL)
{
temp = (char*)_bstr_t(Holder);
lvI.pszText = (LPTSTR)(LPCTSTR)(temp);
}
else
lvI.pszText = _T("");
m_RecordList->SetItemText(iNew,1,temp);
//Citation date
Holder = pRecordSet->GetCollect("CitationDate");
if(Holder.vt!=VT_NULL)
{
temp = (char*)_bstr_t(Holder);
lvI.pszText = (LPTSTR)(LPCTSTR)(temp);
}
else
lvI.pszText = _T("");
m_RecordList->SetItemText(iNew,2,temp);
//Citation Time
Holder = pRecordSet->GetCollect("CitationTime");
if(Holder.vt!=VT_NULL)
{
temp = (char*)_bstr_t(Holder);
lvI.pszText = (LPTSTR)(LPCTSTR)(temp);
}
else
lvI.pszText = _T("");
m_RecordList->SetItemText(iNew,3,temp);
//Subject First Name
strFName.Empty();
Holder = pRecordSet->GetCollect("FirstName");
if(Holder.vt!=VT_NULL)
strFName = (char*)_bstr_t(Holder);
else
strFName = _T("");
//Subject Last Name
Holder = pRecordSet->GetCollect("LastName");
if(Holder.vt!=VT_NULL)
{
temp = (char*)_bstr_t(Holder);
// lvI.pszText = (LPTSTR)(LPCTSTR)(temp);
}
else
temp = _T("");
strFName += _T(" ") + temp;
lvI.pszText = (LPTSTR)(LPCTSTR)(strFName);
m_RecordList->SetItemText(iNew,4,strFName);
//Set up Record Status
Holder = pRecordSet->GetCollect("RecordStatus");
status = Holder.iVal;
m_RecordList->SetItemData(iNew,status);
// setup record status
lvI.mask=LVIF_IMAGE;
lvI.iItem= iNew;
lvI.iSubItem=5;
if(status == eCIT_STATUS_COMPLETE)
lvI.iImage = 1;
else if(status == eCIT_STATUS_VOID)
lvI.iImage = 3;
else
lvI.iImage = 0;
m_RecordList->SetItem(&lvI);
//Set up Sync Status
Holder = pRecordSet->GetCollect("IsSynchronized");
status = Holder.iVal;
temp.Format("%d",status);
m_RecordList->SetItemText(iNew,6,temp);
// setup record status
lvI.mask=LVIF_IMAGE;
lvI.iItem= iNew;
lvI.iSubItem=6;
if(status == eCIT_STATUS_SYNCED)
lvI.iImage = 2;
else
lvI.iImage = -1;
m_RecordList->SetItem(&lvI);
counter++;
pRecordSet->MoveNext();
}
Thanks
shailesh
|
|
|
|
|
This is the code that populates the list control. I wanted to see the code that handles the clicking of the column heading, and the sorting-compare routine.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Here u go:
typedef struct _tagSORTDATA
{
INT isortSubItem;
CListCtrl *m_pointer;
INT iUPDOWN;
BOOL StringComp;
} SORTDATA;
enum{
eSORT_UP = 1,
eSORT_DOWN
};
void CEditForm::OnColumnclickHistoryList(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
static WORD nSort;
SORTDATA sortData;
m_RecordList =(CListCtrl*)GetDlgItem(IDC_HISTORY_LIST);
if(nSort == eSORT_UP)
nSort = eSORT_DOWN;
else
nSort = eSORT_UP;
sortData.isortSubItem = pNMListView->iSubItem;
sortData.iUPDOWN = nSort;
sortData.m_pointer = (CListCtrl*)m_RecordList;
sortData.StringComp = TRUE;
if(m_RecordList->SortItems(ListViewCompProc, (DWORD)(LPARAM)&sortData) != TRUE)
AfxMessageBox(_T("Error"));
*pResult = 0;
}
int CALLBACK CEditForm::ListViewCompProc(LPARAM lp1, LPARAM lp2, LPARAM lp3)
{
static LVFINDINFO lvf;
static INT nItem1, nItem2;
CString buf1, buf2;
SORTDATA *lpsd;
lpsd = (SORTDATA *)lp3;
CListCtrl *m_RecordList = (CListCtrl*)lpsd->m_pointer;
lvf.flags = LVFI_PARAM;
lvf.lParam = lp1;
// nItem1 = ListView_FindItem(lpsd->hwndList, -1, &lvf);
nItem1 = m_RecordList->FindItem(&lvf);
lvf.lParam = lp2;
//nItem2 = ListView_FindItem(lpsd->hwndList, -1, &lvf);
nItem2 = m_RecordList->FindItem(&lvf);
//ListView_GetItemText(lpsd->hwndList, nItem1, lpsd->isortSubItem, buf1, sizeof(buf1));
buf1 = m_RecordList->GetItemText(nItem1,lpsd->isortSubItem);
//ListView_GetItemText(lpsd->hwndList, nItem2, lpsd->isortSubItem, buf2, sizeof(buf2));
buf2 = m_RecordList->GetItemText(nItem2,lpsd->isortSubItem);
if (lpsd->isortSubItem != 9)
{
// string comparision
if (lpsd->iUPDOWN == eSORT_UP)
{
return(buf1.Compare(buf2));
}
else
{
return(buf1.Compare(buf2) * -1);
}
}
else
{
// digit comparision
if (lpsd->iUPDOWN == eSORT_UP)
{
if (_ttoi(buf1) > _ttoi(buf2))
return 1;
else if (_ttoi(buf1) == _ttoi(buf2))
return 0;
else
return -1;
}
else
{
if (_ttoi(buf1) > _ttoi(buf2))
return -1;
else if (_ttoi(buf1) == _ttoi(buf2))
return 0;
else
return 1;
}
}
return 0;
}
|
|
|
|
|
In the ListViewCompProc() routine, don't call FindItem() or GetItemText() . Use the lp1 and lp2 parameters instead. See MSDN article Q250614.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Hi.
I am using ::CreateProcess(...) to start a new console process. When the process finishes the job, the console window closes, avoiding the user to see messages or process results.
Is there any way to keep the window opened after process end?
Thanks.
|
|
|
|
|
A hack might be to create a batch file that launches the process, and then has a PAUSE statement, so that it won't finish until the user presses a key.
Or, if you own the concole process, you could change its code to ask for a keypress before closing. (Perhaps make it a command-line parameter.)
There might be a way to keep the console window open until you, say, click its close button, look at the CreateProcess parameters and see if there is anything. But I don't know for sure.
Sometimes I feel like I'm a USB printer in a parallel universe.
|
|
|
|
|
I have created a MFC ActiveX control to interface with a finger print scanner. For that
i had to create a DLL (MFC Extension) which was used to interface between the MFC ActiveX
and the Win32 based API supplied by the scanner vendor. I had to do this since i wanted to
do some drawing on MFC created objects. I was forced to create the MFC Extension DLL coz
MFC pointers are only allowed to be passed across MFC Extension DLL's and not to ordinary
DLL's(that is what i know). The DLL that i created should also work as an interface between
any program who want to manipulate the scanner from different languages (like Java and Visual
Basic). I have two questions here
1) How can i create the DLL not as MFC Extension DLL but as ordinary DLL and still
access MFC pointers?
2) I am not able to load this DLL and call its functions in VB.
Any kind of help is appretiated.
Thank you in advance.
Jobby
|
|
|
|
|
Jobby Joseph wrote:
1) How can i create the DLL not as MFC Extension DLL but as ordinary DLL and still
access MFC pointers?
Use a window handle (HWND ), not a CWnd pointer.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
hi
how can i programatically click on a button in a HTML page?!
i am working on MFC Doc/View architecture support project with CHtmlView base of my CProjView class.
is that possible ?
thanx a lot
|
|
|
|
|
Ehsan-de-Burge wrote:
how can i programatically click on a button in a HTML page?!
Look at the Click method of the button object.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
no no i said in C++, the way your link expalins is in VBScript!
|
|
|
|
|
Capture the BeforeNavigate2 event and if the url is the same as the button url, do your thing.
"We have done so much in the last 2 years, and it doesn't happen by standing around with your finger in your ear, hoping everyone thinks that that's nice." - Donald Rumsfeld
|
|
|
|
|
When I create a CEdit dynamically, what is the style flag for a 3-d style border?
~Nitron.
ññòòïðïðB A start
|
|
|
|
|
WS_EX_CLIENTEDGE
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Hi,
I am trying to make a CComboBox behave like the Internet Explorer combo box, meaning:
- The list opens and closes automatically, depending on the string the user is typing in
- The String does not change when i'm browsing through the entries in the list box.
Is it possible to make a standard combobox behave like this (Styles?)? Do I need to write a user defined class?
greets,
Jason
|
|
|
|
|
|
jason99 wrote:
...like the Internet Explorer combo box
Which one?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Does anybody know where I can dig up an MFC CListCtrl (VC6) variant that supports pushbuttons in columns? I saw some stuff with combo boxes (and thought of starting there) but I was hoping that somebody already travelled this road. I don't need much more functionality than that so I was looking for something rather lightweight.
Thanks,
Paul
|
|
|
|
|
Hi,
I've created an SQL Server script via the Generate Script option under Server Explorer in Visual Studio .NET. Is there a way of executing the script from some C++ code?
I know I can run OSQL.exe or ISQL.exe, but I would prefer not doing a CreateProcess and running it that way. I was more curious whether there some SQL Server API functions I could call to execute the script.
Thanx.
|
|
|
|
|
You can use ADO or ODBC from C++ to communicate with an SQL Server.
You first make a connection to the desired SQL Server.
Then you can Execute 'statements' from your script.
Then you close the connection.
There are some examples on CodeProject under the Database section of using the ADO and ODBC for this.
|
|
|
|
|
OK i'll give it a go Blake. thanx buddy.
Come to think of it, they are just SQL statements. Don't know why I didn't think of that myself.
Thanx heaps.
|
|
|
|
|
Hi,
Is there any way that we can know which application(the name of the file) spawned another. I only have the caption on the spawned application.
Thanks in advance
Jobby
|
|
|
|
|