|
안녕하세요.
파워포인트 파일이 수천개 있고(약 3천개) 그중에서 사용자가 임의로 선택하는 특정 파워포인트파일 5~6개를
불러와서 사용자가 지정한 순서대로 하나의 파워포인트파일로 병합하여 저장하는 프로그램을 C++빌더로
작성하려고 합니다.
파워포인트 파일 조작관련하여 구글에 찾아보니 아래와 같이 델파이 예제소스가 있더군요.
델파이로 돌려보면 잘 작동합니다.
근데 이 소스를 어떻게 하면 C++빌더로 바꿀 수 있을까요?
ComObj.hpp를 인클루드하고 각 파스칼 문장을 C++로 변환해봤는데
델파이와는 달리 각 문장이 멤버함수가 아니라는 에러가 뜹니다. ^^
------------------------------------------------------------------------------------
uses
comobj;
procedure TForm1.Button2Click(Sender: TObject);
var
PowerPointApp: OLEVariant;
begin
try
PowerPointApp := CreateOleObject('PowerPoint.Application');
except
ShowMessage('Error...');
Exit;
end;
// Make Powerpoint visible
PowerPointApp.Visible := True;
// Show powerpoint version
ShowMessage(Format('Powerpoint version: %s',[PowerPointApp.Version]));
// Open a presentation
PowerPointApp.Presentations.Open('c:\MyPresentation.ppt', False, False, True);
// Show number of slides
ShowMessage(Format('%s slides.',[PowerPointApp.ActivePresentation.Slides.Count]));
// Run the presentation
PowerPointApp.ActivePresentation.SlideShowSettings.Run;
// Go to next slide
PowerPointApp.ActivePresentation.SlideShowWindow.View.Next;
// Go to slide 2
PowerPointApp.ActivePresentation.SlideShowWindow.View.GoToSlide(2);
// Go to previous slide
PowerPointApp.ActivePresentation.SlideShowWindow.View.Previous;
// Go to last slide
PowerPointApp.ActivePresentation.SlideShowWindow.View.Last;
// Show current slide name
ShowMessage(Format('Current slidename: %s',[PowerPointApp.ActivePresentation.SlideShowWindow.View.Slide.Name]));
// Close Powerpoint
PowerPointApp.Quit;
PowerPointApp := UnAssigned;
end;
-----------------------------------------------------------------------------------------------
|