荔园在线

荔园之美,在春之萌芽,在夏之绽放,在秋之收获,在冬之沉淀

[回到开始] [上一篇][下一篇]


发信人: tang (独孤九剑), 信区: Program
标  题: MSVC Digest - 22 May 1998 to 23 May 1998
发信站: BBS 荔园晨风站 (Mon May 25 18:12:36 1998), 转信

There are 11 messages totalling 590 lines in this issue.

Topics of the day:

  1. DOH!
  2. Sockets
  3. How to draw a char in the left margin area of the CEdit control?
  4. Logical and Device Coordinates :-(
  5. MapMode
  6. M$ MFC vs. Bolands OWL
  7. Test message (was Re: A test message) (4)
  8. Test message (was Re: Test Message - Please ignore)

--------------------------------------------------------------------------
The MSVC list is hosted on a Windows NT(TM) machine running L-Soft
international's LISTSERV(R) software.  For subscription info and archives,
see http://peach.ease.lsoft.com/archives/msvc.html .  For LISTSERV sales
information, see http://www.lsoft.com or write to SALES@LSOFT.COM.

----------------------------------------------------------------------

Date:    Sat, 23 May 1998 09:23:49 +0530
From:    Shakthimani <shakthi@USA.LTINDIA.COM>
Subject: Re: DOH!

This is a multi-part message in MIME format.
--------------0D9C03A4C1E2F84D000D4251
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

helo,
i dont know much about winsock1.1 but i think you can download winsock2.0 from
microsoft site free.
bye
shakthi

Ramonator wrote:

> I don't have Winsock2, is the code pretty much the same for Winsock
> 1.1???
>
> --------------------------------------------------------------------------
> The MSVC list is hosted on a Windows NT(TM) machine running L-Soft
> international's LISTSERV(R) software.  For subscription info and archives,
> see http://peach.ease.lsoft.com/archives/msvc.html .  For LISTSERV sales
> information, see http://www.lsoft.com or write to SALES@LSOFT.COM.



--------------0D9C03A4C1E2F84D000D4251
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Shakthimani .L
Content-Disposition: attachment; filename="vcard.vcf"

begin:          vcard
fn:             Shakthimani .L
n:              .L;Shakthimani
org:            Larsen&Toubro Information Technologies Ltd
adr:            SakiVihar Road,Powai;;;Mumbai;Maharastra;;India
email;internet: shakthi@usa.ltindia.com
title:          Software Engineer
tel;work:       8581401/1411
tel;home:       7663088
x-mozilla-cpt:  ;0
x-mozilla-html: FALSE
version:        2.1
end:            vcard


--------------0D9C03A4C1E2F84D000D4251--

------------------------------

Date:    Sat, 23 May 1998 13:03:50 +0530
From:    Sumit Singh Rana <sumitran@GIASDLA.VSNL.NET.IN>
Subject: Re: Sockets

This is a multi-part message in MIME format.
--------------9C77438420E27641F897C283
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

here's another piece of code to write a daemon. The handling part is not
very elegant but it will give u an idea. It uses Blocking call. For non-
blocking calls, check out ioctlsocket(). Hope this helps

** This program is supposed to be a Win32 console app.



Ramonator wrote:
>
> This may sound way lame, but can anybody take me step by step sort of on
> how
> to create and bind a socket and then send data and receive it?
> I would greatly appreciate any help.
>
> thanks
>
> --------------------------------------------------------------------------
> The MSVC list is hosted on a Windows NT(TM) machine running L-Soft
> international's LISTSERV(R) software.  For subscription info and archives,
> see http://peach.ease.lsoft.com/archives/msvc.html .  For LISTSERV sales
> information, see http://www.lsoft.com or write to SALES@LSOFT.COM.
--------------9C77438420E27641F897C283
Content-Type: text/plain; charset=us-ascii; name="main.cpp"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="main.cpp"

#include <iostream.h>
#include <stdio.h>
#include <stdlib.h>
#include <winsock.h>
#include <winbase.h>
#include <fstream.h>
#include <string.h>

#define BACKLOG 10 // ten requests at a time
#define FINGER_PORT     79

int SendFile(SOCKET fc, char* fname)
{
        FILE* fp;
        char ch;

        fp = fopen(fname, "rb");
        if(!fp)
                return 0;

        ch = fgetc(fp);
        while (!feof(fp))
        {
                send (fc, &ch, 1, 0);
                ch = fgetc(fp);
        }

        return 1;
}


void SendDataToClient(SOCKET fc, char* Buffer, int n)
{
        char Buf[1024];
        char UserName[1024], UserNameFile[1024];
        fstream ifs;
        int i = 0;

        Buffer[n] = '\0';

        if(!SendFile(fc, "welcome.plan"))
        {
                sprintf (Buf, "fingerd\r\n");
                send(fc, Buf, strlen(Buf), 0);
                return;
        }

        if (Buffer[0] == 10 || Buffer[0] == 13)
        {
                // send host info
                if (!SendFile(fc, "host.plan"))
                {
                        sprintf (Buf, "Host info not available. Try later\r\n");

                        send(fc, Buf, strlen(Buf), 0);
                }
        }
        else
        {
                // send user info
                while ((Buffer[i] != 10) && (Buffer[i] != 13))
                {
                        UserName[i++] = Buffer[i];
                }
                UserName[i] = '\0';
                sprintf(UserNameFile, "%s.plan", UserName);

                if (!SendFile(fc, UserNameFile))
                {
                        sprintf (Buf, "%s: No plan\r\n", UserName);
                        send(fc, Buf, strlen(Buf), 0);
                }
        }
}

DWORD HandleClient(LPDWORD data)
{
        SOCKET fc;
        char Buffer[BUFSIZ];
        int n;

        fc = *data;

        // read data from the client
        n = recv(fc, Buffer, BUFSIZ, 0);
        switch(n)
        {
        case 0: // connection ended
                break;

        case SOCKET_ERROR:
                // cout << "Could not handle socket\n";
                break;

        default:
                SendDataToClient(fc, Buffer, n);
        }

        closesocket(fc);
        return 0;
}

void BindToPort()
{
        SOCKET fd, fc;
        sockaddr_in addr;
        sockaddr caddr;
        DWORD ThreadID;
        int nAddrLen = sizeof(sockaddr);

        fd = socket(AF_INET, SOCK_STREAM, 0);

        addr.sin_family = AF_INET;
        addr.sin_port = htons(FINGER_PORT);
        addr.sin_addr.s_addr = htonl(INADDR_ANY);

        if (bind(fd, (LPSOCKADDR)&addr, sizeof(addr)) == SOCKET_ERROR)
        {
                cout << "Could not bind to port 79.\n";
                exit(0xff);
        }

        if (listen(fd, BACKLOG) == SOCKET_ERROR)
        {
                cout << "Could not listen on the port.\n";
                exit(0xff);
        }

        for(;;) //forever
        {
                fc = accept(fd, &caddr, &nAddrLen);
                if (fc == INVALID_SOCKET)
                {
                        cout << "Could not connect to a valid socket.\n";
                }
                else
                {
                        // start a new thread to handle this
                        CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)HandleClie
nt,
                                                &fc, 0, &ThreadID);
                }
        }
}

