Go Back   Steve's Digicams Forums > Misc Forums > Remote Control

Reply
 
Thread Tools Search this Thread
Old Aug 2, 2006, 4:14 AM   #1
Junior Member
 
Join Date: Aug 2006
Posts: 1
Default

1.call the SDK function of StartSDK.

var Err:cdErr;
Ver:cdVersionInfo;
.........

Ver.MajorVersion :=7;
Ver.MinorVersion :=1;
Ver.Size :=Sizeof(ver);
Result :=cdINVALID;
Err := CDStartSDK(Ver, 0);
if Err<>cdOK then
exit;
2.call CDEnumDeviceReset,CDGetDeviceCount,CDEnumDeviceNex t,CDEnumDeviceRelease function to select source.It is very easy.

3.you must call like this to enter remote control mode.

Err := CDLockUI(m_hSource);
If Err <> cdOK Then
exit;

Err := CDEnterReleaseControl(m_hSource,@Rel_CallBackFunc, 0 );
If Err <> cdOK Then
exit;

Err := CDUnlockUI(m_hSource);
If Err <> cdOK Then
exit;
4.Register a release callback function to reture the release event
function Rel_CallBackFunc(EventID:cdReleaseEventID;pDatao inter;DataSize:cdUInt32;Context:cdContext): cdUInt32 stdcall;
begin
.......
Result :=cdOK;
end;
5.ViewFinder part
define BmpData as TBitmap of a gobal variant

function ViewFinder_CallbackFunction(pBufointer;Size:cdUI nt32;Format:cdUInt32;Context : cdContext) : cdUInt32 stdcall;
var BmpStream:TMemoryStream;
begin
BmpStream :=TMemoryStream.Create;
Try
BmpStream.WriteBuffer(pBuf^,Size);
BmpStream.Position :=0;
BmpData.LoadFromStream(BmpStream);
Result :=cdOK;
finally
BmpStream.Free;
end;
end;


Register the Viewfinder call back function


cdStartViewFinder(m_hSource,1,@ViewFinder_Callback Function,0);
ViewFinderTimer.Enabled :=True; //the timer of paint

Draw the image of viewfinder

procedure TfrmMain.ViewFinderTimerTimer(Sender: TObject);
begin
Image1.Canvas.CopyRect(Image1.Canvas.ClipRect,BmpD ata.Canvas,BmpData.Canvas.ClipRect);
end;
==================================================

the code is compiled with Delphi 7 without error and work OK.
Pls. do not ask me to send you the SDK,because the copyright is under the law.
best regards.



WWWSpider is offline   Reply With Quote
Sponsored Links
Old Mar 6, 2007, 11:53 PM   #2
Junior Member
 
Join Date: Mar 2007
Posts: 1
Default

Dear WWWSpider:

may i ask how to define the "CDEnterReleaseControl" function.

you have call the function:

Err := CDEnterReleaseControl(m_hSource,@Rel_CallBackFunc, 0 );
If Err <> cdOK Then
exit;

and I wanna to know how to define the "CDEnterReleaseControl" Function

if i define

function CDEnterReleaseControl(
hSource :cdHSource;
var pFunc :Rel_CallBackFunc
Context :CdContext
):cdUInt32 ; stdcall;external cdsdk;


and

function Rel_CallBackFunc(EventID: cdReleaseEventID;
pData: pointer; DataSize: cdUInt32; Context: cdContext): cdUInt32;
begin
//
Result :=cdOK;
end;

when i compiler , it display "Rel_CallBackFunc" is not a type identifier...
would you tell my why ??

thanks your help !

minwhei is offline   Reply With Quote
 
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -5. The time now is 5:58 PM.