Re: [fpc-pascal] EOLESysError calling CreateOLEObject

2008-08-13 Thread Felipe Monteiro de Carvalho
Yes, that was it =)

Excellent. I assumed it wasn't merged because no answer was given to my e-mail.

This is pretty good for that part of the book =)

thank you,
-- 
Felipe Monteiro de Carvalho
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] EOLESysError calling CreateOLEObject

2008-08-13 Thread Marco van de Voort
 Yes, that was it =)
 
 Excellent. I assumed it wasn't merged because no answer was given to my 
 e-mail.
 
 This is pretty good for that part of the book =)

Well, that fix, and the win32/win64 can use more than 2GB fix (peflags
directive) should be the only differences between rc2 and the final release.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] EOLESysError calling CreateOLEObject

2008-07-28 Thread Felipe Monteiro de Carvalho
Reminder, thanks

On Tue, Jul 22, 2008 at 12:58 PM, Felipe Monteiro de Carvalho
[EMAIL PROTECTED] wrote:
 On Tue, Jul 22, 2008 at 10:59 AM, Marco van de Voort [EMAIL PROTECTED] 
 wrote:
 Fixed, added some more clsid constants in the process r11434

 Could the fix be merged to 2.2.2?

 I would like to use the example in the Lazarus book, which will most
 likely come after 2.2.2

 thanks,
 --
 Felipe Monteiro de Carvalho




-- 
Felipe Monteiro de Carvalho
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] EOLESysError calling CreateOLEObject

2008-07-22 Thread Felipe Monteiro de Carvalho
Hello,

I created a very simple program to create a shortcut in the desktop,
but it crashes with EOLESysError (nothing else in the error message).
I tryed to google, but it didn't show much. Am I missing some kind of
initialization call that should be made? thanks, here is the full
program.


{ Creates a link to the Windows calculator in the desktop }
program createshortcut;

{$ifdef fpc}{$mode delphi}{$endif}

uses SysUtils, Windows, ShlObj, ActiveX, ComObj;

var
   IObject: IUnknown;
   ISLink: IShellLink;
   IPFile: IPersistFile;
   PIDL: PItemIDList;
   InFolder: array[0..MAX_PATH] of Char;
   TargetName: String;
   LinkName: WideString;
begin
   TargetName := 'c:\windows\calc.exe';

   { Creates an instance of IShellLink }
   IObject := CreateComObject(CLSID_ShellLink); // Crash here
   ISLink := IObject as IShellLink;
   IPFile := IObject as IPersistFile;

   ISLink.SetPath(pChar(TargetName)) ;
   ISLink.SetWorkingDirectory(pChar(ExtractFilePath(TargetName))) ;

   { Get the desktop location }
   SHGetSpecialFolderLocation(0, CSIDL_DESKTOPDIRECTORY, PIDL) ;
   SHGetPathFromIDList(PIDL, InFolder) ;
   LinkName := InFolder + PathDelim + 'Link created with Free Pascal.lnk';

   { Create the link }
   IPFile.Save(PWChar(LinkName), false);
end.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] EOLESysError calling CreateOLEObject

2008-07-22 Thread Marco van de Voort
 I created a very simple program to create a shortcut in the desktop,
 but it crashes with EOLESysError (nothing else in the error message).
 I tryed to google, but it didn't show much. Am I missing some kind of
 initialization call that should be made? thanks, here is the full
 program.

I'm no com wizard, BUT

Try coinitialize(nil);  (and couninitialize;) from unit activex.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] EOLESysError calling CreateOLEObject

2008-07-22 Thread Felipe Monteiro de Carvalho
Thanks, but it didn't solve it. The same code (+coinitialize) works in
Delphi 5. Maybe it's the dispinterfaces problem in fpc? Is it expected
to work in 2.2.2 or in 2.3.1?

thanks,
-- 
Felipe Monteiro de Carvalho
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] EOLESysError calling CreateOLEObject

2008-07-22 Thread Marco van de Voort
 Thanks, but it didn't solve it. The same code (+coinitialize) works in
 Delphi 5. Maybe it's the dispinterfaces problem in fpc? Is it expected
 to work in 2.2.2 or in 2.3.1?

