線を出力
ここでは、PowerPointのスライドに線を出力するサンプルを示します。
//PowerPointを操作するためのタイプライブラリを読みこむ(PowerPoint2000用)
#import "C:\Program Files\Microsoft Office\Office\Mso9.dll" no_namespace rename("DocumentProperties", "DocumentPropertiesDOC")
#import "C:\Program Files\Common Files\Microsoft Shared\VBA\VBA6\Vbe6ext.olb" no_namespace
#import "C:\Program Files\Microsoft Office\Office\msppt9.olb"
void CPpttextboxDlg::OnButton1()
{
using namespace PowerPoint;
_ApplicationPtr pPPT;
//PowerPointの起動
pPPT.CreateInstance(L"PowerPoint.Application");
pPPT->put_Visible(msoTrue);
//新規 プレゼンテーション を追加する
_PresentationPtr pPresentation = pPPT->Presentations->Add(msoTrue);
//新規 スライド(空)を追加する
_SlidePtr pSlide = pPresentation->Slides->Add(1, ppLayoutBlank);
//線の追加
PowerPoint::ShapePtr pShape = pSlide->Shapes->AddLine(20, 20, 200, 200);
AfxMessageBox("動作確認のために一時停止");
pPPT->Quit();
}