|
I am new to using the appwizard with the "Windows Explorer" option for how it looks.
I have set up my tree view on the left hand side and that is working fine. Including adding and removing branches of it.
The issue I am having now is getting the right hand List to change what it displays according to what is selected in the tree view.
Can anyone out there point me in the right direction. Or show me a relevant example.
It is very much appreciated.
|
|
|
|
|
You need to add a handler to the CLeftView Class (the one controlling the tree list)
void CLeftView::OnSelchanged(NMHDR* pNMHDR, LRESULT* pResult);
This gets called whenever the selected item in the tree changes...
Then use "CDocument::UpdateAllViews" to let the other views (the right hand) know about the change.
/sad joke alert.../
Its just a matter of letting the right hand know what the left hand is doing...
Blade[DMS]
|
|
|
|
|
I have a CListCtrl that is dynamically created. I am trying to add the columnclick event to it, but it doesn't seem to work. Any ideas why? this is what I am doing? Another question I have is how do you tell OnColumnClick which control you are refering to? I noticed that there are not IDs passed to it.
in my .h I have this:
//{{AFX_MSG(CFileView)
...
afx_msg void OnColumnClick(NMHDR* pNMHDR, LRESULT* pResult);
...
//}}AFX_MSG
in my .cpp
BEGIN_MESSAGE_MAP(CFileView, CListCtrl)
//{{AFX_MSG_MAP(CDetailsView)
ON_NOTIFY_REFLECT(NM_DBLCLK, OnDoubleClick)
//}}AFX_MSG_MAP
void CControllerSelection::OnColumnClick(NMHDR * pNMHDR, LRESULT * pResult)
{
NM_LISTVIEW * pNMListView = (NM_LISTVIEW*) pNMHDR;
m_ControllerList.SortItems(CompareFunc, pNMListView->iSubItem);
*pResult = 0;
}
|
|
|
|
|
First of all, decide if you're using CFileView, CControllerSelection or CDetailsView.
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
I'm having trouble with my MFC applications. Recently I've moved my projects from using the old Visual Studio 6.0 to Visual Studio .NET. I've also changed my operating system from Windows 2000 to Windows XP.
However, after I re-compiled and re-distributed my projects in Visual C++ .NET, I was informed by many of my clients that the applications will not open on their platforms (which they do not have Visual Studio installed). The errors being that there are several DLL files missing, including mfc70.dll and msvcr70.dll and a few others. I've tried to include those DLL files in the distribution packages, but that will increase the size of packages from less than 100K to over 1M. I've also tried to build my application using MFC in a static library instead of in a shared DLL. But that will still increase the size of my applications significantly.
But even with the above solutions, there are still problems. While my applications open on my clients' platform, some of the functionalities are loss (for example, the CFileDialog class doesn't work anymore).
This should be a common problem for many developers, I wonder if there's a better solution. Most of my clients are using Windows 2000 and Windows 98. Only a few of them are using Windows XP.
Thank you to anyone who can give me some advice.
J.
|
|
|
|
|
these are just the problems we gladly accept, in order to use the latest goodies from MS.
i always build with MFC statically linked, to avoid these kinds of problems. yes, it will increase the app size, but the app won't break when someone decides to change their version of the MFC DLLs.
1M really isn't that big. distributing a .Net app, now that's a big install package. but 1M will still fit on a floppy - no big deal.
not sure about the CFileDIalog problem. i haven't seen that one yet.
-c
Aiei i ea eio aoa i e eio e aigoa
|
|
|
|
|
I too am finding the same problems as "theorion16"
I don't necessarily agree that we should put up with a 1MB distributable when we can do the same reliably with a 100K distributable. Especially if dealing with certain apps that are widely distributed via the net/email etc...
I am in the process of finding a way to link a VC.NET app to older MFC DLL's.
Will post results when found.
Rick Eastes.
------------
|
|
|
|
|
RickEastes wrote:
I am in the process of finding a way to link a VC.NET app to older MFC DLL's.
i'd be totally shocked if that was possible. they've changed a lot of stuff in the new MFC (like CString). there are new interfaces etc..
but, if you do find a way, please be sure to write an article about it.
-c
Aiei i ea eio aoa i e eio e aigoa
|
|
|
|
|
;PI struggled when I try to view what's in the windows queue but there is no visual studio utility for it. I will appreciate if someone can point to me if someone has implement a tool like this.
Jerry Gao
|
|
|
|
|
which queue are you referring to?
-c
Aiei i ea eio aoa i e eio e aigoa
|
|
|
|
|
sorry for confusion. I mean windows messages queue.
|
|
|
|
|
How does TaskManager get the Image Name? If I iterate thru all windows using EnumWindows then I can get to the Handle for each window. Using the Handle I can get the processID using GetWindowThreadProcessId(hwnd, &wndPid);
I can also get access to the ModuleName and GetWindowText. But none of these are the same as the Image Name we see on Task Manager. Is there a way to get the Image name from either the Handle to the Window or the ProcessID?
Thanks.
|
|
|
|
|
#include <windows.h>
#include <stdio.h>
#include <Psapi.h>
#pragma comment (lib,"psapi.lib")
int main(int argc, char* argv[])
{
HANDLE hProc;
char szProcessName [80];
HMODULE ahMod [10];
DWORD dwNeeded,dwPid;
if(argc != 2)
{
printf("Usage: %s [pid]\n",argv[0]);
return 0;
}
dwPid = atol(argv[1]);
hProc = OpenProcess(PROCESS_QUERY_INFORMATION|PROCESS_VM_READ,FALSE,dwPid);
if (hProc)
{
if (EnumProcessModules(hProc,ahMod,sizeof(ahMod),&dwNeeded))
{
if(GetModuleBaseName(hProc,ahMod[0],szProcessName,sizeof(szProcessName)))
printf("%s\n",szProcessName);
else
printf("%s\n","Not found");
}
CloseHandle (hProc);
}
return 0;
}
|
|
|
|
|
I've got a property sheet with several property pages. I have hidden "Cancel", "Help" and "Apply". When the user clicks on "OK" I save settings and exit. However, when the user hits the Enter key, the application exits as though I clicked on "OK".
How do I change the focus to be a button in each property page so that the Enter key actually does something other than killing the app?
Thanks,
Albert
|
|
|
|
|
have you tried PreTranslateMessage()?
"... and so i said to him ... if it don't dance (or code) and you can't eat it either f**k it or throw it away" sonork: 100.18128 8028finder.com
|
|
|
|
|
I think you can overwrite the OnOK function, so that it will do nothing, instead calling the default OnOK function of the basic class.
Also, overwrite OnCancel function, so that "esc" button will not end your program.
|
|
|
|
|
Check out PSN_QUERYINITIALFOCUS .
Shog9
|
|
|
|
|
Hi.
I would like to is it possible to pass a reference and/or a pointer of an element in a linked list as function parameter? For example:
-----
std::list<int> intList;
for (int i = 0; i < 5; ++i)
intList.push_back(i);
std::list<int>::iterator iNumList = intList.begin();
// Traverse to element #4
for (int j = 0; j < 3; ++j
++iNumList;
// Now I want to pass element #4 (interger 4) to a function.
// Is it possible to point a reference or pointer to iNumList?
myFunction(iNumList);
...
void myFunction(int *pNumber)
{
...
*pNumber = 0;
...
}
-----
Thanks,
Kuphryn
|
|
|
|
|
Use &*iNumList or change the myFunction parameter to int & and use *iNumList
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
|
I'm working on putting some animated goodness into my Settlers of Catan freeware port (http://www.settlers3d.net). Specifically, I'm trying to hide player information until the mouse passes over it, at which point the player info zooms out from the right and stays there until the button gets the WM_MOUSELEAVE message and then it zooms back left.
The problem is that I have a couple of owner draw buttons inside my main player info button. Whenever the mouse cursor moves over these buttons, even though it is still within the player button client area, Windows sends a WM_MOUSELEAVE message and my control zooms back to the left. I've tried commenting out all mouse-handling messages within these child owner-draw buttons to no avail. I still get the WM_MOUSELEAVE message. Anyone know how to prevent this from happening?
I suspect that I'm screwed, but maybe there are some decent workarounds.
|
|
|
|
|
when u get the wm_mouseleave message cant u check to see where it is on the screen or what window its still over and decide from there?
"... and so i said to him ... if it don't dance (or code) and you can't eat it either f**k it or throw it away" sonork: 100.18128 8028finder.com
|
|
|
|
|
Yes, I can do that. The problem is that I then have to call _TrackMouseEvent again immediately to set up the mouse handler and it causes some bad flickering in the control. I might look into that a little more, though.
|
|
|
|
|
We had the same issue with some snapping windows done here. What we did was on the WM_MOUSELEAVE, we used the GetCursorPos() and WindowFromPoint() functions and checked who the parent of that window was. If it was the window the TrackMouseEvent was used on, we setup a new one for the button. When it leaves the button you will have to check again that its not on the parent or another child window of the parent etc...
Roger Allen
Sonork 100.10016
I think I need a new quote, I am on the prowl, so look out for a soft cute furry looking animal, which is really a Hippo in disguise. Its probably me.
|
|
|
|
|
Yeah, thanks, that's exactly what I ended up doing last night, execpt I used GetCursorPos(), GetWindowRect(), and the PtInRect() function of CRect to check if the cursor position was inside the client rectangle.
Thanks for the help. I got it to work without flicker by overriding the OnEraseBackground() method and immediately returning TRUE, which I should have done a while ago, anyway.
|
|
|
|