|
|
Hi All,
I'm trying to create a treeview using WTL which allows Drag'n'Drop but CreateDragImage & TreeView_CreateDragImage always return 0. Everything is okay up to the point where I try and create the DragImage. I'm I doing it in the right way or is there another way to do this. Please advice.
Thanks
Jens
Here is some sample code:
class CMyTreeViev : public CWindowImpl<cmytreeviev, ctreeviewctrlex="">,
public CCustomDraw<cmytreeviev>
{
public:
DECLARE_WND_SUPERCLASS(NULL, CTreeViewCtrlEx::GetWndClassName())
BOOL PreTranslateMessage(MSG* pMsg);
BEGIN_MSG_MAP_EX(CMyTreeViev)
REFLECTED_NOTIFY_CODE_HANDLER_EX(TVN_BEGINDRAG, OnBeginDrag)
CHAIN_MSG_MAP_ALT(CCustomDraw<cmytreeviev>, 1)
DEFAULT_REFLECTION_HANDLER()
END_MSG_MAP()
LRESULT OnBeginDrag ( NMHDR* phdr )
{
_ASSERT(0);
NM_TREEVIEW* pNMTV = reinterpret_cast<nm_treeview*> (phdr);
// CreateDragImage always return 0
CImageList im = CreateDragImage( pNMTV->itemNew.hItem );
// im = TreeView_CreateDragImage(m_hWnd, pNMTV->itemNew.hItem );
return 0;
}
};
|
|
|
|
|
From MSDN:Remarks
If you create a tree-view control without an associated image list, you cannot use the TVM_CREATEDRAGIMAGE message to create the image to display during a drag operation. You must implement your own method of creating a drag cursor. Does your tree have an image list?
--Mike--
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
CP SearchBar v2.0.2 released
|
|
|
|
|
|
I just finished the functor article here, and tried sth for rendering particles using functors. all seems to work fine, but I just wanted to make sure I didn't make sth stupid/ugly. here is the code;
<br />
template <class TParticle><br />
class ParticleRenderer<br />
{<br />
public: <br />
virtual void render(const std::vector<TParticle>& particles) = 0;<br />
};<br />
this is the base class, and I wonder, having a hierarchy of functors is a good idea or not (performancewise especially)
<br />
template <class TParticle><br />
class DefaultRenderer : public ParticleRenderer<TParticle><br />
{<br />
public: <br />
void render(const std::vector<TParticle>& particles)<br />
{<br />
std::for_each(particles.begin(), particles.end(), *this);<br />
}<br />
void operator ()(const TParticle& p) const<br />
{<br />
}<br />
};<br />
inside the operator() I do the rendering on each TParticle instance.
and here is how my Particles are stored..
<br />
template <size_t size, class TParticle><br />
class ParticleSystem<br />
{<br />
ParticleRenderer<TParticle>* m_pRenderer;<br />
std::vector<TParticle> m_particles;<br />
void render(){<br />
m_pRenderer->render(m_particles);<br />
}<br />
}<br />
so I can set different kinds of renderers (depending on client hardware), I don't need to check which renderer to use in everytime I call ParticleSystem::render. But this also means that some auxilary functions and member vars will be added to each derived renderer classes..
I would like to have some feedback, before implementing all.. thanks in advance.
|
|
|
|
|
Hi!
I'm writting an Outlook plugin, and a very nasty problem arised: I'm using some dialogs in my app, and one of them has to display a .html page. I've put a CWebBrowser ActiveX on it, but the dialog won't show up. The DoModal function returns -1 (couldn't create dialog). If I remove the activeX from my dialog everything works just fine.
Well, have you any ideea why this problem appears, or some workaround to display my .html page?
Thanks,
Doru K.
|
|
|
|
|
Use Mozilla instead
http://codeguru.earthweb.com/controls/iemozilla.html
"I'm from the South Bronx, and I don't care what you say: those cows look dangerous." U.S. Secretary of State Colin Powell at George Bush's ranch in Texas
|
|
|
|
|
Thanks, but that wasn't very usefull. I think the problem lies somewhere else...
Thanks anyway!
|
|
|
|
|
|
hi,
i have an application which consist of activex control and it is running, how can i use GetActiveObject function to get the iunknown pointer for that activex control.actually i want to excute the method of that activex control.
abhay
|
|
|
|
|
hi Abhay !!
First get the Window Pointer or handle of ur ActiveX,
CWnd * Activewnd;
Activewnd=new Cwnd()
Attach that ActiveX handle to this Cwnd *
and then use Use GetControlUnknown() which will return u the IUnknown Pointer , through which u can get IDispatch and then can execeute any method u wish to execute !!
Tell me if it solved ur problem !!
Abhishek Srivastava
Software Engg (VC++)
India ,Noida
Mobile no 9891492921
|
|
|
|
|
GetControlUnknown() function returns null, when i debug it an internal variable m_pCtrlSite found null.
the code is as follows:
LPDISPATCH pdisp = NULL;
CWnd * pwnd;
pwnd=new CWnd();
pwnd->Attach((HWND)x);
//pwnd->Attach((HWND)x);
//pwnd=CWnd::FromHandle((HWND)x);
if(pwnd!=NULL)
{
// CWnd *newcwnd;
// newcwnd=new CWnd;
LPUNKNOWN pUnk = pwnd->GetControlUnknown(); //returns null
if(pUnk)
{
}
}
|
|
|
|
|
Hello,
because of the tip "Consider replacing associative containers with sorted vectors" from the book "Effective STL" (and because it did work out better in my project) i did replace a map with a vector<pair<...>>
to compare the data i used the CompareData class presented in the book - to make the sorted vector act like a map.
Works out great.
I just wanted to make a templated Version of this.. and strangely it doesn't work out..
anybody any ideas ?
typedef std::pair<int, int>Data;
class DataCompare
{
public:
bool operator () (const Data& lhs, const Data& rhs) const
{
return keyLess (lhs.first, rhs.first);
}
bool operator () (const Data& lhs, const Data::first_type& k) const
{
return keyLess (lhs.first, k);
}
bool operator () (const Data::first_type& k, const Data& rhs) const
{
return keyLess (k, rhs.first);
}
private:
bool keyLess (const Data::first_type& k1, const Data::first_type& k2) const
{
return k1 < k2;
}
};
template <typename T1, typename T2>
class _DataCompare
{
public:
bool operator () (const std::pair<T1,T2>& lhs, const std::pair<T1,T2>& rhs) const
{
return keyLess (lhs.first, rhs.first);
}
bool operator () (const std::pair<T1,T2>& lhs, const std::pair<T1,T2>::first_type& k) const
{
return keyLess (lhs.first, k);
}
bool operator () (const std::pair<T1,T2>::first_type& k, const std::pair<T1,T2>& rhs) const
{
return keyLess (k, rhs.first);
}
private:
bool keyLess (const std::pair<T1,T2>::first_type& k1, const std::pair<T1,T2>::first_type& k2) const
{
return k1 < k2
}
};
_DataCompare<int, int> DataCompare;
"I'm from the South Bronx, and I don't care what you say: those cows look dangerous." U.S. Secretary of State Colin Powell at George Bush's ranch in Texas
|
|
|
|
|
bool operator () (const std::pair<T1,T2>::first_type& k, std::pair<T1,T2>& rhs) const Maybe you're missing a const here.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
this was just a problem of typing it into this strange window and changing the code, so it looks good in html.. the code i've tried out, had this const..
"I'm from the South Bronx, and I don't care what you say: those cows look dangerous." U.S. Secretary of State Colin Powell at George Bush's ranch in Texas
|
|
|
|
|
If you care to send me (here or by email) more code or even a compilable test I can have a look at it.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanks for your kind offer!
I've sent you an E-Mail with a small testprogram already.
Thanks in advance,
Bernhard
"I'm from the South Bronx, and I don't care what you say: those cows look dangerous." U.S. Secretary of State Colin Powell at George Bush's ranch in Texas
|
|
|
|
|
In my activex control, I use a message box to give warning information when user is editting the data. but sometimes the messagebox failes to show,
Thank you!
|
|
|
|
|
Hi,
This might sound like an impossible task, but I am attempting it anyway.
I have a project in VC 7 which uses some of the ATL functions that come with VC 7.
I require to compile this project in VC6.
As far as i know, there should be no technical limitations in doing this.
I am currently copying the ATL files which I am dependent on to my project and attempting to compile that on VC 6.
Unfortunately I am getting compile errors, so I was wondering if anyone has any advice.
Maybe they have done this before, or maybe they have done something similar and would like to share some experiences.
Thanks in advance,
Jeremy.
Jeremy Pullicino
C++ Developer
Homepage
|
|
|
|
|
You shouldn't assume that there won't be technical issues; VC7 is a different compiler, and is stricter but more compliant. It is likely that the ATL headers might use new features.
What are the features in 7 that you need, and why must you use VC6?
Steve S
|
|
|
|
|
Had similar problems trying to 'port' ATL7 AtlMime classes to VC6. still lokking for a solution.
Hush,hush...
thought I heard you call my name now.
Kula Shaker.
Amit Dey
Latest articles at CP - Writing Word addins
Office addin
|
|
|
|
|
hi,
i got the handle of an activex control window, which is in some other application, i want to call the method exposed by the activex control for that i need IUnknown pointer, how can i retrieve it or is there any other way i call the method of an activex in some other application, i have only the handle of activex control.i have the ocx file for that control.
regards
abhay
|
|
|
|
|
I have little confusion that i wanted to clear out. Please see the following code:
//defination
SetMstrRS(IMstrRS * pMS);
CComPtr <IMstrRS> pMS;
pMS.CoCreateInstance(...);
SetMstrRS(pMS);
Now in the last statment is AddRef called by SmartPointer before it is passed to the method.
thanks in advance
qur
|
|
|
|
|
|
Hi!,
Does anybody know how to create dialog bars in WTL? I am looking for a class similar to CDialogBar in MFC.
Thanks in advance.
|
|
|
|