I suspect it is in the classid. (the clsid_ constant).

Apparantly when I converted the headers, I thought there only was one ID.
However it seems that classids, and the ids in interfaces are different.

I don't know enough from com to understand the difference, but when I copied and
pasted a value for clsid_ishelllink found on the web, the example worked,
with or without coinit*.\

So the value in the FPC headers is wrong, and the IID values in the headers.
So I grepped the SDK headers, and the shellink clsid is:

DEFINE_SHLGUID(CLSID_ShellLink, 0x00021401L, 0, 0); //
00021401---C000-0046

while the iid starts with 000214EE







___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] EOLESysError calling CreateOLEObject

2008-07-22 Thread Marco van de Voort
 DEFINE_SHLGUID(CLSID_ShellLink, 0x00021401L, 0, 0); //
 00021401---C000-0046
 
 while the iid starts with 000214EE

Fixed, added some more clsid constants in the process r11434
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] EOLESysError calling CreateOLEObject

2008-07-22 Thread Inoussa OUEDRAOGO
 Apparantly when I converted the headers, I thought there only was one ID.
 However it seems that classids, and the ids in interfaces are different.

 I don't know enough from com to understand the difference,

classids are used to identify implementation objects, while iid
identify interfaces as in regular object pascal interface ( used in
QueryInterface ).
The COM obects creation routines ( CoCreateObject and friends ) expect
a classid to locate the implementation object to instanciate.

Hope this help.

Best regards.
-- 
Inoussa O.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] EOLESysError calling CreateOLEObject

2008-07-22 Thread Marco van de Voort
  Apparantly when I converted the headers, I thought there only was one ID.
  However it seems that classids, and the ids in interfaces are different.
 
  I don't know enough from com to understand the difference,
 
 classids are used to identify implementation objects, while iid
 identify interfaces as in regular object pascal interface ( used in
 QueryInterface ).
 The COM obects creation routines ( CoCreateObject and friends ) expect
 a classid to locate the implementation object to instanciate.

Ok, makes sense, thanks. Now I understand what I fixed.

However the windows headers don't have a really good place or uniform way to
declare either, so I can't do a bit of grepping and isolate all clsids.

However I found a big batch (160 of them) in the comdef header, with among
them the correct value of clsid_shelllink (so I know they are really
clsids). These are already committed, and I'll try to get it in 2.2.2.

On some website sb hinted that there are even more kinds (fmtids and
cgids), do you happen to know more about those too?
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] EOLESysError calling CreateOLEObject

2008-07-22 Thread Inoussa OUEDRAOGO
2008/7/22 Marco van de Voort [EMAIL PROTECTED]:
  Apparantly when I converted the headers, I thought there only was one ID.
  However it seems that classids, and the ids in interfaces are different.
 
  I don't know enough from com to understand the difference,

 classids are used to identify implementation objects, while iid
 identify interfaces as in regular object pascal interface ( used in
 QueryInterface ).
 The COM obects creation routines ( CoCreateObject and friends ) expect
 a classid to locate the implementation object to instanciate.

 Ok, makes sense, thanks. Now I understand what I fixed.

 However the windows headers don't have a really good place or uniform way to
 declare either, so I can't do a bit of grepping and isolate all clsids.

 However I found a big batch (160 of them) in the comdef header, with among
 them the correct value of clsid_shelllink (so I know they are really
 clsids). These are already committed, and I'll try to get it in 2.2.2.

 On some website sb hinted that there are even more kinds (fmtids and
 cgids), do you happen to know more about those too?

I never heard about fmtids and cgids.


-- 
Inoussa O.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] EOLESysError calling CreateOLEObject

2008-07-22 Thread Felipe Monteiro de Carvalho
On Tue, Jul 22, 2008 at 10:59 AM, Marco van de Voort [EMAIL PROTECTED] wrote:
 Fixed, added some more clsid constants in the process r11434

Could the fix be merged to 2.2.2?

I would like to use the example in the Lazarus book, which will most
likely come after 2.2.2

thanks,
-- 
Felipe Monteiro de Carvalho
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal