|
godspeed123 wrote: I was wondering if this is possible with ATL
Absolutely.
Have a look at ATL examples in MSDN here[^] and as always; CodeProject is a good place to start, e.g. this article[^].
You might also want to browse through the other CP articles in the COM section[^].
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
|
|
|
|
|
step 1 : define a class "CMyListViewImpl ".
typedef CWinTraitsOR "WS_BORDER | LVS_REPORT | LVS_SINGLESEL |
LVS_NOSORTHEADER | LVS_SHOWSELALWAYS" CListTraits;
class CMyListViewImpl :
public CWindowImpl "CMyListViewImpl,CListViewCtrl,CListTraits"
//(here " is supposed to "<" and ">", web page can't show "< >" ,
//so i write " after CWindowImpl and CWinTraitsOR )
{
...
};
step2 : in SDI CMainFrame. define a data member "CMyListViewImpl m_list;"
step3 : create listview control :
CMainFrame::OnCreate()
{
...
m_list.Create(m_hWnd,rcDefault);
m_list.InsertColumn ( 0, _T("Macro"), LVCFMT_LEFT, 120, -1 );
m_list.InsertColumn ( 1, _T("Result"), LVCFMT_LEFT, 90, -1 );
m_list.InsertItem(0,_T("1"));
m_list.SetItemText(0,1,_T("D"));
m_hWndClient = m_list ;
}
the creation procedure are listed above,but i can't see the listview .where the bug lies ?(WTL 7.1 ,vc6 )
|
|
|
|
|
Did you call AtlInitCommonControls() ?
|
|
|
|
|
The WS_VISIBLE style might help to see the listview, and the WS_CHILD to position it in the frame.
CMainFrame::UpdateLayout() should be called after m_hWndClient setting.
cheers,
AR
|
|
|
|
|
but it still doesn't work .
would you give me an example code about how to use LISTVIEW in SDI ?
i find some examples written in Dialog programs ,using subclassing controls method.
i just need pure code to see whole creation procedure.
|
|
|
|
|
Launch WTL AppWizard and genereate a SDI application with view type 'ListView'.
cheers,
AR
|
|
|
|
|
Hello everybody.
I get the following errors when compiling a small dialog app. I am using WTL 8.0 with VS 2005, but the same goes if I use 7.5 or 7.1, and I did everything correctly, moving the Platform SDK include to the top of the list in the include options, etc. Any help is appreciated.
Error 94 error C2446: '==' : no conversion from 'int' to 'LPCTSTR' e:\wtl80\include\atlmisc.h 3878
Error 95 error C2040: '==' : 'LPCTSTR' differs in levels of indirection from 'int' e:\wtl80\include\atlmisc.h 3878
Error 96 error C2061: syntax error : identifier 'CHARRANGE' e:\wtl80\include\atlctrls.h 7269
Error 97 error C2061: syntax error : identifier 'CHARRANGE' e:\wtl80\include\atlctrls.h 7282
Error 98 error C2061: syntax error : identifier 'CHARFORMATA' e:\wtl80\include\atlctrls.h 7298
Error 99 error C2061: syntax error : identifier 'CHARFORMATA' e:\wtl80\include\atlctrls.h 7305
Error 100 error C2061: syntax error : identifier 'PARAFORMAT' e:\wtl80\include\atlctrls.h 7324
Error 101 error C2061: syntax error : identifier 'CHARFORMATA' e:\wtl80\include\atlctrls.h 7425
Error 102 error C2061: syntax error : identifier 'CHARFORMATA' e:\wtl80\include\atlctrls.h 7432
Error 103 error C2061: syntax error : identifier 'CHARFORMATA' e:\wtl80\include\atlctrls.h 7439
Error 104 error C2061: syntax error : identifier 'CHARFORMATA' e:\wtl80\include\atlctrls.h 7446
Error 105 error C2061: syntax error : identifier 'PARAFORMAT' e:\wtl80\include\atlctrls.h 7459
Error 106 error C2146: syntax error : missing ';' before identifier 'GetWordBreakProcEx' e:\wtl80\include\atlctrls.h 7490
Error 107 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int e:\wtl80\include\atlctrls.h 7490
Error 108 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int e:\wtl80\include\atlctrls.h 7491
Error 110 error C2146: syntax error : missing ';' before identifier 'SetWordBreakProcEx' e:\wtl80\include\atlctrls.h 7496
Error 111 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int e:\wtl80\include\atlctrls.h 7496
Error 112 error C2061: syntax error : identifier 'EDITWORDBREAKPROCEX' e:\wtl80\include\atlctrls.h 7496
Error 113 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int e:\wtl80\include\atlctrls.h 7497
Error 115 error C2061: syntax error : identifier 'TEXTRANGEA' e:\wtl80\include\atlctrls.h 7502
Error 116 error C2061: syntax error : identifier 'CHARFORMAT2A' e:\wtl80\include\atlctrls.h 7532
Error 117 error C2535: 'DWORD WTL::CRichEditCtrlT<tbase>::GetDefaultCharFormat(void) const' : member function already defined or declared e:\wtl80\include\atlctrls.h 7533
Error 118 error C2061: syntax error : identifier 'CHARFORMAT2A' e:\wtl80\include\atlctrls.h 7539
Error 119 error C2535: 'BOOL WTL::CRichEditCtrlT<tbase>::SetCharFormat(void)' : member function already defined or declared e:\wtl80\include\atlctrls.h 7540
Error 120 error C2061: syntax error : identifier 'CHARFORMAT2A' e:\wtl80\include\atlctrls.h 7546
Error 121 error C2535: 'BOOL WTL::CRichEditCtrlT<tbase>::SetDefaultCharFormat(void)' : member function already defined or declared e:\wtl80\include\atlctrls.h 7547
Error 122 error C2061: syntax error : identifier 'CHARFORMAT2A' e:\wtl80\include\atlctrls.h 7553
Error 123 error C2535: 'DWORD WTL::CRichEditCtrlT<tbase>::GetSelectionCharFormat(void) const' : member function already defined or declared e:\wtl80\include\atlctrls.h 7554
Error 124 error C2061: syntax error : identifier 'CHARFORMAT2A' e:\wtl80\include\atlctrls.h 7560
Error 125 error C2535: 'BOOL WTL::CRichEditCtrlT<tbase>::SetSelectionCharFormat(void)' : member function already defined or declared e:\wtl80\include\atlctrls.h 7561
Error 126 error C2061: syntax error : identifier 'CHARFORMAT2A' e:\wtl80\include\atlctrls.h 7567
Error 127 error C2535: 'BOOL WTL::CRichEditCtrlT<tbase>::SetWordCharFormat(void)' : member function already defined or declared e:\wtl80\include\atlctrls.h 7568
Error 128 error C2061: syntax error : identifier 'PARAFORMAT2' e:\wtl80\include\atlctrls.h 7574
Error 129 error C2535: 'DWORD WTL::CRichEditCtrlT<tbase>::GetParaFormat(void) const' : member function already defined or declared e:\wtl80\include\atlctrls.h 7575
Error 130 error C2061: syntax error : identifier 'PARAFORMAT2' e:\wtl80\include\atlctrls.h 7581
Error 131 error C2535: 'BOOL WTL::CRichEditCtrlT<tbase>::SetParaFormat(void)' : member function already defined or declared e:\wtl80\include\atlctrls.h 7582
Error 132 error C2146: syntax error : missing ';' before identifier 'GetTextMode' e:\wtl80\include\atlctrls.h 7588
Error 133 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int e:\wtl80\include\atlctrls.h 7588
Error 134 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int e:\wtl80\include\atlctrls.h 7589
Error 136 error C2061: syntax error : identifier 'TEXTMODE' e:\wtl80\include\atlctrls.h 7594
Error 137 error C2146: syntax error : missing ';' before identifier 'GetUndoName' e:\wtl80\include\atlctrls.h 7600
Error 138 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int e:\wtl80\include\atlctrls.h 7600
Error 139 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int e:\wtl80\include\atlctrls.h 7601
Error 141 error C2146: syntax error : missing ';' before identifier 'GetRedoName' e:\wtl80\include\atlctrls.h 7606
Error 142 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int e:\wtl80\include\atlctrls.h 7606
Error 143 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int e:\wtl80\include\atlctrls.h 7607
Error 145 error C2061: syntax error : identifier 'GETTEXTEX' e:\wtl80\include\atlctrls.h 7645
Error 146 error C2061: syntax error : identifier 'GETTEXTLENGTHEX' e:\wtl80\include\atlctrls.h 7663
Error 147 error C2061: syntax error : identifier 'SETTEXTEX' e:\wtl80\include\atlctrls.h 7680
Error 148 error C2061: syntax error : identifier 'FINDTEXTA' e:\wtl80\include\atlctrls.h 7821
Error 149 error C2061: syntax error : identifier 'FINDTEXTEXA' e:\wtl80\include\atlctrls.h 7831
Error 150 error C2535: 'LONG WTL::CRichEditCtrlT<tbase>::FindTextA(DWORD) const' : member function already defined or declared e:\wtl80\include\atlctrls.h 7832
Error 151 error C2061: syntax error : identifier 'FORMATRANGE' e:\wtl80\include\atlctrls.h 7841
Error 152 error C2061: syntax error : identifier 'FORMATRANGE' e:\wtl80\include\atlctrls.h 7847
Error 153 error C2535: 'LONG WTL::CRichEditCtrlT<tbase>::FormatRange(void)' : member function already defined or declared e:\wtl80\include\atlctrls.h 7848
Error 154 error C2061: syntax error : identifier 'EDITSTREAM' e:\wtl80\include\atlctrls.h 7872
Error 155 error C2061: syntax error : identifier 'EDITSTREAM' e:\wtl80\include\atlctrls.h 7878
Error 156 error C2143: syntax error : missing ';' before '*' e:\wtl80\include\atlctrls.h 7941
Error 157 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int e:\wtl80\include\atlctrls.h 7941
Error 158 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int e:\wtl80\include\atlctrls.h 7942
Error 160 error C2061: syntax error : identifier 'IRichEditOleCallback' e:\wtl80\include\atlctrls.h 7949
Error 163 error C2446: '==' : no conversion from 'int' to 'LPCTSTR' e:\wtl80\include\atlmisc.h 3878
Error 164 error C2040: '==' : 'LPCTSTR' differs in levels of indirection from 'int' e:\wtl80\include\atlmisc.h 3878
Error 193 error C2872: 'CPoint' : ambiguous symbol e:\microsoft visual studio .net 2005 team edition\vc\atlmfc\include\atlimage.h 199
Error 194 error C2872: 'CPoint' : ambiguous symbol e:\microsoft visual studio .net 2005 team edition\vc\atlmfc\include\atlimage.h 199
Error 222 error C2872: 'CPoint' : ambiguous symbol e:\microsoft visual studio .net 2005 team edition\vc\atlmfc\include\atlimage.h 199
Error 223 error C2872: 'CPoint' : ambiguous symbol e:\microsoft visual studio .net 2005 team edition\vc\atlmfc\include\atlimage.h 199
Most of the problems seems to be in the atlctrls.h, and I did not include UNICODE in the project settings.
Thanks.
|
|
|
|
|
I need a script to get the name or path on a active window opened.This i need to run on a Pop-up Web page opened to display an Image.This image i have uploaded to this site. The Pop-up window does not include a Address to copy the path. I need a VBscript to automatically get the title so the i can put it in clip board.
Praveen
|
|
|
|
|
Hi all,
I am using ATL Dialog for downloading and streaming video from a remote server.
The dialog box is having somany Bitmaps for buttons and other controls as well as a bitmap image as a skin.
Every thing is working fine but if i am downloading a video with more than 1 part(each part will be of 20 secs duration) then the dialog box is not redrawing properly and i have to kill it and re-login.
The downloading process works in a thread.
I am not handling WM_PAINT message.
Can any one help over this.
RAjesh.R
|
|
|
|
|
Hi All,
I am developing a toolbar for Outlook. I have placed an edit box on the tool bar. Now I want that when I change the text in the edit box, I should be able to handle the EN_CHANGE notification. Can somebody tell how this can be done?
Currently when I press the enter key I am able to get the value from the edit box, this is also achievable when I press tab and click with the mouse anywhere else on the screen.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Try by using overiding of Invoke method.
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
Hi,
I need to customize the CEdit control to use character masks. I thought of subclassing but the CEdit controls I need to customize are on a view that is created from scratch, so there is no CEdit resource to attach to with a GetDlgItem. The existing CEdit controls are created with a call to Create().
How can I subclass without a resource?
Thanks,
Merlinos
|
|
|
|
|
merlinos wrote: How can I subclass without a resource?
Use CWnd::SubclassWindow .
BTW, this question is appropriate for VC++ forum.
|
|
|
|
|
He's probably using WTL, otherwise he wouldn't have bothered asking the question in this forum, nor would he even ask this very question, as subclassing is automatic in MFC. Hence, his question is very much appropriate for this forum.
--
Verletzen zerfetzen zersetzen zerstören
Doch es darf nicht mir gehören
Ich muss zerstören
|
|
|
|
|
Joergen Sigvardsson wrote: He's probably using WTL
Probably !
Seeing mention of CEdit leads my assumption.
|
|
|
|
|
See: CWindow::SubclassWindow()
--
Verletzen zerfetzen zersetzen zerstören
Doch es darf nicht mir gehören
Ich muss zerstören
|
|
|
|
|
Hi All,
The following is giving me fits in VB.NET. Any ideas how to make it work?
*************
VB.NET
Dim rng as PseudoRNG
rng = new PseudoRNG()
dim a(10) as Long
rng.GenerateBlock( a )
...
*************
What I've tried (and how it does not work is listed below). Following that are KB article references... KB314708 does not resolve (even though it is supposed to). It is also broken on VS2005/.NET 2.0.
Does anyone know how to pass an array? Obvioulsy, I do not.
Jeff
****
HRESULT GenerateBlock([in, out] SAFEARRAY(VARIANT) * Block);
System.Runtime.InteropServices.SafeArrayTypeMismatchException
HRESULT GenerateBlock([in, out] SAFEARRAY(VARIANT*) * Block);
System.Runtime.InteropServices.SafeArrayTypeMismatchException
HRESULT GenerateBlock([in, out] SAFEARRAY(VT_DISPATCH) * Block);
Compile Problem
HRESULT GenerateBlock([in, out] SAFEARRAY(IDispatch) * Block);
SAFEARRAY(interface pointer) doesn't work using midl generated proxy
System.Runtime.InteropServices.SafeArrayTypeMismatchException
HRESULT GenerateBlock([in, out] SAFEARRAY(IDispatch*) * Block);
SAFEARRAY(interface pointer) doesn't work using midl generated proxy
System.Runtime.InteropServices.SafeArrayTypeMismatchException
HRESULT GenerateBlock([in, out] SAFEARRAY(long) * Block);
System.Runtime.InteropServices.SafeArrayTypeMismatchException
****
SafeArrayTypeMismatchException Error Message When You Invoke a COM Method[^]
Using OLE Automation Marshaler for 16/16 & 16/32 COM Interface[^] (should not even apply)
|
|
|
|
|
When in MFC ,we can change the wndclass structure before a window is created . for example :
BOOL CDlgFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CMDIChildWnd::PreCreateWindow(cs) )
return FALSE;
cs.style &= ~FWS_ADDTOTITLE ;
return TRUE;
}
Is there a counterpart in ATL/WTL ? or how could i implement the same effect ?
|
|
|
|
|
As far as I can see FWS_ADDTOTITLE is MFC specific. As to setting window styles the CWindow::Create methods allow these to be specified when creating the window. CWindowImpl also allows default styles to be specified through the TWinTraits template argument.
Steve
|
|
|
|
|
Hi All,
I want to implement an Interface only (no class backing it) in an ATL Dll. It will be similar to ISupportErrorInfo, but without an implementation. In pure C++, this would be a pure virtual base class. This is sometimes loosely called 'the contract'. In my library, I would then like my objects to derive from it:
class ATL_NO_VTABLE CWidget :
public CComObjectRootEx<CComSingleThreadModel>,
...
public IMyPureVirtualBase,
public IDispatchImpl<IWidget, &IID_IWidget, &LIBID_WidgetLibrary>
{
...
BEGIN_COM_MAP(CWidget)
...
COM_INTERFACE_ENTRY(IMyPureVirtualBase)
COM_INTERFACE_ENTRY(IDispatch)
END_COM_MAP()
};
How do I add this through Visual Studio? I can add a simple object, but it seems to get an implementation.
Jeff
|
|
|
|
|
I assume you mean a COM interface. A COM interface -- from a C++ perspective -- is just an abstract class with certain restrictions (for example, only virtual methods, no destructor, etc). Obviously other languages can not consume a C++ class however. Normally you describe the interface in an IDL file and use MIDL to create a type library from it. Languages that support COM can consume type libraries and MIDL will create an abstract class that can be consumed by C++ (or you can use #import to use the type library).
Steve
|
|
|
|
|
Add a class with the wizard and delete whatever method implementations you don't want.
|
|
|
|
|
How to create toolbars on ie and how to add tooltips for buttons using ATL
RAMU
|
|
|
|
|
|
I find that in ATL, the macro BEGIN_MSG_MAP(theClass) is defined this way:
#define BEGIN_MSG_MAP(theClass) \<br />
public: \<br />
BOOL ProcessWindowMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT& lResult, DWORD dwMsgMapID = 0) \<br />
{ \<br />
BOOL bHandled = TRUE; \<br />
hWnd; \<br />
uMsg; \<br />
wParam; \<br />
lParam; \<br />
lResult; \<br />
bHandled; \<br />
switch(dwMsgMapID) \<br />
{ \<br />
case 0:
Interestingly, theClass is not used anywhere, then what's the use of theClass here?
Thanks.
|
|
|
|