|
if u set focus to parent formview, the parent will set focus to its child which has focus before the parent gets focus automatically - so ur dialog gets focus back.
in ur function - OnLvnItemChangedList - u should tell formview where to send focus.
i.e. post a message to formview with wParam==control's ID, so in formview, u send focus to the control.
|
|
|
|
|
I tried your suggestion, but with partial success. When my dialog has the focus before I select an item on the listbox it works fine, but if the focus is on my formview or mainfrm and I select on item, the focus wents to my formview for a second and then switched back to my dialog...
|
|
|
|
|
|
I have an app that I need to shut down after a certain amount of time (eval version). I use a PostQuitMessage, which handles cleanup and works fine in most cases, but if I have a dialog opened through a DLL call (one of my own), it closes the DLL dialog, but not the main app.
What would be the proper (or clean) way to shutdown the DLL dialog(s), then the main app (dialog based)?
TIA
|
|
|
|
|
I have had this issue myself and would too like to know if there is some Zen approach that gives a warm fuzzy feeling.
Simply, the way I saw it was, that there is a higherachy of modal windows that have to be killed off in the right sequence.
It's interesting that the PostQuitMessage message you sent to the app seemed to be passed along to the right window rather than causing you trouble. It might just be best in that case to do the following:
while(::IsWindow(appWindow)) {
::PostQuitMessage(1);
}
If that doesn't work, do what I did, which was to start at the further most relevant child window and post to them each a WM_CLOSE message.
This may not be what you wanted to hear and I'll be watching this thread closely to see if anyone has any better ideas but in lieu of any other responses I thought you may at least like to know that there is commercial software out there that uses this technique
Tom
|
|
|
|
|
I tried doing this, which does seem to work...
I set a bool whenever I call my DLL.
<br />
if( m_bLibOpen )<br />
{<br />
PostQuitMessage(SC_CLOSE);<br />
}<br />
<br />
AfxGetMainWnd()->PostMessage(WM_CLOSE, 0, 0);<br />
This does seem to close multiple dialogs opened by my DLL, along with my main app, but somehow, it still doesn't seem "clean" to me.
I'm playing around with EnumChildWindows now...
|
|
|
|
|
|
It should work: I don't know Linux but this is standard C++.
If you explain what the problem is, maybe we can help.
|
|
|
|
|
As Cedric already noted, this should work.
What error do you get?
|
|
|
|
|
Make sure you are spelling the file name EXACTLY right. Windows is not case sensitive, but Linux is.
http://en.wikipedia.org/wiki/Comparison_of_file_systems[^]
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
|
Paul Tawk wrote: #include iostream.h
#include fstream.h
Those are old-style headers. The standard has changed them to be the following (on all platforms):
#include <iostream>
#include <fstream>
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Nemanja Trifunovic wrote: What error do you get?
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
I don't know the compiler you are using, but it might be that you must "turn on" the support for STL.
In the Acc compiler (on a HP-UX machine), it's done by adding -AA to the command line, both at compile and linking.
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
I have two selfwritten libraries, one of wich uses the other. If just add the first one to the dependecies of the second one without actually using it or including any of the header-files or anything, i get a
LNK4006: symbol already defined in object; second definition ignored
for every single symbol in the first library. Can anyone tell me why that is and what i can do about it ? I'm allways eager to eliminate all warnings.
|
|
|
|
|
if you make one library dependent on another, VS will merge the the two together so that the second library is contained within the first library.
the fix is: you only need to link to the 'parent' library, since it will have a copy of the second library in it already.
|
|
|
|
|
Thank you for the awnser, but that is not the problem. It seems, for what reason god alone knows, that VC.NET actually links the file twice. I add it to my linker dependencies and look at the command line - everything fine. Now i build, and suddenly the command line changed, so that the library is actually linked twice. Don't ask me why, but thats what it does.
|
|
|
|
|
your original post says "If just add the first one to the dependecies of the second one without actually using it..."
if you make library A depend on library B, the .LIB for library A will contain the .LIB for library B. you don't have to explicitly link library B at all. but, i repeat myself.
Mr.Brainley wrote: suddenly the command line changed, so that the library is actually linked twice
what does the command line look like?
|
|
|
|
|
Ok, i was unclear there. By "add to dependencies" i meant explicitly linking it. I added the filename in the "Additional dependencies" column of the linker options in the project properties.
But i solved the problem now ... somehow. I gave VC a relative path to .lib-file. That was the problem. He put that path into the LIBPATH commandline-option, added the filename to the files to be linked, and then added the filename plus the absolute path to the files to be linked, so it was in there twice. Nice, eh ? I now added an absolute path to my projects properties instead of the relative one, and it works. Who'd have guessed ...
|
|
|
|
|
I was wondering how I could make a log of what programs is being launched in my computer.
I have two things in my mind:
1) Making a "shortcut to the most recently used programs"-program. This program should give me an overview of what programs have been the 15 last started programs so that I can click on that program and it will be launched again (kinda like a quick-launch, only less static)
This should log programs that are started throught the "start->run" menu, a shortcut anywhere on my computer or from a command line interface. It would also be nice to have any parameters to the program included.
2) Log what actually goes on in my computer.
I have been thinking about systemwide hooks but not sure if this is the way to go.
Should I instead hook APIs, in this case, which?
I want to do this in C++.
Can anyone guide me into a correct direction?
Edit: I assume this might be something..
http://www.codeproject.com/system/soviet_protector.asp[^]
-- modified at 9:36 Monday 23rd October, 2006
|
|
|
|
|
I had a task similar to this one a while back. After much wrangling with various techniques I settled on a system wide hook. It worked a charm and stories of massive degradation of the system's performance seemed to be woefully exaggerated. Not only that but I've never had a problem with it since and it's been out in the field for four years now.
However, if you've never used them before do some good research on the issues related to shared memory. It's not complicated but if your trying to feel your way about without the theory it's fiddly and error prone.
There is another good technique but it requires a DDK for each of the systems your aiming at. In the DDK you get access to kernel events and of course these can give you a very accurate and specific view of what's going on.
Sorry, I don't know much about hooking APIs.
Tom
|
|
|
|
|
Could you please be more specific about what type of hook you set up? (keyboard or mouse or something else)
I have dabbled with both systemwide hooks (keyboard + mouse) and also some api-hooking but the latter is also a much more harder topic to go with
I assume both a mouse or keyboard hook will come into the process space of a gui program but what about console-like programs?
Thanks for you reply
|
|
|
|
|
Hi
Personally, I used WH_SHELL and paid particular attention to HSHELL_WINDOWCREATED and HSHELL_WINDOWDESTROYED messages. I then posted them onto a window in my app.
Tom
|
|
|
|
|
Nice, thanks for the info. I'll try this out
|
|
|
|
|
can anybody tell me what framework are you guys using? is it MFC from microsoft? or any other?
|
|
|
|