|
Mike Dunn's suggestion started me thinking about the order of things adn I found the solution. I was calling GetRichEditCtrl().SetFont( m_EditorFont ) to set the font immediately *after* calling SetDefaultCharFormat(). Apparently, SetFont() set my font characteristics correctly, but reverted the color to the default system color since the LOGFONT has no provision for color information.
There are 2 ways to fix this: 1) set all the font info in the CHARFORMAT struct and skip the SetFont() call, or 2) call SetFont() *before* calling SetDefaultCharFormat(). I did method 2 to get a quick result. When I did this, the text color automatically changed for all the text *already* in the control, which is the behavior I wanted. I called these methods from the CRichEditView's OnInitialUpdate() method.
Thanks to Mike Dunn for providing the spark to figure this out!
Mike Newberry
|
|
|
|
|
i:\eldis3\bib_source\eurodialoge\errdlg.h(47) : warning C4251: 'm_text' : class 'CString' needs to have dll-interface to be used by clients of class 'ErrDlg'
c:\programme\microsoft visual studio\vc98\mfc\include\afx.h(368) : see declaration of 'CString'
Since I use a lot of lib's (dll's) I get this warning for nearly everything I am exporting.
I can't see any problems with this warning (There are (I hope so) no problems at runtime) but I want to get rid of
these endless warnings at compile time.
Does anyone know from where these warnings are coming?
Does anyone know how to get rid of these warnings?
Thank you...
|
|
|
|
|
Well, you could use
#pragma warning(disable:4251)
But I think this is a warning based upon some other problem you are not diagnosing.
My suspicion is that you might have some of your DLL statically linked to MFC and some are dynamically linked.
Good luck! I was just at a location where they had mixed and matched them with VC 5.0, and wow! did things really go crazy when the VC 6.0 was first used. Had to go through all modules of all related projects and settle on one type or another.
|
|
|
|
|
In the header file for each class in your DLL, specify AFX_EXT_CLASS just before the name of the class and then the whole class will be exported.
ie.
class AFX_EXT_CLASS CErrorDialog : public CDialog
{
//..
};
and then remove any and all export stuff you have anywhere else for that class.
Brian
|
|
|
|
|
Situation:
There is one machine (host) to which number of other machines (subscribers) want to establish connection over Internet. None of the subscribers is under the same domain as host. The idea is that the subscribers could establish as much real-time communication link over Internet to the host, which can only relay on Internet connection. The communication would mostly involve text base exchange.
Question:
I would use some guidelines on how to construct a solution, Windows Sockets, RPC SDK, anything else please suggests. Is it possible? I would also appreciate any samples that you many know off.
Thanks in advance.
|
|
|
|
|
Hi,
You'd need a program which uses winsock to register on a certain port,
then reads the requests from the clients, parses them, connects to the internet, creates new requests and sends
them to the internet servers, gets back its data, removes the header data, sends back the data to the
client programs. And then goes on listening on its port for the next client.
Just an idea...
Chris.
|
|
|
|
|
Hi,
I have a Single Doc, Multiple views Application and I have a Menu option called "options" which accepts the Default location to Save Files.
How do I set the Default Location ?What is the Function used and How do I use it? so that, when the user says File->Save, it should show the deafault directory to save the
file.
Any Suggestions...
Thank you
Priya
|
|
|
|
|
Try this code
[CODE]
OPENFILENAME ofn;
char defaultFileName[MAX_PATH + 1] = "Default file name";
char szFileTitle[MAX_PATH + 1];
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = NULL;
ofn.hInstance = GetModuleHandle(NULL);
ofn.lpstrFilter = "All Files (*.*)\0*.*\0\0";
ofn.lpstrCustomFilter = (LPTSTR) NULL;
ofn.nMaxCustFilter = 0L;
ofn.nFilterIndex = 1L;
ofn.lpstrFile = defaultFileName;
ofn.nMaxFile = sizeof(defaultFileName);
ofn.lpstrFileTitle = szFileTitle;
ofn.nMaxFileTitle = MAX_PATH;
ofn.lpstrInitialDir = "C:\\DefaultDir";
ofn.lpstrTitle = __TEXT("Save Da Doc as...");
ofn.nFileOffset = 0;
ofn.nFileExtension = 0;
ofn.lpstrDefExt = NULL;
ofn.lCustData = 0;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY |
OFN_EXPLORER | OFN_LONGNAMES;
int result = GetSaveFileName(&ofn);
if (result == IDOK) {
MessageBox(defaultFileName,"Full Path is ");
MessageBox(szFileTitle,"File Name only is ");
}
[CODE]
Note There is also easier ways with MFC ...
Hope It will help
ALfadhly
|
|
|
|
|
SetCurrentDirectory
The SetCurrentDirectory function changes the current directory for the current process.
BOOL SetCurrentDirectory(
LPCTSTR lpPathName // pointer to name of new current directory
);
Parameters
lpPathName
Pointer to a null-terminated string that specifies the path to the new current directory. This parameter may be a relative path or a fully qualified path. In either case, the fully qualified path of the specified directory is calculated and stored as the current directory.
Return Values
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
Remarks
Each process has a single current directory made up of two parts:
A disk designator that is either a drive letter followed by a colon, or a server name and share name (\\servername\sharename)
A directory on the disk designator
|
|
|
|
|
SetCurrentDirectory
Changes the current directory for the current process
This means that if your program is writting to temporary files or reading from other files you will be effecting the location of all subsequent File I/O operations which you don't specify the Exact Directory location for.
Do you really want to do that.?
Alfadhly
|
|
|
|
|
No this means that you do a GetCurrentDirectory SetCurrentDirectory, do your file saving and return to the directory that you retrieved with GetCurrentDirectory.
But anyway, as you never can be sure what the current directory is, unless you set it yourself,you should never try to read/write without an exact directory location and temorary files should go into the TEMP variable or the winnt\system.
|
|
|
|
|
You will be pleasantly surprised to find that Windows Terminal Services Edition might prevent you from writing altogether to the Windows\System folder.
There is a call to obtain the temporary directory that should be used, I think it is GetTempDirectory().
Since Windows 2000 might allow multiple logons, I have noticed that the temporary directory is different for each user.
|
|
|
|
|
True Blake,
This is the same reason a copy of Office 97 will not work on Win2000
|
|
|
|
|
Hello!
Does anyone know of a NewsReader app (in C++ with MFC, preferably) with source code or of any sample that shows the basic steps to take when developing a NewsReader? I'd like to do exactly that but don't have a starting point.
Thanks in advance.
Matthias
|
|
|
|
|
I found a NNTP class online somewhere. Although, I can't remember where online, I do have it on my HD at home. If you like, I could email it to you.
Cheers,
Frank
|
|
|
|
|
That would be very helpfull!
Matthias
|
|
|
|
|
Frank,
Would you happen to be able to send that source to me too, or post it on The Code Project for everybody to benefit from please!
Thank you very much!
Brian Hart
|
|
|
|
|
If you are looking for a starter point.
See the NNTP standared # 1036 from IETF (Internet Engineering Task Force)
[URL]http://www.ietf.org/rfc.html[/URL}
Get familar with the general functionality process by testing and trying the many activeX version available with Visual Studio such as NetManage NNTP Control. (Not sure if they still free with VC 6, they Free with VB 4 & 5)
If you also program in Delphi or Builder see ICS from Francois PieTTe , Never tried it but home page says it is FreeWare.. (gulp) or Download Dundas's Evaluation for the The ActiveX version of thier Ultimate TCP. Or Get the source from them. Thier Docs says they have support for (NNTP) or the news reader thingy.
Matthis,
I have question, Do you see the NNTP Protocol to have any life in the next two years or so. Although I am big on following news groups and reading the postings other programmers post all over the net. I rarly use My Outlook express for that. I simply go to specific web sites such as Dejanews , and make the search.
The only time I would prefer to use The news readers is to download the files attached to the posting.
And Perhapse to test how effecient is my Anti-Viruse program
I think USENET is being replaced by Message board like Code project , and others
Wow, that was a long posting
I just wanted to share my thoughts with you
Alfadhly
|
|
|
|
|
Well,
some guy from Dundas has straightly mailed me with a link to their page. I'd like to write the newsreader to test my programming skills (yes, I'm in the C++ club for only 8 month). So the Dundas solution is too big for my wallet.
Unfortunately I don't have the C++ Builder (eventhough I would like to try it!). So this is no option.
Frank has said he's seen somewhere a sample he could send me. I'll have a look at it and come back if needed.
As for your question, on of the reasons why I want to write a simple Newsreader is that I got fed up of Outlook express. I mean, this application is really not worth the trouble. It's neither userfriendly nor reliable and I simply don't use it anymore. I've found a shareware NewsReader called Gravity (if somebody is interested I'll post a link), which does a much better job, but with an interface that screams for redesign.
Generally I think that newsgroups will not be replaced quickly by their http equivalents (message boards, like this one). I believe this for the following reasons:
1. I think that there are still alot of people that can't afford to be online to browse, read and answer their mail. I have a 56K modem and I still find it a pain in the butt to download the asp's.
2. The codeproject messageboard is one of the best ones I've seen around. Not many of them are at such a hight standard.
3.A good NewsReader should make it an easy task to archive messages in a structured manner so that you can build yourself a small knowledge base. This is my aim with my variation of such an app.
But this is my personal opinion only.
Best wishes,
Matthis
|
|
|
|
|
well welcom to the club,
( /ME C/C++ >= 10 Yrs on and OFF ),
However, I believe that you well have a *very**Interesting**Test
If I can give you general guideline on what are the land marks of the News Reader.
....
Here is what technologies and protocols you need to consider for the general functionality of Your News Reader.
Network communication with the server (Winsock or WinInet)
NNTP Protocol , to be able to speak the servers Language (RFC 1036)
Message Format parssing (RFC 822)
Attachment Decoding Using MIME (RFC 1521-23 & 2045-2049) , or Unix To Unix Encoding () .
if you are going to add Send to author feature you will need an SMTP (Simple Mail Tranfer Protocol) RFC 821 support.
gui , you'r on your own , I am sticking to console appsMatthis, If I can be of help. in any of these areas (Other than the GUI , ) I will be happy to help on this site.
P.S. NNTP RFC is not a standard yet, 997 is not a standard yet. I guess 14 years is not enough time to come to a common ground for the decision makers lol
.
Cheers
Alfadhly
|
|
|
|
|
Hi,
We do have everything that you mentioned in your list and even more in out Ultimate TCP/IP 3.0 product. You can get the ActiveX control version or the C++ source code. Check our web site at www.dundas.com. We also have an evaluation version of the ActiveX controls that you can try first.
Regards,
Alex Gorev,
Dundas Software.
|
|
|
|
|
Alex,
For your information you employee-of-a-robber-baron,
Dundas' stuff is pret-ty pricey, and is definitely a motivator for a lot of people to do it themselves.
Please please please refrain from posting messages like this in this forum -- it's unproductive. If you don't have any help for people other than to refer them to big expensive software, then I would suggest posting to newsgroups... oh, wait; they hate advertisers too!
Anyone who uses The Code Project knows about Dundas' stuff because their are billboard ads placed around for it everywhere; Chris Maunder is such a Dundas prostitute sometimes.
Anyway, just wanted to pass along a helpful tip
Brian Hart
|
|
|
|
|
Just, Thought I'd butt in here
Hmmm . The thought of Newsgroups dissapearing is interesting, I prefer both forumns and NGs, Its really the content that gives them value. Personally I still find Site-Forumns "slow".
NNTP seems to serve up the info so-much faster,(probably due to ISP caching) The downside is messages are cleared by the administrator.
What would be interseting would be a client-side Combination of the two technologies.
Imagine a client "ActiveX that is actually a Newsreader"
embedded on a HTML or ASP etc webpage, Possibly it could provide the best of both worlds. Webpage styling and links, whilst still being text-based, and NewsReader retrieval speed through the NNTP protocol. Something like this could breath new life into NewsGroups.
I realise this forum isn't the place to post this sort of thing, But I couldn't resist the oportunity to throw my 2 cents in.
Regardz
|
|
|
|
|
What should I do if I want to programatically register my application to handle one type of file?
Thanks,
Tony
|
|
|
|
|
I've written a dll using ATL. It uses CDatabase to read values from a database. Everything works fine in a standard MFC app, but when I moved the code into a ATL/COM project it fails with the following error:
"Only SQL_DRIVER_NOPROMPT is allowed when connection pooling is enabled"
I access my database with the following, which according to MS Knowledge Base should solve the problem, but it doesn't:
...
if(db->OpenEx(m_strConnection, CDatabase::noOdbcDialog))
...
Anyone had this problem?
|
|
|
|