void Startup()
{
        WSADATA WSAData;
        int nRc;

        nRc = WSAStartup(0x0101, &WSAData);
        if(nRc)
        {
                cout << "Could not initialize winsock.\nCheck if it is ins
talled\n";
                exit(0xff);
        }

        BindToPort();
}

void main()
{
        Startup();
}

--------------9C77438420E27641F897C283--

------------------------------

Date:    Sat, 23 May 1998 06:07:13 -0700
From:    Patrick Huang <huanghe_01@YAHOO.COM>
Subject: Re: How to draw a char in the left margin area of the CEdit control?

Hi,
See the online help of VC5.0 for:
void SetMargins( UINT nLeft, UINT nRight ),
this maybe can help you.





---zeping  wrote:
>
> Thanks for the help of my background color question first. Now it's
OK.
>
> But there is another question needs your help. That is how to draw a
> char in the left margin area of the CEdit control? In VC edit
window, it
> can mark all the lines which contains the finding string? How to do
> this?
>
> Thanks for your help in advance.
> zeping
> zping@iname.com
>
>
--------------------------------------------------------------------------
> The MSVC list is hosted on a Windows NT(TM) machine running L-Soft
> international's LISTSERV(R) software.  For subscription info and
archives,
> see http://peach.ease.lsoft.com/archives/msvc.html .  For LISTSERV
sales
> information, see http://www.lsoft.com or write to SALES@LSOFT.COM.
>

