암호 걸린 ppt화일을 찾다보니 vb로 된 소스를 찾았답니다.
정말 어렵게 찾았는데 VB를 모르다보니 아무래도 델파이로 적용하는데 있어서
문제가 되네요...ㅠ.ㅠ;
VB를 아시는분이 델파이소스로 변경좀 해주세요...
아래는 Vb Source입니다.
You can use this snippet which makes use of SendKeys.
There is no VBA method open a presentation protected with a password in
PowerPoint XP nor is there a way to determine if the presentation is
password protected. However, if you know the password to a presentation,
then you can try the following workaround if it suits you.
1. Open the main presentation and switch to Visual Basic Editor (Alt + F11)
2. Insert a code module into the VBA project.
3. Copy and paste the following snippet.
' ----------snippet -------
Option Explicit
Declare Function SetTimer Lib "user32" _
(ByVal hwnd As Long, _
ByVal nIDEvent As Long, _
ByVal uElapse As Long, _
ByVal lpTimerFunc As Long) As Long
Declare Function KillTimer Lib "user32" _
(ByVal hwnd As Long, _
ByVal nIDEvent As Long) As Long
Public TimerID As Long
Public sPwd As String
Sub OpenPassPres()
Dim oPres As Presentation
TimerID = SetTimer(0, 0, 2000, AddressOf PassProc)
' Replace with your password
sPwd = "shyam"
' Replace E:\PresPass.ppt with your path to presentation
Call Presentations.Open("E:\prespass.ppt")
End Sub
Sub PassProc(ByVal hwnd As Long, _
ByVal uMsg As Long, _
ByVal idEvent As Long, _
ByVal dwTime As Long)
TimerID = KillTimer(0, TimerID)
SendKeys sPwd & "~"
End Sub
' --------End of Snippet ----
4. Run the macro - OpenPassPres.
정녕 델파이로 변환이 되지 않나요???
델파이에서 타이머하나 써서 똑같이 하세요. 굳이 다 해석할 필요는 없을듯하네요... SetTimer같은 API함수는 다 델파이의 TTimer로 랩핑되어 있으니까요...
핵심은 PassProc (델파이로 컨버팅하면 타이머의 OnTimer이벤트가 되겠죠...)의 단 한줄이네요... SendKeys ....