|
Sir
i have also asked that how to display an icon with the items of listview .... and that was the main question..
Regards
Nauman Ghazi
Bahria University
|
|
|
|
|
Use the LVS_ICON or LVS_SMALLICON style.
|
|
|
|
|
So I have a class that does not make use of MFC/Windows code in any way, though I sometimes use it in MFC projects. However, when I do use the class in an MFC project, VS.net complains that there is no '#include "stdafx.h"' line in the .cpp file of the class. Likewise, if I add the line to my file and use the class in a non-MFC project, as you would expect, I get a 'cannot find file "stdafx.h"' (since it doesn't exist in the non-MFC project.)
Today I tried to remedy this situation by adding an #ifdef at the beginning of the .cpp file as follows:
#ifdef WINVER
#include "stdafx.h"
#endif
... other includes
... implementation of class
However, if I add this code (at the very beginning of the file) VS.Net chokes with "fatal error C1020: unexpected #endif".
Any ideas?
--Dean
|
|
|
|
|
Probably your best option is not to include any #include <stdafx.h> and, when compiling into an MFC project, change the settings of the .cpp alone to "not using precompiled headers".
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Do not include atdafx.h in you file. Instead (1) goto projects->settings (2) select all configurations (3) select you file from tree view (4) select C/C++ tab (5) from drop down box select precompiled headers (6) check not using precompiled headers.
Now when you compile while using MFC you will not gett the error about finding end of file while looking for precompiled header.
Trust in the code Luke. Yea right!
|
|
|
|
|
Thanks to both of you... I had not even thought of that. I am still puzzled as to why I am getting this error, though. The #endif is not unexpected -- it matches the #ifdef and there is no other possible text beforehand to provide an unbalanced #if* #endif pair.
--Dean
|
|
|
|
|
The way PCHs are implemented in Visual C++, the compiler igoners everything up to the infamous #include <stdafx.h> line, which explains the unbalanced #endif .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Dean Goodman wrote:
Likewise, if I add the line to my file and use the class in a non-MFC project, as you would expect, I get a 'cannot find file "stdafx.h"' (since it doesn't exist in the non-MFC project.)
That is so not true. It's about precompiled headers, and have nothing to do with MFC.
If you make a new ATL project, in VC, you also get stdafx.h and .cpp
I use precompiled headers in all my projects, even console applications because it speeds up the compile time.
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
What I really meant was that when you create an MFC project (or ATL -- I wouldn't know since I never create this type of project), VS defaults to using a precompiled header. If you create a console application, precompiled headers are not used by default.
I didn't mean to say that PCH's are specific to MFC. I just usually don't mess with that stuff -- I usually want to get my work done quickly .
--Dean
|
|
|
|
|
Dean Goodman wrote:
I didn't mean to say that PCH's are specific to MFC.
Ok, sorry, then I misunderstood you
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Wouldn't it just be easier to create a .LIB containing the functions and link to it, rather than messing with the source code every time you use it? No hassle, just #include the .h file and set your linker libs line to include the .lib file. Also, one point of maintenance across all projects that use it.
|
|
|
|
|
I have a simple MFC Richedit in my dialog based program.
I don't use unicode programming in my MFC, because I don't know how!
I am writing a utf-8 -> ASCII converter. It gets the unicode text from a richedt window and takes away initial "" characters and the rest must be read as simple ASCII characters...
However when in program, the text from the rich edit is read (that iis in unicode, e.g. سال) based on this program:
void CSecondDlg::OnBUTTONtoUTF()
{
CString text_str1;
GetDlgItemText(IDC_RICHEDIT1, text_str1);
It just shows this "?????", while it should show: "سال"
I really don't know how can I just read such simple string!
Please somebody help me.
|
|
|
|
|
Are you using the UNICODE preprocessor directive?
Does the following produce anything different:
void CSecondDlg::OnBUTTONtoUTF()
{
TCHAR text_str1[128];
GetDlgItemText(IDC_RICHEDIT1, text_str1, sizeof(text_str1));
}
I'm not up on UNICODE either so this is just a guess.
|
|
|
|
|
I am sorry but my project setting is not using unicode. However as you know in win2k you can switch back to the different language and when you run the program, fortunately it shows unicode characters in richedit.
I don't use the UNICODE preprocessor directive and I don't know also what is that! Initially my VC project is a simple MFC. Is it too late to change it to a unicode support? and how can I do that?
WIth the code you wrote, still when I debug my program, for the string which is in unicode, "سال", and is equal to "سال", the GetDlgItemText returns "???"
BTW, I have used GetDlgItemTextW(hwnd,IDC_RICHEDIT2, text_str1, sizeof(text_str1)); instead of GetDlgItemText, where I couldn't initialize hwnd. I used WCHAR_t text_str1[128]; or WCHAR text_str1[128]; and program run but none of these method could help until the richedit return the ascii!
Is there any method than GetDlgItemText to grab any character typed in the richedit one by one?
So this question is still open.
|
|
|
|
|
I am looking for a good search class for c++.
Know of any?
I need to search in CString arrays for certain words.
I am developing in ms vs6.0.
Thanks
Later, JoeSox www.humanaiproject.org
"Imagination is more important than knowledge."
-Albert Einstein (INTP)
|
|
|
|
|
|
DavidCrow wrote:
Use CString::Find().
duh sometimes it's right under your nose.
I might have asked the wrong question.
You don't know of any classes that searches text files too?
I have tried searching but nada.
see, I have text files with sentences but I want to the program to grab only valid sentences. I was going to search the sentences for nouns and verbs(also text files)
Thanks
Later, JoeSox www.humanaiproject.org
"Imagination is more important than knowledge."
-Albert Einstein (INTP)
|
|
|
|
|
Somebody please help me get the number of files that we select using CFile Dialog and by using the OFN_ALLOWMULTISELECT attribute into a variable or something. I can get the path but I want to get the no. of files selected. Please help
|
|
|
|
|
Just parse the returned string.
|
|
|
|
|
// Here you go
void CFoo::OnFileOpen()
{
CFileDialog dlgFile(true, _T("*.txt"), NULL,
OFN_HIDEREADONLY | OFN_FILEMUSTEXIST| OFN_ALLOWMULTISELECT,
_T("Text Files: (*.txt)|*.txt"));
CString title;
VERIFY(title.LoadString(AFX_IDS_OPENFILE));
CString fileNames;
dlgFile.m_ofn.lpstrTitle = title;
dlgFile.m_ofn.lpstrFile = fileNames.GetBuffer(_MAX_PATH * 10);
dlgFile.m_ofn.nMaxFile = _MAX_PATH * 10;
if( dlgFile.DoModal() == IDOK )
{
POSITION pos = dlgFile.GetStartPosition();
while (pos)
{
if( !OpenDocumentFile(dlgFile.GetNextPathName(pos)) )
break;
}
}
fileNames.ReleaseBuffer();
}
Trust in the code Luke. Yea right!
|
|
|
|
|
I am trying to access a pop3 exchange server through MFC using the CSockets class. I am able to connect to the server and get a positive response but when I try to give it the username and password it chokes. I am giving it the user name in the form domain\ntAccount\mailbox. Does anyone have any idea why it doesn't like this??
PLEASE HELP!!!
thanxs in advance
cc
|
|
|
|
|
ibiteu2 wrote:
Does anyone have any idea why it doesn't like this??
Yes, it's not the POP3 standard!
Take a look at RFC1939 which defines POP3
http://www.faqs.org/rfcs/rfc1939.html[^]
A hint:
You start with "USER <username>"
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
The pop3 standard is
USER mailbox
got ok from the server
PASS user password
got -ERR from server
I already tried that and it said I had a bad username or password, any other ideas??? Do I need to encode it or something???
|
|
|
|
|
Your username and/or password is incorrect...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Thanxs but I figured it out,,, I needed to be using the T2A macro on my strings before I sent them.
Thanxs for the help.
|
|
|
|