Page 1 of 1

Rectangle Name & NeoBook handle

PostPosted: Fri Apr 17, 2009 1:57 pm
by David de Argentina
Hi programmer Gurus,

I'm trying to get the Rectangle handle knowing the Rectangle Name.

I use GetClassName API Function.

I discovered I get one or more Rectangle handle, all named "TNeoBookRect" with the real handle. But I can't determine what "TNeoBookRect" is each Rectangle...

Are there any way to determine this ?

Thanks in advance,
David de Argentina

PostPosted: Fri Apr 17, 2009 2:38 pm
by bunker
Hi David
This is what you want?:
Code: Select all
GetObjectHandle "Rectangle1" "[rec1_handle]"


Greetings

PostPosted: Fri Apr 17, 2009 5:11 pm
by David de Argentina
Hi Bunker,

I need the same result using API Functions.

Thanks in advance,
David de Argentina

PostPosted: Mon Apr 20, 2009 11:43 am
by Neosoft Support
I don't know if that's possible or not. Each NeoBook object is a window, so you could try examining the window text of each TNeoBookRect and see if that works. Windows objects don't usually have names, they just have handles.

PostPosted: Tue Apr 21, 2009 11:17 am
by dec
Hi,

I dont know if I wrong, by, is possible to use something like this to retrieve the handle of a Neobook object, based on the Neobook SDK:

Code: Select all
function GetNeobookObjectHandle(identifier: string): HWnd;
var
  s: PChar;
begin
  s := nil;
  result := 0;
  if Assigned(nbInterface) then
  begin
    try
      SetStr(s, identifier);
      nbInterface(7, s);
      result := HWND(s);
    finally
      FreeStr(s);
    end;
  end;
end;


A dont now if some like this is that you need. :wink:

PostPosted: Tue Apr 21, 2009 2:05 pm
by David de Argentina
Thanks Dec,

I'll try to adapt your code to Powerbasic syntax

Greetings from Buenos Aires,
David de Argentina

PostPosted: Tue Apr 21, 2009 3:41 pm
by David de Argentina
Hi Dec,

Using your function I can get some rare value....

you wrote:

result := HWND(s);

HWND() is a Delphi function ?

I don't find any info about this function...

Could you tell me where is defined ?

Thanks in advance,
David de Argentina

PostPosted: Tue Apr 21, 2009 4:40 pm
by dec
Hi,

In fact is not a function, but a "type cast": just promote the PChar in order to be returned as HWND value. I dont know if in your language is possible something like this. If not... maybe you can try to convert the PChar into a LongInteger, that maybe work well in this case.