|
I have the following tree:
.ABC
.|_A
.|_B
.|_C
.XYZ
.|_X
...|_XX
.|_Y
.|_Z
I want to display something when i use a mouse to click on particular item. How to do that?
For example, if I highlight XX, then pop up a message box say "XX"....etc...
Thanks
|
|
|
|
|
Handle the NM_CLICK notification. You can implement the handler in the parent dialog box or (using message reflection) in CTreeCtrl-derived class.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Thanks for your reply.
I know I can use NM_CLICK, but I don't know which function in CTreeCtrl i should use. Seems liked they just return a HTREEITEM variable. The following is how i make a tree:
HTREEITEM ABC, XYZ, node;
ABC = m_Tree.InsertItem("ABC", TVI_ROOT);
node = m_Tree.InsertItem("A", ABC);
node = m_Tree.InsertItem("B", ABC);
...etc...
if I want to choose B...but it returns a HTREEITEM....how can i know which "node"....
|
|
|
|
|
Use GetMessagePos and CTreeCtrl::HitTest. Assuming that you're handling NM_CLICK in CTreectrl-derived object, you'd write your code like this:
CPoint pt = ::GetMessagePos();
ScreenToClient(&pt);
UINT flags;
HTREEITEM hItem;
hItem = HitTest(pt, &flags);
And do whatever you want with hItem and flags.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Please use TVN_SELCHANGED,
ON_NOTIFY_REFLECT(TVN_SELCHANGED, OnSelchanged)
OnSelchanged is a Function.
welcome you to Sky...
|
|
|
|
|
e.g I have a variable CString path;
How can I find out the subdirectories of this folder?
|
|
|
|
|
look at FindFirstFile() FindNextFile()
its in the returned flags value
---
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
Thanks!
can I use FILE_ATTRIBUTE_DIRECTORY in the WIN32_FIND_DATA structure, to find subdirectories?
One more question: these functions return a handle. How can I find out what the name of the directories is?
|
|
|
|
|
as far as i remember the cFileName member holds the file / directory name
---
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
WIN32_FIND_DATA is a struct:
typedef struct _WIN32_FIND_DATA {
DWORD dwFileAttributes;
FILETIME ftCreationTime;
FILETIME ftLastAccessTime;
FILETIME ftLastWriteTime;
DWORD nFileSizeHigh;
DWORD nFileSizeLow;
DWORD dwReserved0;
DWORD dwReserved1;
TCHAR cFileName[ MAX_PATH ];
TCHAR cAlternateFileName[ 14 ];
} WIN32_FIND_DATA, *PWIN32_FIND_DATA;
this is in MSDN
welcome you to Sky...
|
|
|
|
|
I've noticed that Microsoft is building their commercial products (Money, Encarta, Tax..) using a completely flat look that resembles a web page and it seems to me that they are using a set of controls/views not included in VC++ 6. Does anybody knows were this framework comes from?
Jose Lago
|
|
|
|
|
Not all of them use that style, but how they are implemented differs. I don't have Encarta to hand at the moment, but you could try using Spy++ on it. Money 2000 (and 98 I think) is just a basic web-browser shell and the pages are actually HTML.
> Andrew.
|
|
|
|
|
What is the best way to hang up the modem in JP Naughter's lib or in the Win32 API?
Currently, I'm trying the +++ATH0 trick which is evidently not reliable.
Can it be as simple as closing the port? Is that reliable?
Thanks in Advance!
|
|
|
|
|
RasEnumConnections()
Then call
RasHangUp ()
Cheers
Alfadhly
It is Illogical to define an inventor by his invention
|
|
|
|
|
I wrote a MFC ActiveX control with the Wizard. I want to do something when
the user press a key and the control has the focus, so I wrote:
void CMyControlCtrl::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call default
AfxMessageBox("Key pressed") ;
COleControl::OnChar(nChar, nRepCnt, nFlags);
}
Now if I insert the control in a Visual Basic Form it works right, but if I
insert it in the dialog of a MFC Dialog based application it doesn't work.
Can someone help me?
Thanks Paolo
|
|
|
|
|
I think that you need do some thing at the control PreTranslateAccelerator method
function like following code.
BOOL CInPlaceEdit::PreTranslateAccelerator(LPMSG pMsg, HRESULT& hRet)
{
if( ( pMsg->message == WM_KEYDOWN || pMsg->message == WM_KEYUP ) &&
( pMsg->wParam == VK_LEFT || pMsg->wParam == VK_RIGHT ||
pMsg->wParam == VK_UP || pMsg->wParam == VK_DOWN || pMsg->wParam == VK_TAB) )
{
hRet = S_FALSE;
return TRUE;
}
return FALSE;
}
cz
|
|
|
|
|
Thanks for your answer, I'm not an expert on MFC and I didn't find any documentation on PreTranslateAccelerator and how to use it so I'm not so good to try your advice. I'm not sure that the problem is on Accelerator because in VB it works fine.
To try my problem just create a new MFC ActiveX ControlWizard (in the second windows check the "Available in "Insert object" dialog") then add the Window message handler WM_CHAR like in my previous message. Now compile and register it. Try to insert in a VB form and in a Dialog based MFC program.
Thanks in advance. Paolo
|
|
|
|
|
Yes, PreTranslateAccelerator is for ATL control and you can use PreTranslateMessage method
as the another person's suggest.
Please read MSDN following article:
PRB: MFC ActiveX Control Ignores ARROW Keys on VB Container
Good Luck!
|
|
|
|
|
I read the article that you suggest me. But my problem isn't about the accelerator keys, I have the problem with each kind of keys. It seems that the control hasn't the focus (or something similar). If you read the article "MFC ActiveX Control in IE Doesn't Detect Keystrokes" (Q168777) they speak about the activation of the control within IE. I tried their suggestions but I didn't solve my problem. If you have time to check just create an MFC ActiveX control with the wizard (confirm all the default properties and set the "available in insert object dialog"), then add the function OnChar (WM_CHAR) and write inside it AfxMessageBox("Key pressed"). Now insert the object in a VB form and it works, but if you insert in a VC MFC dialog based application (with the wizard) it doesn't work.
I'm using Visual Studio 6.0.
Thanks Paolo.
|
|
|
|
|
isn't it PreTranslateMessage() ?
---
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
Hi,
I have a metafile, which contains some OpenGL information in it. When I display it on the screen, everyhting is fine. But, when I print the metafile I have problems!
If I print it on a RGB printer, then everything's fine. The problem comes when I print the file on a CMYK printer. The Red and blue colors are interchanged.
Any ideas?
NOTE: I am using NT 4.0
|
|
|
|
|
can somebody pls tell me where I can find source code with CHothKeyCtrl
|
|
|
|
|
when ever i made a small chages in the program, builds it. it's giving the following error
E:\Raj\Testing\Testing.cpp(11) : fatal error C1083: Cannot open include file: 'e:\raj\E:\Raj\Testing\Testingadovc\debug\msado15.tlh': Permission denied
Then i have to rebuild it to work with it. I am facing this problem very frequently. Please help me to avoid rebuilding again & again.
My email id is kgrajashekar@usa.net
Thanks in advance.
|
|
|
|
|
I have a dll written by a third pary vendor.
It works perfect in vc5, the linkage import section looks external for
_myfunc@PU8
In VC6 it looks externally for _myfunc@QU8
The dll exports _myfunc@PU8
How can I resolve this name mangling on linkage in VC6?
Gerry.
|
|
|
|
|
Name mangling is implemented in a compiler-specific way. It seems that MS changed the mangling rules between 5 and 6 releases. You'll have to ask the vendor to recompile the code in VC 6. I'm assuming that they gave/sold you the DLL, import library and header files only (no full source).
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|