Blog
Logotype
Ea commodo exercitation commodo, proident cillum,
do reprehenderit consequat et eu anim voluptate. Ut
cupidatat reprehenderit in dolor labore.
The following is a very preliminary example of BCB quickbooks integration, but it should be enough to show you
an example
#pragma link "QBFC6Lib_OCX"
#pragma link "QBXMLRP2Lib_OCX"
bool tempConnected = false;
IMsgSetRequestPtr tempRequest;
IMsgSetResponsePtr tempResponseSet;
IResponsePtr tempResponse;
void AddAccounts(WideString tempAccountName, ENAccountType tempAcctType)
{
IAccountAddPtr tempAddAcct;
IAccountRetPtr tempRetAcct;
try
{
tempRequest->ClearRequests();
tempRequest->Attributes->OnError = roeContinue;
tempAddAcct = tempRequest->AppendAccountAddRq();
tempAddAcct->Name->SetValue(WideString(tempAccountName));
tempAddAcct->IsActive->SetValue(-1);
tempAddAcct->AccountType->SetValue(tempAcctType);
tempResponseSet = frmQBInteg->QBSession->DoRequests(tempRequest);
tempResponse = tempResponseSet->ResponseList->GetAt(0);
tempRetAcct = tempResponse->Detail;
}
catch(...)
{
// Open the connection and begin the session
frmQBInteg->QBSession->OpenConnection( WideString(""), WideString( "Clear Management"));
frmQBInteg->QBSession->BeginSession(WideString(""), omDontCare );
tempConnected = true;
//Create the message set request object
tempRequest = frmQBInteg->QBSession->CreateMsgSetRequest(WideString("US"), 2, 0);
tempRequest->Attributes->OnError = roeContinue;
}
}
The following is Word Automation achieved using a TOLEContainer which has been added to the form called
wdOpen:
void __fastcall TForm1::NewDocument1Click(TObject *Sender)
{
if(txtDocName->Text == "")
{
ShowMessage("Please enter a name for this document.");
txtDocName->SetFocus();
}
else
{
try
{
wdOpen->Visible = true;
wdOpen->CreateObject("word.document", false);
wdOpen->DoVerb(ovShow);
qrySiteDoc->Insert();
if(txtDocName->Text == "")
{
qrySiteDoc->FieldByName("DocName")->AsString = "Test";
}
else
{
qrySiteDoc->FieldByName("DocName")->AsString = Trim(txtDocName->Text);
}
qrySiteDoc->Post();
gdLetters->Visible = false;
txtDoc->Visible = false;
}
catch(...)
{
gdLetters->Visible = true;
txtDoc->Visible = true;
wdOpen->Visible = false;
ShowMessage("Could Not Open Microsoft Word.");
}
}
}
The following is Excel Automation achieved using Variant Objects:
void __fastcall TForm1::OpenExcelClick(TObject *Sender)
{
Variant vExcelApp;
Variant tempExcelItem;
Variant v0,v1,v2, v22, vrange, WD,a,b,c;
try
{
Screen->Cursor = crHourGlass;
vExcelApp= Variant::CreateObject("Excel.Application");
vExcelApp.OlePropertySet("Visible",true);
v0=vExcelApp.OlePropertyGet("Workbooks");
v0.OleProcedure("Add");
tempExcelItem=v0.OlePropertyGet("Item",1);
v0=tempExcelItem.OlePropertyGet("Worksheets") ;
//Add title to spreadsheet
v0.OlePropertyGet("Item",1).OlePropertySet
("Name",WideString(frmSearch->tblReports->FieldByName("ReportName")->AsString));
v1=v0.OlePropertyGet("Item",1);
v1.OlePropertyGet("Cells").OlePropertyGet("Item",1,1).OlePropertySet
("Value",WideString(frmSearch->tblReports->FieldByName("ReportName")->AsString));
vExcelApp.OlePropertyGet("Range","A4").OleProcedure("PasteSpecial");
Screen->Cursor = crDefault;
}
catch(...)
{}
}
The right company, the right tools, the job done right.
This time, and every time.
Home
|
Products
|
Web Design
|
Support
|
Contact Us
About Us
|
© Clear Management 2000-2011