一个消息提示托盘程序的开发历程(采用socket技术,附源代码)三---客户端源代码[5]

[入库:2005年8月19日] [更新:2007年3月24日]

本文简介:选择自 lcllcl987 的 blog

                                stringgrid1->rowcount++;
                        }
               }
               msglist=null;
               msglist = new tlist;
               label1->caption = "您的任务数:"+inttostr(stringgrid1->rowcount-1);

        }
 }

//---------------------------------------------------------------------------

void __fastcall tform1::clientsocket1disconnect(tobject *sender,
      tcustomwinsocket *socket)
{
    btnconnect->enabled=true;
    btndisconnect->enabled=false;
    statusbar1->simpletext="无法连接到服务端!";
    trayicon1->iconindex = 2;
}
//---------------------------------------------------------------------------

void __fastcall tform1::btndisconnectclick(tobject *sender)
{
    clientsocket1->close();
    btnconnect->enabled=true;
    btndisconnect->enabled=false;

}
//---------------------------------------------------------------------------

void __fastcall tform1::clientsocket1error(tobject *sender,
      tcustomwinsocket *socket, terrorevent errorevent, int &errorcode)
{
    statusbar1->simpletext="无法连接到:"+serverip;
    errorcode=0;
    btndisconnect->enabled=true;
    btnconnect->enabled=false;
}
//---------------------------------------------------------------------------

//判断某人的任务数
tform1::strcount(string substing, string sourcestr)
{
     //todo: add your source code here
     int       sp    = substing.length();
     int       pos   = sourcestr.pos(substing);
     string    tmp;
     int       capa=0;
     while( pos > 0 )
     {
          tmp=sourcestr.substring(1,pos-1);
          capa++;
          sourcestr=sourcestr.substring(pos+sp,sourcestr.length()-pos-sp+1);
          pos=sourcestr.pos(substing);
     }
     return capa;
}
void __fastcall tform1::formclose(tobject *sender, tcloseaction &action)
{
        clientsocket1->close();
}
//---------------------------------------------------------------------------

void __fastcall tform1::formclick(tobject *sender)
{
        delete msglist;
}
//---------------------------------------------------------------------------


void __fastcall tform1::n3click(tobject *sender)
{
        n3->enabled=false;
        formabout->showmodal();
        n3->enabled=true;

}
//---------------------------------------------------------------------------

void __fastcall tform1::image1click(tobject *sender)
{
        shellexecute(handle,null,misurl.c_str(),null,null,sw_shownormal);
}
//---------------------------------------------------------------------------

void __fastcall tform1::formshow(tobject *sender)
{
   if(!trayicon1->visible)
        trayicon1->visible=true;
   trayicon1->minimize();
}
//---------------------------------------------------------------------------

 


unit1.h
//---------------------------------------------------------------------------

#ifndef unit1h
#define unit1h
//---------------------------------------------------------------------------
#include <classes.hpp>
#include <controls.hpp>
#include <stdctrls.hpp>
#include <forms.hpp>

本文关键:一个消息提示托盘程序的开发历程(采用socket技术,附源代码)三---客户端源代码
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top