_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com

------------------------------

Date:    Sat, 23 May 1998 16:29:53 +0100
From:    Alberto Monteiro <albmont@CENTROIN.COM.BR>
Subject: Logical and Device Coordinates :-(

Is there any easy way to get around the confusion with logical and
device coordinates? Any time I try to write anything I use the wrong
one :-(

Alberto Monteiro

------------------------------

Date:    Sat, 23 May 1998 18:04:58 +0100
From:    Alberto Monteiro <albmont@CENTROIN.COM.BR>
Subject: MapMode

I use the SetScrollSizes(MM_LOMETRIC, mysize) in the OnInitialUpdate member
of a ScrollView-derived class. Latter, I never again change or set the MapMode.
But in the MyView::OnLButtonDown, I try to recapture the MapMode, using

CDC *pDC = GetDC();

and

mapmode = pDC->GetMapMode();

To my horror, it returns MM_TEXT !!! Why?

Alberto Monteiro

------------------------------

Date:    Sat, 23 May 1998 20:23:25 -0500
From:    "Michael J. C. Gorecki" <MJGorecki@EARTHLINK.NET>
Subject: M$ MFC vs. Bolands OWL

I have been programming in Visual C++, using MFC. I do not use J++, but use
J-Builder. I was looking at trying Borlands C-Builder Pro. Does anyone out
there use C-Builder using MFC?

I have been in products that use many different API/Class libraries. Many
clients I come across prefer MFC, and though C-Builder says it can use it &
OWL, among others. Sometimes I might need C-Tree. I have even had to use
old XVT. But, Visual C++ does not seem to integrate well w/other manf.
libraries. If I need to get to a "stranger" API, I would like to look at
C-Builder.
--
Mike J. C. Gorecki
plaNet 2000 Software Inc. - Omaha, NE
MJGorecki@earthlink.net / ICQ #12660507
"I am not paranoid, the truth is out there."

------------------------------

Date:    Sat, 23 May 1998 23:00:51 -0400
From:    Laurence Roberts <laurenofis@CSI.COM>
Subject: Test message (was Re: A test message)

At 10:08 AM 1/12/1998 +0000, you wrote:
>Hi Bill,
>
>I have well received your message.
>
>Have fun,
>
>Nicolas Bourdin.
>
>-----Message d'origine-----
>De : Bill Campbell <dcampbell@CCGATE.HAC.COM>
>=C0 : MSVC@PEACH.EASE.LSOFT.COM <MSVC@PEACH.EASE.LSOFT.COM>
>Date : vendredi 9 janvier 1998 22:15
>Objet : Re: A test message
>
>
>>I got it.
>>
>>______________________________ Reply Separator
>_________________________________
>>Subject: Re: A test message
>>Author:  Microsoft Visual C++ programmers list <MSVC@PEACH.EASE.LSOFT
.COM>
>at
>>CCGATE
>>Date:    1/9/98 9:07 AM
>>
>>
>>Matthew, mail command "set msvc repro" to
>>LISTSERV@PEACH.EASE.LSOFT.COM
>>and you will receive your own postings.
>>At works for me, at least.
>>
>>Volker
>>
>>
>>Matthew Kenny wrote:
>>
>>> Hello. If this has reached the list server and can be read by anyon
e
>>> could you please reply?  I'm not sure if my messages are reaching y
ou (
>>> its my first time :-<);
>>>
>>> m.d.kenny
>>> m.kenny@ymi.co.uk
>
Your response to this test message has been received.




=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Laurence Roberts, M.S.
Information Resources Director
Mental Health Care, Tampa, FL           University of South Florida
813-272-2878 X375 (work)                        St. Petersburg Campus / Tampa Ca
mpus
813-272-2654 (FAX)

ISM 3230 Instructor
Page-- http://www.stpt.usf.edu/coba/faculty/roberts
email: roberts@bayflash.stpt.usf.edu

------------------------------

Date:    Sat, 23 May 1998 23:00:19 -0400
From:    Laurence Roberts <laurenofis@CSI.COM>
Subject: Test message (was Re: Test Message - Please ignore)

At 08:57 AM 1/12/1998 -0500, you wrote:
>test
>
Your response to this test message has been received.




================
Laurence Roberts, M.S.
Information Resources Director
Mental Health Care, Tampa, FL           University of South Florida
813-272-2878 X375 (work)                        St. Petersburg Campus / Tampa Ca
mpus
813-272-2654 (FAX)

ISM 3230 Instructor
Page-- http://www.stpt.usf.edu/coba/faculty/roberts
email: roberts@bayflash.stpt.usf.edu

------------------------------

Date:    Sat, 23 May 1998 23:01:07 -0400
From:    Laurence Roberts <laurenofis@CSI.COM>
Subject: Test message (was Re: A test message)

At 02:29 PM 1/9/1998 +0000, you wrote:
>Hello. If this has reached the list server and can be read by anyone
>could you please reply?  I'm not sure if my messages are reaching you (
>its my first time :-<);
>
>m.d.kenny
>m.kenny@ymi.co.uk
>
Your response to this test message has been received.




================
Laurence Roberts, M.S.
Information Resources Director
Mental Health Care, Tampa, FL           University of South Florida
813-272-2878 X375 (work)                        St. Petersburg Campus / Tampa Ca
mpus
813-272-2654 (FAX)

ISM 3230 Instructor
Page-- http://www.stpt.usf.edu/coba/faculty/roberts
email: roberts@bayflash.stpt.usf.edu

------------------------------

Date:    Sat, 23 May 1998 23:01:09 -0400
From:    Laurence Roberts <laurenofis@CSI.COM>
Subject: Test message (was Re: A test message)

At 01:23 PM 1/9/1998 +0000, you wrote:
>I got it.
>
>______________________________ Reply Separator
_________________________________
>Subject: Re: A test message
>Author:  Microsoft Visual C++ programmers list <MSVC@PEACH.EASE.LSOFT.COM
> at
>CCGATE
>Date:    1/9/98 9:07 AM
>
>
>Matthew, mail command "set msvc repro" to
>LISTSERV@PEACH.EASE.LSOFT.COM
>and you will receive your own postings.
>At works for me, at least.
>
>Volker
>
>
>Matthew Kenny wrote:
>
>> Hello. If this has reached the list server and can be read by anyone
>> could you please reply?  I'm not sure if my messages are reaching you (

>> its my first time :-<);
>>
>> m.d.kenny
>> m.kenny@ymi.co.uk
>
Your response to this test message has been received.




