|
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?
|
|
|
|
|
Hmmm... I haven't had this problem but it seems like you're doing everything correctly. Have you tried stepping into the OpenEx function with the debugger to see where exactly the problem comes from?
|
|
|
|
|
Hello,
When opening a project in Developer Studio, the FileView pane of the Workspace normally shows the files in an alphabetical order.
Recently, I've seen in my workspace the opposite: the files are shown in a descending alphabetical order.
Does anyone know how to change this file representation back again to the ascending alphabetical order?
Thanks in advance,
Geert
|
|
|
|
|
I want to create a Common File Dialog, like the one in MFC, in my ATL COM component. I turned off "MFC Support" option to minimize the COM component size.
Is there any dialog class, like CFileDialog, in ATL to do that? Or is there any easy way to do that other than create my own file dialog?
Thanks,
Tony
|
|
|
|
|
You can use "GetOpenFileName"/"GetSaveFileName", They are Win32API methods that can be used to open/save a file respectively. If you are just browsing for a folder, you can use "SHBrowseForFolder" API method.
Hope it helps,
|
|
|
|
|