|
I couldn't figure out how to filter out the other things OnNotify would trigger, but I believe part of my problem seems to be that the hItem is what the TreeView has as a keyboard highlighted region rather than the actual node clicked on by mouse.
Do you have any ideas as to change hItem to reflect what is actually clicked on by the mouse and thus ignore the keyboard rectangular region that highlights the 1st root node or changes if I use my keyboard to move it around?
In other words,
HTREEITEM hItem = m_filterTreeCtrl.GetSelectedItem();
Is not with respect to the node I click on with my mouse.
|
|
|
|
|
Hi, I'm using VC++ with MFC.
I have a CScrollBar in my program which is supposed to perform various functions when it is moved.
How can I tell when the user has clicked on the scrollbar and moved it up and down? I thought it might just be EN_CHANGE but this does not seem to work.
I am setting up all of the scroll bar's parameters using SetScrollInfo, which does seem to work, but I cannot tell when the bar is moved and when it IS moved, it does not seem to "stick" at its new position, it just returns to the "nPos" that I initially set it to in SetScrollInfo.
KR
|
|
|
|
|
|
|
In my application i am creating a dialog to create a new username and passowrd. i am saving the username ans password in a file. now i want to know how do i update my password with the help of a gui. now the format of the file is
harry pass_harry
what is the way to change the password?
|
|
|
|
|
A better way would be to encrypt and store the password into a database. I am not sure how safe is it to store passwords along with username in a text file.
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
Chandrasekharanp wrote: ...know how do i update my password with the help of a gui.
A file is a file whether you are using a GUI, a console, or a service.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
I just wanted to parse some data read into an CStringArray. The string to be parsed is got out of the array and is a CString type.
I have been trying to use strtok() to do this.
Typical string is "qwerty,123,,33,ABCD,,4545,"
I have another member variable (CString type array) to hold the parsed strings (as CString).
Typical string is "qwerty,123,,33,ABCD,,4545," sent to the GetDataItem procedure.
void CGenerate_FilesDlg::GetDataItem(CString str)
{
char *P1 = strtok((char*)(LPCTSTR)str, ",");
char *P2 = strtok(NULL, "\0");
}
I get error when trying to put the parsed data into m_ParseParams[]
Error 3 error C2664: 'void ATL::CStringT<BaseType,StringTraits>::Format(const wchar_t *,...)' : cannot convert parameter 1 from 'const char [3]' to 'const wchar_t *' c:\generate_filesdlg.cpp 225
I am having problems with the UNICODE.
Because I am using CStringArray I seem to be having problems using functions like strtok() in the VS 2005 environment.
What I am trying to do is so simple, but in a mess with types!
Andy.
|
|
|
|
|
Most CRT string functions have a TCHAR.H generic string
type equivalent. Since CString is a generic string type
you should use generic string CRT functions.
Try _tcstok().
You may also want to look into using equivalent CStringT
methods instead of using CRT functions on CStrings.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi Mark, can you give me a few pointers as to use MFC C++ with UNICODE.
I was just using the following:-
CString str = _T("qwerty");
and then casting my way out of any problems.
I seem to have come unstuck.
Just need help with project options, header files and settings, if possible.
Many thanks,
Andy.
|
|
|
|
|
Andy202 wrote: Just need help with project options, header files and settings, if possible.
What do you mean? Either UNICODE is defined (via #define ) or it isn't.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Andy202 wrote: project options, header files and settings
MFC already uses the Generic-Text Mappings[^] so there's
no additional header files to worry about.
You can use the Configuration Properties/General/Character Set
project setting to choose Unicode or MBCS.
Andy202 wrote: a few pointers as to use MFC C++ with UNICODE
Since MFC uses CString, I prefer to use CStrings for all my strings.
If a CRT string function is needed (because there's no equivalent functionality
in the CString class) then it's easiest to use generic-text Routine Mappings[^]
instead of using the char specific CRT string functions.
This keeps all the code buildable regardless of whether it's a
Unicode or MBCS build.
Andy202 wrote: casting my way out of any problems
If you use the generic text stuff described above, you shouldn't
(very rarely at least) need casts. If the compiler complains, it
may be that you need to convert a string to the type expected.
Just remember Cstrings are wchar_t-based on Unicode builds, otherwise
they are char-based. If you need to force a CString to a specific type
regardless of the build configuration, then use the specific CStringA
or CStringW type.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Given below is the error generated by vc6. It is related to memory leakage but the problem is that no file name/ line number is mentioned. how can i find/rectify the exact place of error?
First-chance exception in TestApp.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.
Detected memory leaks!
The thread 0x3C0 has exited with code 0 (0x0).
The thread 0x3CC has exited with code 0 (0x0).
Dumping objects ->
The thread 0x660 has exited with code 0 (0x0).
{56984} normal block at 0x078ECFE0, 4 bytes long.
Data: < > 00 00 00 00
Object dump complete.
|
|
|
|
|
By using your debugger.
EDIT: maybe I misunderstood your question. The problem is only the memory leak, not the exception ? Because it seems you have an exception in your code, so it would be usefull to fix it.
modified on Thursday, September 4, 2008 10:40 AM
|
|
|
|
|
Cedric Moonen wrote: By using your debugger.
A very technically correct answer that ought to be useless, but if it turns out to be useful it becomes priceless.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Well, seeing his question, I don't see how I can give a more accurate answer
|
|
|
|
|
Cedric Moonen wrote: Well, seeing his question, I don't see how I can give a more accurate answer
Precisely, you're dead on, mate!
You got my 5'er for providing the most accurate answer I've seen today.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Try the Visual Leak Detector[^] by Dan Moulding.
It very useful and more accurate than I usually find VC6 to be.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
As far as I understood, the exception is the problem (first line)...
|
|
|
|
|
Cedric Moonen wrote: As far as I understood, the exception is the problem (first line)...
It is, but don't tell anyone.
The experience you get from following the wrong track because you didn't read the debugger output is also priceless.
First-hand exceptions rarely stops the execution, it just put an informative line in the debug output so I guess it's still about the memory leaks.
But I've guessed wrong before...
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
it can be step trough with the help of debugger , but it seems you
have multiple threads , so you need to have breakpoints .
also i recommand you to use try catch to avoid exceptions .
Check your thread function , before they exit you
are not deleting some memory allocated in the thread .
Vikas Amin
My First Article on CP" Virtual Serial Port "[^]
modified on Thursday, July 24, 2008 5:33 PM
|
|
|
|
|
Hi,
I am working on an MFC application where on click of a button some data is being fetched from the server and being diplayed in a CListCtrl
But as the data is coming from the server there is a bit of flickering.
So want i want to show a progress bar showing the message that the data is being loaded.
once data is displayed it should show message done.
Please help me.
Dhiraj
|
|
|
|
|
Dhiraj kumar Saini wrote: Please help me.
Since you are using MFC, have you looked at CProgressCtrl ?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
as far as flicker is concerened i think u r repopulating the list control again and again in a loop, this creates flicker, if this is the case create a flag variable and append only the latest data and not the whole data again and again.
--------------------------------------------------------------
if u want to use progress bar then u should know the total amount of data which u will receive from server that will be max limit 100% for progress bar. Increament the bar depending on amount of data received at each time. if u dont know total amount of data then simply display some animation untill process is finished.
|
|
|
|
|
Hi,
Actually the data received from the server is not fixed and is dynamic.
Can you give me any code of using a CprogresCtrl
|
|
|
|