================
Laurence Roberts, M.S.
Information Resources Director
Mental Health Care, Tampa, FL           University of South Florida
813-272-2878 X375 (work)                        St. Petersburg Campus / Tampa Ca
mpus
813-272-2654 (FAX)

ISM 3230 Instructor
Page-- http://www.stpt.usf.edu/coba/faculty/roberts
email: roberts@bayflash.stpt.usf.edu

------------------------------

Date:    Sat, 23 May 1998 23:01:04 -0400
From:    Laurence Roberts <laurenofis@CSI.COM>
Subject: Test message (was Re: A test message)

At 06:02 PM 1/9/1998 +0100, you wrote:
>Matthew, mail command "set msvc repro" to
>LISTSERV@PEACH.EASE.LSOFT.COM
>and you will receive your own postings.
>At works for me, at least.
>
>Volker
>
>
>Matthew Kenny wrote:
>
>> Hello. If this has reached the list server and can be read by anyone
>> could you please reply?  I'm not sure if my messages are reaching you (

>> its my first time :-<);
>>
>> m.d.kenny
>> m.kenny@ymi.co.uk
>
Your response to this test message has been received.




================
Laurence Roberts, M.S.
Information Resources Director
Mental Health Care, Tampa, FL           University of South Florida
813-272-2878 X375 (work)                        St. Petersburg Campus / Tampa Ca
mpus
813-272-2654 (FAX)

ISM 3230 Instructor
Page-- http://www.stpt.usf.edu/coba/faculty/roberts
email: roberts@bayflash.stpt.usf.edu

------------------------------

End of MSVC Digest - 22 May 1998 to 23 May 1998 (#1998-138)
***********************************************************
--
        There are these few times I feel lonely for you.
        But I know this shade of blue will soon pass through!
        I must be strong without you by my side!
        I can see forever you are my light.

※ 来源:.BBS 荔园晨风站 bbs.szu.edu.cn.[FROM: 192.168.0.4]


[回到开始] [上一篇][下一篇]

荔园在线首页 友情链接:深圳大学 深大招生 荔园晨风BBS S-Term软件 网络书店