|
You could use PostMessage (not SendMessage) with some (WM_APP + n) identifier. The message would travel through message queue. EN_KILLFOCUS processing would be completed before executing handler for posted message.
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
Hello,
I'm trying to sort a list of file by name with IShellFolder::CompareIDs. I noticed that the order is not exactly like Windows Explorer. For example, Windows Explorer list "-!!!abc.jpg" first but CompareIDs put "!a.jpg" first. Any idea?
Thanks,
Hiusing
|
|
|
|
|
Hi,
I have a really tough problem relating to MFC and DLL. I have developed a MFC Dll that displays a dialog when it is called by a MFC MDI application. What I did was that first I dynamically created a button on the SDI toolbar by passing the toolbar pointer to the Dll. Then I clicked on the button and a modeless dialog poped up. The modeless dialog contains a 'CMonthCalCtrl' calendar control, an 'insert' button, and a 'cancel' button. When I clicked on the 'insert' button, the Dll should insert the selected date into an already opened MDI edit view. However, I have no idea how to bridge the gap between the MDI view and the Dll (i.e. I do not know how to pass back the date to the view). I have tried to search for related resource on the net but gained no clue and I need the solution desperately.
You have any neat solution??
Thanks in advance.
leonwoo
|
|
|
|
|
Pass in whatever function you call from the DLL a reference to a variable. In the DLL, assign whatever you want to that variable, which in this case is a date.
Kuphryn
|
|
|
|
|
Thanks for the prompt reply. Another question is how do I detect button click from the dialog? I need to insert the date into the view whenever i click on the 'insert' button. The MDI application somehow has to detect the button click and then return the reference variable.
thanks.
leonwoo
|
|
|
|
|
I would pass the handle of the view to the dialog and then send a private message to the view from the dialog. In the LPARAM I would pass the relevant information. If your data does not fit into the four bytes I would use an automatic structure to hold the data and call SendMessage. Do not allocate the struct with new in the dll and delete it with delete in the main app, that will corrupt the heaps.
Cheers
Steen.
"To claim that computer games influence children is ridiculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
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.
|
|
|
|