Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2007 Jul : Small questions

www.cryer.info
Managed Newsgroup Archive

Small questions

Subject:Small questions
Posted by:"Churc" (cebas..@gmail.com)
Date:10 Jul 2007 07:10:55

Hello masters! :D

Im developing a COM Client/Server and as i can see some types i cant
use... to pass data between Client/Server

Im a newbie, i dont know so much about types and etc...

I wanna know, if i use Integer i can do the same as LongInt since
LongInt isnt supported by COM/OLE, but it support HRESULT, and looking
HRESULT type in System.pas i can see it type is a LongInt

type
  HRESULT = type Longint;  { from WTYPES.H }

Then i can HRESULT to pass data like LongInt example

Im doing a Plugin Framework, and COM is a nice method to implement that

look a piece of my code

PExtensionHookInfo = ^TExtensionHookInfo;
  _TAG_EXTENSION_HOOK_INFO = packed record
    cbSize: DWORD;
    chFileName: array [0..MAX_PATH] of Char;
    hHandle: THandle;
    bCache: Boolean;
    iEvents: Integer;
  end;


Procedure LoadExtensions;
type
  TExtensionHookInfoFunc = function(HookInfo: LongInt): BOOL; StdCall;
var
  slExtensions: TStringList;
  i: Integer;
  hHandle: THandle;
  ExtensionHookInfoFunc: TExtensionHookInfoFunc;
  ExtensionHookInfo: PExtensionHookInfo;
begin
  slExtensions := TStringList.Create;
  EnumFiles(GetWindowsDir + DEFAULT_PATH + 'Plugins\', '*.sdx',
faAnyFile - faDirectory,
  slExtensions, False, False);

  if (slExtensions.Count > 0) then
  for i := 0 to slExtensions.Count - 1 do
  begin
    hHandle := LoadLibrary(PChar(GetWindowsDir + DEFAULT_PATH +
slExtensions[i]));
    if (hHandle <> 0) then
    begin
      @ExtensionHookInfoFunc := GetProcAddress(hHandle,
'ExtensionHookInfo');
      if Assigned(ExtensionHookInfoFunc) then
      begin
        New(ExtensionHookInfo);
        ExtensionHookInfoFunc(Integer(@ExtensionHookInfo));
        StrPCopy(ExtensionHookInfo.chFileName, slExtensions[i]);
        lsExtensions.Add(ExtensionHookInfo);
      end;
      FreeLibrary(hHandle);
    end;
  end;
  FreeAndNil(slExtensions);
end;

As i cant use LongInt in a COM parameters then what can i use, Integer,
HRESULT?

thanksssss

Regards
Carlos

--

Replies:

www.cryer.info
Managed Newsgroup Archive