|
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
|
|
|
|
|
what does the handle types exactly means...
|
|
|
|
|
it is a unique identifier for an object that the OS can manage/handle... hence its name
|
|
|
|
|
Reference : MSDN web pages
The [handle] attribute specifies a user-defined or "customized" handle type.
User-defined handles permit developers to design handles that are meaningful to the application. A user-defined handle can only be defined in a type declaration, not in a function declarator.
A parameter of a type defined by the [handle] attribute is used to determine the binding for the call and is transmitted to the called procedure.
|
|
|
|
|
manju23reddy wrote: what does the handle types exactly means...
A handle only makes sense to the module that created the handle.
Any client must not interpret the value of the handle, it's only use is to identify something that the library is operating on.
This is not specific to MFC or any other framework/library.
The data type HANDLE is usually a typedef'ed void* , which means that it is as wide as the processor architecture it executes in. An explicit type cast can be made inside the library without losing precision or bits to e.g. int .
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|