|
I Created a list view and modified the style with LVS_EX_CHECKBOXES, and the checkbox is created, but there is no image where the checkbox should be, only a blank space.
Here's part of the code:
<br />
<br />
CAPPRESULT CListViewCtrl::Create(HWND pHWndParentS_, int nWndID_, CWnd::SCWndConf* pConfDataS)<br />
{<br />
<br />
CAPPRESULT sRes;<br />
<br />
if(CAPP_FAILED(sRes = CCtrl::Create(pHWndParentS_, nWndID_, pConfDataS)))<br />
{<br />
<br />
return sRes;<br />
<br />
}
<br />
WNDCLASSEX WindowClassS;<br />
<br />
if(CWndMgr::GetInstance().InsertRegisteredClassName("CListViewCtrl", FALSE))<br />
{<br />
<br />
INITCOMMONCONTROLSEX InitCommCtrlS = {0};<br />
InitCommCtrlS.dwSize = sizeof(INITCOMMONCONTROLSEX);<br />
InitCommCtrlS.dwICC = ICC_TREEVIEW_CLASSES;<br />
InitCommonControlsEx(&InitCommCtrlS);<br />
<br />
}
<br />
DWORD ulStyle, ulExStyle;<br />
<br />
if(static_cast<CListViewCtrl::SCListViewCtrlConf*>(pConfDataS)->m_bEditLabel)<br />
{<br />
<br />
ulStyle = WS_TABSTOP | WS_CHILD | WS_VISIBLE | LVS_AUTOARRANGE | LVS_REPORT | LVS_OWNERDATA | LVS_EDITLABELS;<br />
<br />
}else<br />
{<br />
<br />
ulStyle = WS_TABSTOP | WS_CHILD | WS_VISIBLE | LVS_AUTOARRANGE | LVS_REPORT | LVS_OWNERDATA;<br />
<br />
}
<br />
HWND pHWndS;<br />
<br />
if(static_cast<CListViewCtrl::SCListViewCtrlConf*>(pConfDataS)->m_bNoBorder)<br />
{<br />
<br />
ulExStyle = NULL;<br />
<br />
}else<br />
{<br />
<br />
ulExStyle = WS_EX_CLIENTEDGE;<br />
<br />
}
<br />
if(CAPP_FAILED(sRes = this->CreateEx(ulExStyle, WC_LISTVIEW, "", ulStyle,<br />
0,0,0,0, pHWndParentS_, (HMENU) (int) nWndID_, NULL, &pHWndS)))<br />
{<br />
<br />
return sRes;<br />
<br />
}
<br />
<br />
this->m_unIconID = static_cast<CListViewCtrl::SCListViewCtrlConf*>(pConfDataS)->m_unIconID;<br />
<br />
if(CAPP_FAILED(sRes = (this->OnCreate(pHWndS, nWndID_))))<br />
{<br />
<br />
return sRes;<br />
<br />
}
<br />
return CAPP_ERR_NO_ERRORS;<br />
<br />
}
<br />
<br />
<br />
<br />
CAPPRESULT CListViewCtrl::SetExtendedStyleEx(DWORD ulExMask_, DWORD ulExStyle_)<br />
{<br />
<br />
CAPPRESULT sRes;<br />
<br />
HWND pHWndS;<br />
<br />
if(CAPP_FAILED(sRes = this->GetHWnd(&pHWndS)))<br />
{<br />
<br />
return sRes;<br />
<br />
}
<br />
ListView_SetExtendedListViewStyleEx(pHWndS, ulExMask_, ulExStyle_);<br />
<br />
<br />
return CAPP_ERR_NO_ERRORS;<br />
<br />
}
<br />
<br />
<br />
CAPPRESULT CListViewCtrl::OnCreate(HWND pHWndS_, int nWndID_)<br />
{<br />
<br />
CAPPRESULT sRes;<br />
if(CAPP_FAILED(sRes = CCtrl::OnCreate(pHWndS_, nWndID_)))<br />
{<br />
<br />
return sRes;<br />
<br />
}
<br />
if(this->m_unIconID)<br />
{<br />
<br />
if(CAPP_FAILED(sRes = this->m_ImageListC.Create( 16, 16, ILC_COLOR32 | ILC_MASK, 1, 0 )))<br />
{<br />
<br />
return sRes;<br />
<br />
}
<br />
HICON pIconHandleS;<br />
<br />
if(!(pIconHandleS = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(this->m_unIconID), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR)))<br />
{<br />
<br />
return sRes;<br />
<br />
}
<br />
UINT unImageIndex;<br />
if(CAPP_FAILED(sRes = this->m_ImageListC.Add((HICON)pIconHandleS, &unImageIndex)))<br />
{<br />
<br />
return sRes;<br />
<br />
}
<br />
if(CAPP_FAILED(sRes = this->SetImageList(&this->m_ImageListC, CListViewCtrl::m_eImageListStyle::SMALL)))<br />
{<br />
<br />
return sRes;<br />
<br />
}
<br />
}
<br />
<br />
<br />
return CAPP_ERR_NO_ERRORS;<br />
<br />
}
<br />
<br />
<br />
<br />
<br />
<br />
CListViewCtrl::SCListViewCtrlConf ConfDataS;<br />
<br />
ZeroMemory(&ConfDataS, sizeof(CChildWnd::SCChildWndConf));<br />
<br />
ConfDataS.m_bFrameDrawOvr = FALSE;<br />
ConfDataS.m_bClientDrawOvr = FALSE;<br />
ConfDataS.m_bEditLabel = FALSE;<br />
ConfDataS.m_pParentC = this;<br />
ConfDataS.m_unIconID = NULL;<br />
ConfDataS.m_fRelX = 0;<br />
ConfDataS.m_fRelY = 13;<br />
ConfDataS.m_fRelWidth = 100;<br />
ConfDataS.m_fRelHeight = 87;<br />
ConfDataS.m_nNoReszSide = CChildWnd::SCChildWndConf::m_eNoReszSide::NO_RESZ_TOP | CChildWnd::SCChildWndConf::m_eNoReszSide::NO_RESZ_LEFT | CChildWnd::SCChildWndConf::m_eNoReszSide::NO_RESZ_RIGHT | CChildWnd::SCChildWndConf::m_eNoReszSide::NO_RESZ_BOTTOM;<br />
<br />
if(CAPP_FAILED(sRes = this->AddChild("CListViewCtrl", &(this->m_pClientEventsListViewC), &ConfDataS, &(this->m_nClientEventsListViewID))))<br />
{<br />
<br />
return sRes;<br />
<br />
}
<br />
<br />
<br />
LV_COLUMN ListViewColumnS;<br />
<br />
ListViewColumnS.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;<br />
ListViewColumnS.fmt = LVCFMT_LEFT;<br />
ListViewColumnS.cx = 100;<br />
ListViewColumnS.pszText = "Evento";<br />
<br />
int nColumnIndex = 0;<br />
if(CAPP_FAILED(sRes = dynamic_cast<CListViewCtrl*>(this->m_pClientEventsListViewC)->InsertColumn(nColumnIndex, &ListViewColumnS, &nColumnIndex)))<br />
{<br />
<br />
return sRes;<br />
<br />
}
<br />
<br />
ListViewColumnS.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;<br />
ListViewColumnS.fmt = LVCFMT_LEFT;<br />
ListViewColumnS.cx = 100;<br />
ListViewColumnS.pszText = "Utilidades";<br />
<br />
nColumnIndex = 1;<br />
if(CAPP_FAILED(sRes = dynamic_cast<CListViewCtrl*>(this->m_pClientEventsListViewC)->InsertColumn(nColumnIndex, &ListViewColumnS, &nColumnIndex)))<br />
{<br />
<br />
return sRes;<br />
<br />
}
<br />
if(CAPP_FAILED(sRes = dynamic_cast<CListViewCtrl*>(this->m_pClientEventsListViewC)->SetExtendedStyleEx(LVS_EX_CHECKBOXES, LVS_EX_CHECKBOXES)))<br />
{<br />
<br />
return sRes;<br />
<br />
}
<br />
<br />
<br />
<br />
Please if anybody has any clue as to what might be happening let me know.
I aoplogize if the OO library that I'm using, which is my own, can be a bit confusing, but it's basically the same Win32.
|
|
|
|
|
|
Hello
I need to apply margins to CEditView text while printing through a page setup dialog. these should be visible in print preview also.
any help ?
Thanks
|
|
|
|
|
hi all
i have made a SDI application
please help me
when i right click on a menu item
it will not show the event handler on menu item
// I double click on IDR_MAINFRAME and i will show mwnues
i add a tool menu and a dependent item under this but when i right
click on it it will not show event handler
thanks
hi
|
|
|
|
|
Can you more explainn do you want when you right click it shows a contextmenu or you want to fire an event?
|
|
|
|
|
I'd hoped since CHtmlView was derived from CFormView that I could use dialog templates to put controls over the HTML. Isn't that *why* it was derived from CFormView?
But CHtmlView has no constructor with a template parameter as CFormView(templateID) does.
And here I'd got a CDhtmlDialog test program working so well, thinking it would be easy to port to an existing MDI CFormView program I need the technique in
I don't think I can pass a templateID to protected CFormView(templateID) in the base initialization
although CHtmlView can, because its *directly* derived from CFormView, unlike my class.
// What CHtmlView does
CHtmlView::CHtmlView()
: CFormView((LPCTSTR) NULL)
{
}
// And I can't after deriving from CHtmlView
// error C2614: 'CMfcieView' : illegal member initialization: 'CFormView' is not a base or member
CMfcieView::CMfcieView()
: CFormView(IDD_MYDIALOG)
{
}
|
|
|
|
|
Hi,
If you want your CDhtmlDialog to be used in any of your view you can make it a modeless dialog and make a client of View window.
I prefer CDhtmlDialog, since It has already loaded with event sinks, while if you want CHtmlView to get events from controls like button click you need to code a little.
|
|
|
|
|
Sounds promising, thanks for your response.
Do you know of any examples, or a code snippet?
|
|
|
|
|
Hi,
I used similar method in my project, I used modeless CDHtmlDialog there.
I think there are lots of article in codeproject for CDhtmlDialog, please search.
MSDN example DhtmlExplore will give you a good start, it demonstrates dynamic
content on html page.
Best Regards
Raj
|
|
|
|
|
I think I already understand the CDHtmlDialog techniques.
I'm trying to figure out what you meant by "and make a client of View window".
Something like this? (which hasn't worked for me yet )
BOOL CChildFrame::OnCreateClient(LPCREATESTRUCT /*lpcs*/, CCreateContext* pContext)
{
CDummyDlg *pDummy = new CDummyDlg();
BOOL res = pDummy->Create(IDD_DIALOG1, NULL);
return res;
/*
return m_wndSplitter.Create(this,
2, 2, // TODO: adjust the number of rows, columns
CSize(10, 10), // TODO: adjust the minimum pane size
pContext);
*/
}
|
|
|
|
|
WhiteSky has posted a link to document, which uses CDhtmlDialog Code and made a CView based class. You may try this,
And if you want modeless dialog method, would I like to know want's the problem, Does it isn't compiled or run time problem.
pDummy->Create(IDD_DIALOG1, NULL);
you are passing "NULL", you need to pass "this", then only it becomes the client of CChildFrame.
Moreover, I expect you to create a client of view. since you are making client of frame window, the document has no View object, this will cause problem.
Best Regards
Raj
|
|
|
|
|
I'd seen that sample, but it's not using any dialog templates.
Like you, I think I'd prefer to use CDHtmlDialog, if I could figure out how to display the dialog in the view
|
|
|
|
|
Ok,
Its simple,
1) create a modeless dialog of CDhtmlDialog.
Create a dialog resource and add class derived from CDhtmlDialog.
To make it modeless implement a default contructor and implement a simple create function
BOOL CYourModelssDHTMLdlg::Create(CWnd* pParentWnd)
{
return CDHtmlDialog::Create(IDD_DIALOG1, pParentWnd);
}
use create() function in your CView OnCreate() / equavalent.
int CYourView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CView::OnCreate(lpCreateStruct) == -1)
return -1;
m_yourModelssDHTMLdlg.Create(this);
}
Note: set the dialog style to WS_CHILD, WS_VISIBLE, No BORDER , NO TITLEBAR use resource designer or on your code (precreateWindow()).
2) On your Views OnSize()
void CYourView::OnSize(UINT nType, int cx, int cy)
{
CView::OnSize(nType, cx, cy);
m_yourModelssDHTMLdlg.MoveWindow(0, 0, cx, cy);
}
You might have missed it so you thought its not working.
Try this, this requires a time of 5~10 minutes.
Note: remember dialog style, resize and the dialog might have ok and cancel button this will cause the dialog to exitin its default behaviour.
I didn't explored CDHtmlDialog::EnableModeless, try this when you get time
Best Regards
Raj
|
|
|
|
|
|
how to send mail from vc++ program.
I want to sent same message at same time to both yahoo as well as google.
How to do this
|
|
|
|
|
|
i cant find correct document for send mail from vc++.
I have used the csmtp.but it doesnt support to send mail to yahoo and google and others.
I can only send mail to my company id using csmtp
what is a problem.
what to do for that
|
|
|
|
|
prathuraj wrote: cant find correct document for send mail from vc++.
Why you dont use of MAPI I think it will be solve your problem(you can find a lot of articles about it on my previous reply)
|
|
|
|
|
I try to collect words like Bmw or K1200S (letters and digits)
Before i add the _istdigit it worked fine .but when i put _istdigit so it could collect
digits too it dont return me values
And in debug i have that error on CString variables (CString arrays too)
In some google search i found something about pointers .so it should have
some problem on array ?
my code:
f.e m_Query = "BmW K1200S";
oid CInfoRetrievalDlg::GetQuery()
{
CString str = m_Query;
CString sp[100];
CString word = "";
int z = 0;
for ( int i = 0 ; i < str.GetLength() ; i++)
{
if ( i == 0)
{
if ( 0 != _istalpha( str.GetAt(i) ) || 0 !=_istdigit(str.GetAt(i)) )
{
word = word + str.GetAt(i);
}
}
if ( i > 0)
{
if ( i < (str.GetLength() -1))
{
if ( 0 != _istalpha( str.GetAt(i) ) || 0 !=_istdigit(str.GetAt(i)))
{
word = word + str.GetAt(i);
}
if ( 0 == _istalpha( str.GetAt(i) ) && 0 == _istdigit(str.GetAt(i)) && (0 != _istalpha( str.GetAt(i-1) ) || 0 !=_istdigit(str.GetAt(i-1)) ))
{
QueryWords[z] = word;
word.Empty();
z = z +1;
}
}
if ( i == (str.GetLength() -1) )
{
if ( 0 != _istalpha( str.GetAt(i) ) || 0 !=_istdigit(str.GetAt(i)) )
{
word = word +str.GetAt(i);
QueryWords[z] = word;
z = z +1;
}
if ( 0 == _istalpha( str.GetAt(i) ) && 0 == _istdigit(str.GetAt(i)) && (0 != _istalpha( str.GetAt(i-1) ) || 0 !=_istdigit(str.GetAt(i-1)) ))
{
QueryWords[z] = word;
z = z +1;
}
}
}
}
m_QueryWords = z;
}
|
|
|
|
|
I am a beginner in c++ programming, and I am studying topic about c++ template these few days. I tried to implement a template that have the definition and implementation in .h and .cpp files as follow:
// tpl.h
template <class ttype="">
class tpl
{
private:
int test ;
public:
tpl() ;
int get_test() ;
} ;
// tpl.cpp
template <class ttype="">
tpl::tpl()
{
test=1 ;
}
template <class ttype="">
int tpl::get_test()
{
return test ;
}
But linker errors come out when I compiled the above codes in ms-vc++6.0. I am disturbed by this problem. Could anyone helps me? thanks a lot !
BR
Yuwen
|
|
|
|
|
|
Hi Steve, I am just reading your given article on template, I think it will help me a lot. thx!
|
|
|
|
|
|
Hi,
Your Template arguments are not clear please use pre tags.
BTW, I search the html code, you are missing template argument in the function definition
template <class tType>
tpl::tpl()
{
test=1 ;
}
use
template <class tType>
tpl<tType>::tpl()
{
test=1 ;
}
Best Regards
Raj
-- modified at 0:24 Wednesday 6th June, 2007
|
|
|
|
|
Hi Rajkumar_R, thx for your reply! I am just reading an article called How To Organize Template Source Code, I think it will help to solve my problem. BTW, could you pls tell me how to paste my codes with messages using pre tag ? thx !
|
|
|
|
|