BCB Programming Experience

Source: Internet
Author: User

Q: How to implement Trichedit automatic rolling line? Functions like some readers.

A: It's OK to use Scrollwindowex or Scrollwindowex.

ScrollWindow (richedit1->handle, 0,-1, NULL, NULL); Roll down 1 pixels

ScrollWindow (richedit1->handle, 0, 1, NULL, NULL); Roll up 1 pixels

Q: In the next few days in their own components, according to the BCB help tips to do the icon, but also according to its tips to establish a link,

But just can't see their own icon, only the default!!!

A: Use Image editor edit DCR file, the letter icon name must be the same as the component name, I said is the icon name, not the file name. After generating the DCU file, use BRCC32.EXE to compile the DCR file to generate DCU file, add DCU file to BPK package, compile, install package should be able to see the package of your homemade component.

Q: Physical deletion of records, using ADO compressed Access2000 library method?

Answer: Compress Access2000 Library with ADO

#include "utilcls.h"
void CompactDatabase(String f1,String psw1, String f2,String psw2)
{
String Provider1="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
  + f1 + ";Jet OLEDB:Database Password=" + psw1;
String Provider2="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
  + f2 + ";Jet OLEDB:Database Password=" + psw2;
Variant Adoobj=Variant::CreateObject("JRO.JetEngine");
Adoobj.OleProcedure("CompactDatabase",Provider1,Provider2);
AdoObj.Clear();//释放ADO对象
}
void __fastcall TForm1::Button1Click(TObject *Sender)
{
String f1="yhecdagl1.mdb"; // 源库1
String psw1="yhecdagl"; // 密码1
String f2="yhecdagl2.mdb"; // 新目的库2
String psw2="yhecdagl2"; // 新密码2
String dir=ExtractFilePath(Application->ExeName);
if(FileExists(f2))
  DeleteFile(f2);
CompactDatabase(dir+f1,psw1,dir+f2,psw2);
ShowMessage("Finished");
}

Q: Can I use SQL to create a file named A.db through a button?

A: Here a db file is a datasheet, so you can create it by creating a table.

With SQL statements, we can create more than just tables, and many other things, such as fields

Query1->Close;
Query1->DatabaseName="c:\temp";
Query1->SQL->Text="create table a.db (field1 varchar(10),field2 varchar(10))";
Query1->ExecSQL;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.