|
Hi, I'm still a bit new to MFC and I'm having a really silly problem with it.
I'm trying to make a dialog based program that will allow someone to pick a text file, the program loads it up and then there will be a list of things. No probs on getting to pick the txt file but what I need is for the program to be able to notice duplicate entries in the txt file and then pick one of them out, ignoring the rest of the duplicates.
Also, even sillier, I need to make something that displays a bunch of strings that contain text in them. I'm having the problem though that some of the strings that I need it to show contain things like
ReplyHello=/ :-: \
ReplyHelp=Help?
whenever I try to do a
CString m_something=(_T("ReplyHello=/ :-: \\nReplyHelp=Help?"));
I get errors about teh escape codes.
Any help for a lost soul? Thanks
|
|
|
|
|
carrie wrote:
I'm trying to make a dialog based program that will allow someone to pick a text file, the program loads it up and then there will be a list of things. No probs on getting to pick the txt file but what I need is for the program to be able to notice duplicate entries in the txt file and then pick one of them out, ignoring the rest of the duplicates.
Easy - let STL do the dirty work for you. If you store the information in an STL set, it will discard duplicates as you go. I've written an article on this, just search for 'graus map set' to find it. You can also read a text file into an STL container in just three lines of code - I show that in my STL articles as well.
I don't see anything wrong with the string you're setting, but if you're getting an escape code erro,r chances are you tried to insert a \, and forgot to put two of them, as \\ is the code for \, as \ denotes the begining of an escape code, such as \n for newline, or \r for return.
Don't feel silly, you should see some of the stuff I asked when I was starting. We all start somewhere.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
I'm trying to display ToolTips on one of my dialogs using
ON_NOTIFY_EX(TTN_NEEDTEXT, 0, OnToolTipNotification)
It only works for some of the controls. I've used Spy++, and the non-working controls just aren't firing the WM_NOTIFY message. Anyone know what to do about this?
(I have a couple of frames on the dialog - will that mess things up?)
|
|
|
|
|
This article may help.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
When I create a "MFC EXE" project with "Dialog Based" application I have at the begining 2 classes in it: Application class and Window class. When I add menu to the window and write message handler (for example OnExit) for menu item click, my window class disappears from the project! The source code files for that class are still in the project, but no class
After few seconds the application class follows the window class
Is that a bug for Visual C++ 6 IDE? How can I solve that problem?
Thank you.
Igor Urdenko
|
|
|
|
|
Class wizard is getting confued. You can normally solve this problem by deleting the projects .clw file. Then start up class wizard again and hopefully your class list will be restored.
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
I have removed *.clw file. In Class Wizard I can see my window class, but it is still not in ClassView... I am sorry, I am newbie, but how can I add new messages handlers to my class if it is not in ClassView?
Thank you.
Igor
|
|
|
|
|
To add message handlers manually, for each you need to add a prototype
afx_msg void OnMyNewHandler()
This needs to go before the DECLARE_MESSAGE_MAP macro in the .h file.
Add a message map entry in the .cpp file
ON_COMMAND(IDC_OF_COMMAND, OnMyNewHandler)
Add the function
void CMyClass::OnMyNewHandler()
{
}
If you need to put in an update handler
afx_msg void OnUpdateMyNewHandler(CCmdUI *pCmdUI) ;
ON_UPDATE_COMMAND_UI(IDC_OF_COMMAND, OnUpdateMyNewHandler)
void CMyClass::OnUpdateMyNewHandler(CCmdUI *pCmdUI)
{
pCmdUI->Enable(...) ;
}
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
Thank you for the help provided.
Ingvar
|
|
|
|
|
.CLW is the file for ClassWizard; and .NCB is the file for ClassView. You should close the project, delete the .NCB file, then open the project again.
Visual C++ doesn't handle template really well. When I add some function templates or template classes, ClassView would behave abnormal. And sometimes syntax error causes such condition, too.
Feel free to delete .ncb files!
|
|
|
|
|
Yes! It works! Thank you very much for that help!
Igor
|
|
|
|
|
Maxwell Chen wrote:
.CLW is the file for ClassWizard; and .NCB is the file for ClassView
Rats! I should have known that!
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
Well,
the tli and tlh files are loaded into a project that creates a dll file.
these files are from another project that creates a com object using ATL.
I can not edit them! if I try to edit them in the dll project and then "duild all" then they are reloaded from somewhere by the visual c++ compiler and thus get their previous data.
How can I edit them?
Thanks a lot,
Aviv.
avivhal
|
|
|
|
|
Aviv Halperin wrote:
I can not edit them!
Aviv Halperin wrote:
How can I edit them?
You've answered the question - you cannot. The type libraries contain the stuff that your project needs to access your COM object and build smart pointers etc. Why would you want to change them instead of the COM object directly ? If you don't have access to the code to build the object, then you cannot change it. I'd have thought that was blindingly obvious.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
Well,thats what I thought.
I did change the com object's code but strangly enough the tli tlh files don't change.
I guess I have to check my project definitions to find out where does the compiler load them from.
Thanks anyway,
Aviv.
avivhal
|
|
|
|
|
hi,
how would i go about setting up a 26 by 26 array?
any code would be good
thanks
|
|
|
|
|
int arrayUninit[26][26];
int arrayInit[26][26] = {
{ 0, 1, 2, ..., 25 },
{ 0, 1, 2, ..., 25 },
...
};
memeset(arrayUnint, 0, 26 * 26 * sizeof(int));
for (int x = 0; x < 26; x++)
for (int y = 0; y < 26; y++)
arrayUninit[x][y] = ...;
|
|
|
|
|
hi dose it matter where i declare it?
|
|
|
|
|
hi:
where to get the windows xp style icons(the icons for system ,toolbar..)?I want to use it in my own application,I think it is cool.
thanks
benben
|
|
|
|
|
try http://www.iconbuilder.com/
Gaurika Wijeratne. // www.gaurika.com
|
|
|
|
|
Extract icons from your hard driver.Many different file types on your computer contain one or even many icons that you can use.
Icon Searcher v1.52 :
http://www.yxhome.com/softplus/index.htm
|
|
|
|
|
Hi,
I have three questions,
1.What happens when several threads use the same DLL?
2.race condition takes place during above situation?
3.The usage of TLS in thread and DLL.
Plz in detail.
Thank you.
Best regard.
I confess that I am a stubborn guy, but why not put things thoroughly, logically and systematically clean. One concrete prolem is worth a thousand unapplied abstractions.
|
|
|
|
|
1. Nothing special. The DllMain entry point is called for each newly created thread with fdwReason set to DLL_THREAD_ATTACH .
2. No race conditions occur as calls to DllMain are serialized by the system. As a corollary, threads cannot be created inside DllMain .
3. TLS routines can allocate and deallocate indexes that are local to each running thread. These usually are used to map some dyamically allocated memory. Check MSDN article Using Thread Local Storage for details.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi,
I have a DLL, and i want that in some function
it shows a small dialog box (actually with just a
password edit box and a button) and is displayed
whenever i want..
How can i do that..
Sameer
|
|
|
|
|
hi
i download the class that in 'codeproject.com/database' and when i added the ado.h and ado.cpp to my program the following error occures:
"fatal error C1010: unexpected end of file while looking for precompiled header directive"
the file that indicated in error is ado.cpp
any help!!!
Best Regards
|
|
|
|