|
Ahh ... nice suggestion!
I am not using WTL per se, but my own OO framework. I mimic several parts of the WTL including THUNKING the wndproc - but I've not worried about the PreTranslateMessage mechanism ... till now.
So, conceptually, I don't want to translate WM_KEYDOWN to the WM_CHAR if it is a tab character ... I will read up - but I am guessing that PreTranslateMessage leads to TranslateMessage unless you return 0 or something like that ...
I wonder if I can also change the keydown here as well ...
At any rate, I think your point is ... I need to intercept the message before calling TranslateMessage - and the WTL lib provides an easy way to do this on a per HWND basis. Seems like alot of overhead ... does the MFC or WTL message loop call PreTranslateMessage for EVERY window class object?
Thanks,
-Luther
|
|
|
|
|
This is EXACTLY what I was looking for
Thanks PJ!
BOOL DialogName::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
if(pMsg->message==WM_KEYDOWN)
{
if(pMsg->wParam==VK_RETURN || pMsg->wParam==VK_ESCAPE)
pMsg->wParam=NULL ;
}
return CDialog::PreTranslateMessage(pMsg);
}
|
|
|
|
|
I have a Class called CDriver which is as follows:
class CDriver {
public:
// Constructor
CDriver();
CDriver(CDriver &driver); // Copy constructor
CDriver operator =(const CDriver d);// Assign one to another
~CDriver();
// Varables
CString csFirstName;
CString csMI;
CString csLastName;
CString csBirthDate;
CString csASSN;
CString csStreetAddr;
CString csCity;
CString csState;
CString csZip;
CString csHomePhoneNum;
CString csHireDate;
CString csTruckAssigned;
};
Now I made a vector: "vector<<cdriver>> vecDriver"; Also a CString vector: "vector<<cstring>> myCStringvec"; and an iterator "vector<<cstring>>::iterator myIT";
None of these work properly! I can get the "myCStringvec.push_back(temCString)"; to accept one and only one CString. I NULLed temCString before reloading it with data then again used: "myCStringvec.push_back(temCString)"; to no avail. WHY?
vecDriver doesn't work at all nor does myIT. Please ignore the "<< and >>" it would not show what I wanted to show without using two each!
C++ is my favorite programming language
|
|
|
|
|
The "Do not treat <'s as HTML tags" checkbox helps considerably when posting code.
Your assignment operator should probably take a reference (const CDriver& d )
What do you mean when you say that it doesn't work? What does it do/not do?
Larry Mills wrote:
I NULLed temCString before reloading it with data
If you did something like this:
temCString.Empty();
temCString = _T("Some New Data");
then that should be fine. If you did something more interesting, then there might be potential for error - please elaborate.
|
|
|
|
|
I did this: temCString = ""; Then I would reload this (worker CString) with the CDriver data that I extracted from the instance of CDriver that was loaded --> ADDING THE FILE DELIMITERS in this "temCString". The idea of the vector was it was supposed to hold the FILE DELIMITED CSTRINGS that comprised the CDriver data. Then I was going to send the vector CStrings to my DataBase file. But the vector will only load the FIRST sending of the temCString; after I temCString = ""; I reload that CString with the next FILE DELIMITED CSTRINGS from CDriver and attempt to send it to the vector. In debug mode the CString is correctly loaded and as I enter the vector using push_back() method it goes through the motions of receiving the data CString but when I check it the second attempt to load it fails --> it's not in the vector!
Any ideas?
Larry A Mills Sr
(Thanks about the tip regarding Do not treat <'s as HTML tags" checkbox.)
C++ is my favorite programming language
|
|
|
|
|
Looks to me like you're passing in the same string over and over, assuming that's what you mean by 'I NULLed temCString before reloading it with data'.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
What I mean is that I clear out (NULL) the string ALWAYS, before I send the next data. (I load this class varable with all the data from CDriver WITH THE FILE DELIMITERS in this string. Then I would extract each string and send it to a file. I never got that far because I noticed that the CString was not being ADDED TO THE VECTOR after the first one was in the vector. I used the push_back() method with both CStrings.
Any ideas?
Larry A Mills Sr
VC++ 6.0 version
C++ is my favorite programming language
|
|
|
|
|
Hello
I want to use namespace in a com atl project in VC6. I don't know how i have to do this. I want to use this dll in C# and it will be nice to have namespace.
Tahnks,
Mihai
|
|
|
|
|
Anyone know if boost provides a way of escaping\unescaping regular expression metacharacters?
In Italy for thirty years under the Borgias they had warfare, terror, murder, bloodshed - but they produced Michelangelo, Leonardo da Vinci and the Renaissance. In Switzerland they had brotherly love, five hundred years of democracy and what did that produce - the cuckoo clock!
-- Harry Lime
|
|
|
|
|
Hi Friends,
I am looking for some very good book explaining SNMPv2 and MIB-II development in C++ (Object oriented approach). Please refer me any such book which i can buy form internet.
YOur help will be highly appreciated.
Best regards
Mukhan
|
|
|
|
|
I would like to do project "Thumb Rcognition and Authentication" using VC++ .
if any one has some idea plz send some suggestion.
Regarding the interface of the Scanner and the database.
And device drivers also
hello every body
|
|
|
|
|
??? talking about fingerprint recognition ?
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Hi all,
i have 2 annoying vc7 problems:
1. i use pragma warning disable for the 4311 and 4312 (sign mismatch)
doesn't seem to work...
2. i have in my solution 2 active x projects, everytime the solution compile them even if they were compiled a second ago...it for some reason thinks that the files are not up to date
question:
is there a way to disable the output "project xxx is up-to-date" and just tell the compiler to compile only the project that has been changed???
thanks in advanced
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
#pragma warning must be outside the body of a function...
do you verify this ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
even better, it is declared in the stdafx.h above all the includes...
what about my other problem and question?
any1?
thanks
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
hi
i want to know can we read dbf file with odbc if yes which driver should be used to mak the dsn.
ddd
|
|
|
|
|
Yes, DBF files can be read using ODBC. Look in your machine's list of installed drivers to see which one(s) can handle DBF files. Last time I checked, that was a dBase file format.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
thank u it works.
honesty is the best policy.
|
|
|
|
|
I am building a window in code (not via RC or dialog templates) and attaching EDIT controls to it. Upon completion, there may be 10 windows with 25 EDIT controls each.
Within each window (one displayed at a given time) I'd like to TAB between the EDIT controls. Unfortunately, the only examples I can find on the net (http://blogs.msdn.com/oldnewthing/archive/2003/10/21/55384.aspx)
want me to change my message loop to something like this:
if (IsDialogMessage(hwnd, &msg)) {
/* Already handled by dialog manager */
} else {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
My message loop is in a completely different C++ file/class. For this to work as described, I'd need to pass the application (or make it global) to every single EDIT control - or at least, find away to keep updating the "hwnd" used in the IsDialogMessage method above every time focus changed since that method works on a specific EDIT control at a time ...
Is that really necessary? I've built the EDIT controls with WS_TABSTOP style, and naturally, they are eating the TAB key. I can manually catch and GetNextDlgTabItem myself, but I wasn't sure if that was normal.
Is there a cleaner way I've overlooked?
Many thanks,
-Luther
|
|
|
|
|
Once you have built them, you could
SetWindowPos(CWnd* pWndInsertAfter,
int x, int y, int cx, int cy, UINT nFlags );
where
pWndInsertAfter identifies the CWnd object that will
precede this CWnd object in the Z-order.
|
|
|
|
|
I'm not sure how that helps me?
If I am in a TEXT EDIT box - and I press the "TAB" key, the MessageBell goes off and the "TAB" key is sent to the TEXT EDIT box.
If I manually catch the "TAB" key in a WM_CHAR message and manually call GetNextDlgTabItem and then SetFocus(nextItem) ... I get the behavior I want.
The ordering is fine. When I manually tab, I tab to the correct TEXT EDIT box. The problem is not the ordering or where I am going. The problem is catching the "TAB" key before it is sent to the EDIT TEXT box. That is what IsDialogMessage handles for me.
I'm just looking for some common idiom to handle this - since IsDialogMessage needs the HWND to check and IsDialogMessage must exist with the main message loop - 100,000 miles (so to speak) away from the rest of my code.
Does that help clarify anything? Thanks,
-Luther
|
|
|
|
|
Is it a modeless dialog? I'm having the same problem.
In modal dialogs, WS_TABSTOP does the job you want: send focus to the next control in the tab order when tab is hit. Modeless, nope...I get the same behavior. Help anybody?
|
|
|
|
|
Hi,
I am upgrading VC compiler on a windows machine from version 6.0 to 7.1
After upgrading when I tried to compile my application and got this error
\\Vc7\atlmfc\include\atlalloc.h(218) : error C2629: unexpected 'class ATL::CTempBuffer ('
I was able to compile code on 6.0 version
I am getting this error whenever "atlalloc.h" is included directly or indirectly in my cpp file.
Please tell me how to fix this
Regards... Ankur
|
|
|
|
|
some code that was compiling good under VC6 can fail under VC7 because not Standard C++ compliant anymore...
what is the failling code please ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I'm trying to rewrite an assembly program in C++. Instead of reinventing the wheel, I am cutting and pasting a lot of asm into __asm blocks. However, whenever I try to call int 0x21, I get an unhandled exception. Why is this and how do I get around it?
|
|
|
|