C++Builder Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
C++빌더 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
메신저 프로젝트
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C++빌더 Q&A
C++Builder Programming Q&A
[57684] Re:장성호님 모르겠어요 ㅠ
장성호 [nasilso] 1008 읽음    2009-07-20 19:46
//---------------------------------------------------------------------------   
  
#include    
#pragma hdrstop   
  
#include "Unit1.h"   
//---------------------------------------------------------------------------   
#pragma package(smart_init)   
#pragma resource "*.dfm"   
TForm1 *Form1;   
//---------------------------------------------------------------------------   
__fastcall TForm1::TForm1(TComponent* Owner)   
        : TForm(Owner)   
{   
}   
//---------------------------------------------------------------------------   
  

int __fastcall GetListViewIndexOf(TListView *lstV,String sCaption)   
{      
    if(lstV==NULL)return 0;      
     
    for(int idx=0;idxItems->Count;idx++)      
    {      
        if(lstV->Items->Item[i]->Caption==sCaption)return idx;      
    }      
    return 0 ;      
}     
  
//------------------------------------------------------------------------
void __fastcall TForm1::ServerSocket1ClientDisconnect(TObject *Sender,   
      TCustomWinSocket *Socket)   
{   
      //위 GetListViewIndexOf 함수를 쓰셔야죠 
        int idx=GetListViewIndexOf(ListView1,Socket->RemoteAddress);    
       if(idx>=0)
          ListView1->Items->Delete(idx);   
  
}   
//---------------------------------------------------------------------------      
void __fastcall TForm1::ServerSocket1ClientConnect(TObject *Sender,   
      TCustomWinSocket *Socket)   
{   
  
TListItem *item =  ListView1->Items->Add();      
item->Caption=Socket->RemoteAddress;    
  
  
}   


니라카 님이 쓰신 글 :
:
: 
: //---------------------------------------------------------------------------
: 
: #include 
: #pragma hdrstop
: 
: #include "Unit1.h"
: //---------------------------------------------------------------------------
: #pragma package(smart_init)
: #pragma resource "*.dfm"
: TForm1 *Form1;
: //---------------------------------------------------------------------------
: __fastcall TForm1::TForm1(TComponent* Owner)
:         : TForm(Owner)
: {
: }
: //---------------------------------------------------------------------------
: 
: void __fastcall TForm1::ServerSocket1ClientDisconnect(TObject *Sender,
:       TCustomWinSocket *Socket)
: {
: 
:         :I=ListView1->Items->IndexOf(Socket->RemoteAddress); 
: :   ListView1->Items->Delete(I);
: 
: }
: //---------------------------------------------------------------------------
: int __fastcall GetListViewIndexOf(TListView *lstV,String sCaption)
: {   
:     if(lstV==NULL)return 0;   
:   
:     for(int idx=0;idxItems->Count;idx++)   
:     {   
:         if(lstV->Items->Item[i]->Caption==sCaption)return idx;   
:     }   
:     return 0 ;   
: }  
: 
: ///------------------------------------------------------------------------
: void __fastcall TForm1::ServerSocket1ClientConnect(TObject *Sender,
:       TCustomWinSocket *Socket)
: {
: 
: TListItem *item =  ListView1->Items->Add();   
: item->Caption=Socket->RemoteAddress; 
: 
: 
: }
: //---------------------------------------------------------------------------
: 
: 
: 

:
:
:
: 이렇게했는데; 흠,,,

+ -

관련 글 리스트
57681 장성호님 모르겠어요 ㅠ 니라카 873 2009/07/20
57684     Re:장성호님 모르겠어요 ㅠ 장성호 1008 2009/07/20
57686         Re:Re:장성호님 모르겠어요 ㅠ 니라카 742 2009/07/20
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.