|
Not sure what exactly causes the crash,
but MSDN defines WM_SETFOCUS as :
wParam - Handle to the window that has lost the keyboard focus. This Parameter can be NULL. <br />
lParam - This parameter is not used.
Perhaps this is what causes the 'confusion' later...
Try simply calling the windows function SetFocus(HWND window);
|
|
|
|
|
If you are trying to Click a button
Why not try to send WM_COMMAND msg to the window with the ID of the button (you can discover it via GetDlgCtrlID() )
Hope it Helps
Live as if your were to die tomorrow. Learn as if you were to live forever.
-Mahatma Gandhi
|
|
|
|
|
I have an app that's centered around a List-Control.
Over the area not occupied by the List-Control rest several buttons that affect this List-Control .
My minor problem is that whenever such a button is pressed, it grabs the focus away from the list which is something I don't want to happen.
I also have an edit-box which grabs the focus, but that's obviously ok.
What I'm looking for is a method to tell specific controls not to grab the focus yet still remain usable.
Thanks
|
|
|
|
|
Sounds like maybe you need to rethink the application. As a general rule I'd expect something I click on to grab the focus. It would feel counter-intuitive to work otherwise.
If, on the other hand, what you mean is that you want the ListControl to show the current selection even when it lacks focus you can do that by adding the LVS_SHOWSELALWAYS style to the ListControl.
Rob Manderson
http://www.mindprobes.net
Paul Watson wrote:What sense would you most dislike loosing?
Ian Darling replied.
Telepathy
Then I'd no longer be able to find out everyones dirty little secrets The Lounge, December 4 2003
|
|
|
|
|
These 'special' buttons are buttons which usually change the way the list appears, or buttons that trigger menus for example.
These two kinds of buttons are 'state changers' at most, when the user is done with them, he expects to see the selection (more on this at the end) and be able to scroll his mouse-wheel and have the list respond.
I'm already using LVS_SHOWSELALWAYS, but I draw the selection differently when the list is in focus and when it's not, so that the user knows that he's going to mouse-wheel he's going to affect the list (or not).
The most common situation is a button that switches the list's mode from details to icons, etc, etc. Once you click the button, it gains the focus and maintains it, causing the list to loose the focus. In such a case, the user would like the list to maintain the focus.
What do you think ?
|
|
|
|
|
It may be a horrible solution but why not throw focus back to the ListControl when one of the special buttons handles a click event?
[edit]Don't try to do this directly within the event handler. Define a custom message and handler and do a PostMessage to that handler from within the click event. Windows does strange things when trying to change focus from within a focus related event.[/edit]
Rob Manderson
http://www.mindprobes.net
Paul Watson wrote:What sense would you most dislike loosing?
Ian Darling replied.
Telepathy
Then I'd no longer be able to find out everyones dirty little secrets The Lounge, December 4 2003
|
|
|
|
|
I tried that as well, but I don't like it because the focus is removed from the list and then restored, causing a flickering (as I mentioned before I draw selected items differently when in focus and when not).
I'm looking for a solution in the direction of a window-style or something like that, something that will make windows understand that this kind of control doesn't accept focus... if it's possible
|
|
|
|
|
Hello all !
I want to know the time (hh:mm) of creation of a file (or at least the time of the last modification). Wich function can use for that ?
Thanks
|
|
|
|
|
GetFileTime() API function or CFileFind::GetCreationTime(), GetLastWriteTime().
|
|
|
|
|
Hi,
use this
CString CStrFileName;
CStrFileName = "c:\\temp\test.exe";
FILETIME ftCreate, ftModify;
CFileStatus m_FileStatus;
CFile::GetStatus(CStrFileName,m_FileStatus);
AfxTimeToFileTime(m_FileStatus.m_ctime, &ftCreate);
AfxTimeToFileTime(m_FileStatus.m_mtime, &ftModify);
Have A Nice Day
Murali.M
|
|
|
|
|
Ok thanks everybody !
It is what I was searching for
|
|
|
|
|
Hi...
There are some problems which I am not able to solve. They are
consider an MDI application....with three child windows open in it....with three buttons on each child window in the toolbar....actually this is a static MDI application...with three child windows initially....
1. The three child windows in the file should be toggable. Suppose if I click on the 1 in the toolbar then the child window should be shown and if I click it once again then it should be hidden not destroyed.
2. The three child windows should be made dockable like in VC++ the windows are dockable.
3. There are three views in this file. One for Bitmap, second for Color table and the last one for Text. For bitmap and data I don't seem to face any problem but for the color table, I will have to display the colors that are present in the bitmap image in tabular form. The tabular columns consists of three columns one for Index, second for colors in the bitmap and the third for the RGB values of each individual color. But I don't know how to do that.
Please help me regarding the above.
Regards,
Ruchit Sharma. R
|
|
|
|
|
Humm..
First, in order to show or hide a window, you can use the ShowWindow method of the MFC's CWnd class. All windows (basically) support this method call, so you can show/hide a window by issuing the call with a parameter SW_SHOW/SW_HIDE.
The docking system of a window follows a very simple logic: each time the window is moved (WM_MOVE), it checks whether the window is in range X from the window/control/button/whatever it is supposed to dock with. If it is, the window's moving rectangle is repositioned to the docking position. If it is not, the rectangle follows the mouse as it normally would.
You could try to derive from CControlBar instead of CMDIChildWnd . This approach would require you to write extensive drawing code in order to make it work properly. Alternative approach would be to hack the MFC source code and copy the EnableDocking method and it's implementation away from the CControlBar class, and implement it to your CMDIChildWnd -derived class. This approach would require considerate planning and testing that the feature works correctly.
The bad thing is that in the first method, you will lose the benefits of CMDIChildWnd , and in the second method, you might end up doing lots of extra work.
I understood that your MDI application has three child windows, and each of these child windows displays one view. Is this correct ? If so, just create a CListCtrl to hold the index, color swatch and RGB values. If you implement a custom-derived CListCtrl , you can 'paint' the middle cells with a color instead of text, and let the original implementation handle the other cells. Main idea would be that when you insert data into the middle cell, then instead of writing it as text, your control paints it as a rectangle filled with the specified color.
Perhaps you should look at the DrawItem method of CListCtrl to see if it suits your needs. Also, see this article[^] for some help.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
what i should do to build simple animate button....
|
|
|
|
|
|
can anyone tell me how i can query which is the currently installed anti virus packege in my OS[Windows 9x/2000/...]
-------------------------------------------
My application needs to scan application files before it starts using them
So i planned that i needed to get the currently installed antivirus package n call createprocess
like some applications i could have the user input this manually in a cnfiguration dialog
i however have seen that microsoft office products word excel ppt etc
automatically do this when a doc is opened
so i guess the details of the current anti virus packege is stored inthe shell of the OS somewhere like the registry
any ideas????
|
|
|
|
|
are u really sure that microsoft office product use the installed virus scanner?
Don't try it, just do it!
|
|
|
|
|
fordge wrote:
i however have seen that microsoft office products word excel ppt etc
automatically do this when a doc is opened
Microsoft Office is not doing this, the installed AV software is. It can be configured to scan all sorts of files, documents included. The AV software "gets" the file before Office does to allow for a virus-free file.
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
so if instead of Norton AV suppose another AV is installed say mcAfee or TrendMicro
in that case also do the docs get scanned before they r opened?
can anyone who has used any other AV package comment on such a feature
in which case then indeed it should be a feature of office that calls some generic interface so that the installed AV software is invoked
coz else shouldnt my opening a file in notepad also trigger the file to be scanned by Norton AV.
can anyone who has used any other AV package comment on such a feature??
|
|
|
|
|
fordge wrote:
so if instead of Norton AV suppose another AV is installed say mcAfee or TrendMicro
in that case also do the docs get scanned before they r opened?
Yes, if they are capable of, and are configured to, scan documents.
fordge wrote:
in which case then indeed it should be a feature of office that calls some generic interface so that the installed AV software is invoked
Office is none the wiser that the file it opened was run through a virus-scanner first. That's the beauty of AV software. It monitors each open-file request, scans the file, then hands it on to the requesting application.
fordge wrote:
coz else shouldnt my opening a file in notepad also trigger the file to be scanned by Norton AV.
Since Notepad-type (e.g., .txt, .log, .cfg) files cannot contain a virus, it's pointless to scan them.
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
Hi,
CHttpFile::SendRequest() used for post method. what wrong in the following code
pFile = pServer->OpenRequest(CHttpConnection::HTTP_VERB_POST,CStrObject,CStrReferer,1,NULL,NULL,dwHttpRequestFlags);
pFile->SendRequest(szHeaders,(LPVOID)(LPCTSTR)CStrQueryString,CStrQueryString.GetLength());
I got following error
rror C2664: 'int __thiscall CHttpFile::SendRequest(const char *,unsigned long,void *,unsigned long)' : cannot convert parameter 2 from 'void *' to 'unsigned long'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
any one help to me. thanks in advance.
Murali.M
|
|
|
|
|
pFile = pServer->OpenRequest(CHttpConnection::HTTP_VERB_POST,CStrSuburl);
|
|
|
|
|
Try like this
<br />
pFile->SendRequest(szHeaders,(LPVOID)(LPCTSTR)CStrQueryString,(DWORD)CStrQueryString.GetLength()); <br />
greatest thing is to do wot others think you cant suhredayan@omniquad.com
|
|
|
|
|
Hi all,
How can I change the Caption of all control on CFileDialog.
CFileDialog dlg(...);
...
...
...
ex:
"Open" -> "ads",
"Cancel" -> "ddd",
"Look in" -> "find in"...
Thanks all
|
|
|
|
|
You'll have do derive your own class from CFileDialog.
greatest thing is to do wot others think you cant suhredayan@omniquad.com
|
|
|
|