Main > Software Forum

LEDWiz SDK v1.3 Released for developers

<< < (2/6) > >>

arzoo:

--- Quote from: headkaze on March 16, 2007, 12:16:13 pm ---If you don't have a window, you can just give the callback a null instead. Infact you don't really even need to call LWZ_REGISTER() in the callback unless you want hot swapping support, which I don't think is really necessary.


--- Code: ---Procedure notify(reason: Integer; newDevice: LWZHANDLE) stdcall;
Begin
  if (reason = LWZ_ADD) then
  begin
    LWZ_REGISTER(newDevice, nil);
  end;
End;
--- End code ---

You may need to write a bunch of wrapper functions to get the same sort of functionality as the ocx. What I've done in my plugin is have two arrays, one for state and one for intensity that I use to keep track of the LED's. That way you can use them when you need to turn a single output on or off.

--- End quote ---

hk,
Just an FYI - The Delphi code won't compile with nil passed to the LWZ_REGISTER for the window handle param.

E2010 Incompatible types: 'HWND' and 'Pointer'

loadman:

--- Quote ---hk,
Just an FYI - The Delphi code won't compile with nil passed to the LWZ_REGISTER for the window handle param.

E2010 Incompatible types: 'HWND' and 'Pointer'
--- End quote ---

I haven't had any problems compiling the unchanged code as a SDI app under Delphi 7 or Turbo Delphi 2006.   I have not tried it as a dll yet

arzoo:
Loadman,
Since the com control accepted the PBA command as a string of comma separated values, I wrote this function to convert the string to a byte array. Just makes it a bit easier to convert from the com to the dll.


--- Code: ---if ConvertPBAString('0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0',PBAVals) then
        LWZ_PBA(deviceList.handles[nDevice],addr(PBAVals[0]));

--- End code ---


--- Code: ---function ConvertPBAString(const sPBA: string; out aPBAVals: array of byte): boolean;
var
  nIndex: integer;
  slistBuf: TStringList;
begin
  //sPBA must be a comma seperated list of LEDWiz profile values.
  slistBuf := TStringList.Create;
  slistBuf.CommaText := sPBA;
  if slistBuf.Count <> 32 then
  begin
    result := false;
    exit;
  end;

  for nIndex := 0 to 31 do
    aPBAVals[nIndex] := StrToInt(slistBuf[nIndex]);
   
  slistBuf.Free;
  result := true;
end;

--- End code ---

loadman:
Nice  :cheers:

I will try that later....   :notworthy:

I'm thinking of having two builds of the Plugin DLL or OCX.  Users can choose what they want

Howard_Casto:

--- Quote from: headkaze on March 16, 2007, 12:16:13 pm ---You may need to write a bunch of wrapper functions to get the same sort of functionality as the ocx. What I've done in my plugin is have two arrays, one for state and one for intensity that I use to keep track of the LED's. That way you can use them when you need to turn a single output on or off.

--- End quote ---

I haven't had a chance to try this yet (sorry, real world stuff came up) but I've gotta think that having the same functonality as the ocx internal to the dll(minus some of the less useful ones like random colors) should be top priority.  Yes I can setup a buffer and control individual lights quite easily with code, but the fact that the ledwiz doesn't let you read the current light state means that only one app at a time can control the lights unless you can only set one at a time.  For example j5 can't light a layout and then have mamehooker or one of the other hookers control the coin lights in mame because when the coin lights are set, all the other lights will get turned off. 

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version