|
Mmm this is a difficult one...
|
|
|
|
|
The book The MFC Answer Book by Eugene Kain has simple instructions for adding a property sheet to a dialog (and then the dialog could hold other controls that are outside of the property sheet, one of your other points). The book VC++ MFC Extensions by Example by John Swanke has simple instructions for putting a menu in a dialog. I have found both of these books, as well as Swanke's Visual C++ MFC Programming by Example extremely helpful over the years. They contain many, many practical helpful things that you wish you knew how to do, on a wide variety of MFC subjects.
I'm sure that you could find instructions on the internet for these also with a little searching
|
|
|
|
|
i'm trying to get a IHTMLWindow2 object to use it's Scroll method. It's realy weird but it doesn't work. Here is the code i used.
m_pWebBrowser is IWebBrowser2* and has been corectly initialized...as in i can use it to control the IE window (Navigate...parse the source...).
[CODE]
HRESULT hr;
IDispatch* pHtmlDocDispatch = NULL;
IHTMLDocument2 * pHtmlDoc = NULL;
IHTMLWindow2 * p = NULL;
hr = m_pWebBrowser->get_Document (&pHtmlDocDispatch);
if (SUCCEEDED (hr) && (pHtmlDocDispatch != NULL))
{
hr = pHtmlDocDispatch->QueryInterface (IID_IHTMLDocument2, (LPVOID *) &pHtmlDoc);
if (SUCCEEDED (hr) && (pHtmlDoc != NULL))
{
pHtmlDoc->get_parentWindow(&p);
// this is were i get the error. p remains null
if(SUCCEEDED(hr) && p)
p->scrollTo(x,y);
}
}
[/CODE]
I realy hope some1 can help or at least give me an alternative way to scroll the IE window..other then sending keys.
|
|
|
|
|
|
// MessageId: E_NOINTERFACE
//
// MessageText:
//
// No such interface supported
//
#define E_NOINTERFACE _HRESULT_TYPEDEF_(0x80004002L)
thats the HRESULT returned. Any idee what it means?
|
|
|
|
|
Does anyone have any idea how I can load the images in a CImageList dynamically as the user scroll the list?
I need to do this becuase if the list contains many images (e.g privewing thumbnails of a dircetory with a lot of pictures in it) It consumes a lot of memory.
An example for such image thumbnail previewing can be found at:
http://www.codeproject.com/vcpp/gdiplus/GdiPThumbnailsViewer.asp[^]
|
|
|
|
|
IN MFC...
Plz guide me how can i apply a bmp on Tab control on all tabs including the upper tab label. Current application has bitmapped dialog box which is used in each tab but the label of tabs should also be bitmapped.
|
|
|
|
|
You have 2 options
1) You have to set the WS_OWNERDRAW style.
Check the MSDN library docs for ownerdrawn controls.
This allow you to draw the labels but not the empty space
where there are no labels.
So this option may not suit you at all.
2) If you want to customize the entire area of the tab, including borders,
you have to subclass the tab control and handle WM_PAINT yourself.
I strongly recommend this article that explains how to do this: http://www.codeproject.com/tabctrl/customtab.asp
|
|
|
|
|
I have a CListCtrl with 3 columns
I am using this function to know when someone clicks on the column button
void OnColumnclickList2(NMHDR* pNMHDR, LRESULT* pResult)
the problem is it is sorting the list according to the first column no matter what column button i press what sshould i do to make it sort according to the column button i press?
In other word how can i know which column button has been pressed?
/\|-||\/|/\|)
|
|
|
|
|
Take a look at CListCtrl::SortItems[^]
If you pass both the list control pointer and a column index in some struct as the dwData parameter to SortItems, your compare function can obtain the text for the appropriate column and use it for the comparison.
struct SORT_DATA
{
CListCtrl* pList;
int nColumn;
}
static int CALLBACK
MyCompareProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{
SORT_DATA* pData = (SORT_DATA*) lParamSort;
CListCtrl* pListCtrl = pData->pList;
int nColumn = pData->nColumn
CString strItem1 = pListCtrl->GetItemText(lParam1, nColumn);
CString strItem2 = pListCtrl->GetItemText(lParam2, nColumn);
return strcmp(strItem1, strItem2);
}
void CListCtrl_SortItems(CListCtrl* pList, int nColumn)
{
SORT_DATA data = {pList, nColumn};
pList->SortItems(&MyCompareProc, (LPARAM) &data);
}
You could easily extend this to allow for sorting order (ascending/descending), sort on multiple columns, etc.
Hope that helps,
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
refer to this link to know why this sortitem() doesn't work anyway
/\|-||\/|/\|)
|
|
|
|
|
Halawlaws wrote:
refer to this link to know why this sortitem() doesn't work anyway
Hmm.. yep. You are right. But it's easy to fix, isn't it? You just need to set lParamData (while inserting items) with a pointer to the object from which you obtained the strings, and modify the compare function accordingly.
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
ok i ll try that thx
/\|-||\/|/\|)
|
|
|
|
|
The way I've handled this in the past was something like:
BEGIN_MESSAGE_MAP(CMyView, CListView)
ON_NOTIFY(HDN_ITEMCLICK, 0, OnItemclick)
END_MESSAGE_MAP()
int CALLBACK CMyView::CompareFunc( LPARAM lParam1, LPARAM lParam2, LPARAM )
{
int nReturn = 0;
CInfo *pInfo1,
*pInfo2,
*pTemp;
pInfo1 = (CInfo *) lParam1;
pInfo2 = (CInfo *) lParam2;
if (true == m_bAscending)
{
pTemp = pInfo1;
pInfo1 = pInfo2;
pInfo2 = pTemp;
}
switch (m_nSortColumn)
{
case 0:
nReturn = pInfo1->m_strName.Compare(pInfo2->m_strName);
break;
case 1:
nReturn = pInfo1->m_lUSANumber - pInfo2->m_lUSANumber;
break;
case 2:
if (pInfo1->m_timeBirthdate < pInfo2->m_timeBirthdate)
nReturn = -1;
else
nReturn = 1;
break;
}
return (nReturn);
}
void CMyView::OnItemclick(NMHDR* pNMHDR, LRESULT* pResult)
{
HD_NOTIFY *phdn = (HD_NOTIFY *) pNMHDR;
CListCtrl &ctrlList = GetListCtrl();
m_bAscending = ! m_bAscending;
m_nSortColumn = phdn->iItem;
ctrlList.SortItems(CompareFunc, 0);
*pResult = 0;
}
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
|
when I create the edit as a child window????
But it blinks when it's created through a
dialog resource.
I have used spy to view the window style of my edit inside a normal
window, and the edit control inside a dialog box. Both styles are
exactly the same.
Why doesn't the caret blink?
Thank you for any help
|
|
|
|
|
I found out the problem. I was doing something wrong in my code. Too much detail to explain here.
|
|
|
|
|
Hi. I am using a listview in a win32 api application...
I want to set the text of the listview item.
I do this:
//
LvItem.pszText= (LPSTR)_bstr_t(RsITEM(pSet,"FILE_NAME"));
//
it displays some junk characters... The listview works normally and there isnt any problem with the database nor with the data collection (made with RsITEM(pSet,"FILE_NAME") ) ...
Thank you very much in advance for your answers...
Well... I am a beginner ...
|
|
|
|
|
You can't simply cast a BSTR to LPSTR because they are different formats.
Try using one of ATL conversion macros
LvItem.pszText = OLE2T(_bstr_t(RsITEM(pSet,"FILE_NAME")));
Or assign the BSTR to a CString, which will do the conversion for you
CString sAux = _bstr_t(RsITEM(pSet,"FILE_NAME"));
LvItem.pszText = sAux;
Hope that helps,
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Ok I used the second one and it worked! Thanks a lot!
Well... I am a beginner ...
|
|
|
|
|
can some1 help me to draw a pie chart using MSCHART control.I am unable to obtain sufficient info from the msdn docs.
|
|
|
|
|
Are you using API, MFC or net?
Well... I am a beginner ...
|
|
|
|
|
I'm also very confused with the poor information about using MS Chart in VC++ provided by msdn. Look at these examples, they'll help you:
Using the MS Chart control in VC++[^] and MS Chart[^]
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
thanx 4 the piece of info.but i happened to see that info earlier.i seem to have a serious problem in inderstanding the COleSafeArray .can u plz explain why we create an array DWORD numElements[] = {10, 10}; .is that a one dimensional array or something else.im totalled.plz mail me at
rajeshvv007@yahoo.com if u aint mind.
thanx 4 helpin.....
|
|
|
|
|
Taking the first example, COleSafeArray is the chart data and simplyfing it's:
<br />
COleSafeArray saRet;<br />
SAFEARRAYBOUND sab[2];
<br />
sab[0].cElements = NUM_DISCS;
sab[1].cElements = m_iCols;
sab[0].lLbound = sab[1].lLbound = 1;
<br />
saRet.Create(VT_BSTR, 2, sab);
m_msChart.SetChartData(saRet.Detach());
I hope it helps,
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|