Bixby Sayz
2012-11-11 12:46:28
Trying to figure out how to get the size/position of the currently paired SMART client.
2012-11-11 12:46:28
2012-11-11 12:48:52
2012-11-11 17:57:09
From: BrandonThat gives the dimensions. It does not give me the position of the window on the desktop. I could search for the SMART window by title, but if there are more than one open this is error prone.
GetClientDimensions(W, H).
2012-11-11 20:37:18
From: Bixby Sayz
That gives the dimensions. It does not give me the position of the window on the desktop. I could search for the SMART window by title, but if there are more than one open this is error prone.
var
Thread: TTimer;
SimbaMenu, Sub: TMenuItem;
Function FindWindow(ClassName, WindowName: PChar): HWND; External 'FindWindowA@User32.dll';
Function GetWindowRect(WindowHandle: HWND; var Rect: TBox): Boolean; External 'GetWindowRect@User32.dll';
Function FindSmart(SmartPID: String): HWND;
var
Data: PChar;
Begin
Data := 'SMARTv8.0 - SMART Minimizing Autoing Resource Thing - By BenLand100 [' + SmartPID + ']';
Result := FindWindow('SunAwtFrame', Data);
End;
Procedure GetSmartDimensions;
var
Rect: TBox;
SmartPID: String;
Begin
SmartPID := ReadINI('Changed', 'Changed', IncludePath + 'SmartPosition.INI');
GetWindowRect(FindSmart(SmartPID), Rect);
WriteINI('Changed', 'Changed', ToStr(Rect), IncludePath + 'SmartPosition.INI');
End;
Procedure Thread_Init;
begin
Thread:= TTimer.Create(nil);
Thread.ONTIMER:= @GetSmartDimensions;
Thread.INTERVAL:= 1000;
Thread.ENABLED:= True;
end;
procedure Init;
begin
SimbaMenu := TMenuItem.Create(Simba_MainMenu);
SimbaMenu.Caption := 'SmartPosition';
Simba_MainMenu.Items.Add(SimbaMenu);
Sub := TMenuItem.Create(SimbaMenu);
Sub.Caption := 'SmartPosition';
Sub.ShortCut := 123;
Sub.OnClick := @PositionCall;
SimbaMenu.Add(FormGUI);
Thread_Init;
end;
function GetName : string;
begin;
result := 'SmartPosition';
end;
function GetVersion : string;
begin;
result := '1.0';
end;
procedure Free;
begin
end;
procedure Attach;
begin
end;
Procedure Detach;
begin
end;
begin
end.Procedure SmartPID;
var
BoxInfo: String;
Begin
WriteINI('Changed', 'Changed', ToStr(SmartCurrentID), IncludePath + 'SmartPosition.INI');
Wait(1000);
BoxInfo := ReadINI('Changed', 'Changed', IncludePath + 'SmartPosition.INI');
End;
begin
end.
2012-11-11 21:14:42
2012-11-11 21:30:51
From: Bixby Sayz
What could work. Thanks.
Was trying to workaround the inability to read from the client in certain modes simply using the built-in tools. Have it working *except* for with SMART. So was trying to come up with something clever to work with SMART.
2012-11-21 10:53:59
From: Bixby Sayz
That gives the dimensions. It does not give me the position of the window on the desktop. I could search for the SMART window by title, but if there are more than one open this is error prone.