- - BlackBox Component Builder 1.6-rc5

From: Campbell, Robert D (SELEX) (UK Edinburgh) <"Campbell,>
Date: Mon, 7 May 2007 09:12:57 +0100

----boundary-LibPST-iamunique-1040985314_-_-
Content-type: text/plain


Hi

I give an example below of one (in fact the only) routine I have
translated to be version 1.6 friendly.

I replaced Module USER32 with WinApi, and a further 4 identifiers were
not recognised. I looked at the BlackBox interfaces, and then made
guesses. I have not consulted the Microsoft documentation.

The new code compiles, and apparently works ok.




I guess that USER32 things are defined & implemented in a DLL with a
name like USER32, and the WinApi things are defined & implemented in a
DLL with a name like WinApi (or is it KERNEL32?).


This raises 3 questions for me, and I wonder if they have simple
answers. I am only looking for simple answers as my very limited
knowledge of Windows is matched by equally limited interest!

1 - Why are there duplicate implementations of thousands of apparently
identical functions?

2 - Is it a reasonable generalisation that if a WinApi function is VERY
similar in name to another (eg USER32) that it will behave the same, or
is it necessary to scrutinise the small print of the Microsoft
documentation in every case?

3 - Why are Oms telling us to switch to WinApi - what is wrong with the
others?


Regards

Robert

ps - WinApi.GetWindowPlacement & USER32.GetWindowPlacement have
different interfaces, one has a '[nil]' decoration. Is this reason to be
suspicious that they are not 'drop-in' replacements?




New code:

PROCEDURE SetWindowPlacement* (title : Views.Title; x, y, w, h :
INTEGER);
  VAR
    win : Windows.Window;
    wTitle : Views.Title;
    wnd : WinApi.HWND;
    ret : WinApi.BOOL;
    wp : WinApi.WINDOWPLACEMENT;
  BEGIN
    win := Windows.dir.First ();
    WHILE win # NIL DO
      win.GetTitle (wTitle);
      IF wTitle = title THEN
        wnd := win(HostWindows.Window).wnd;
        IF (w = 0) & (h = 0) THEN
          ret := WinApi.GetWindowPlacement (wnd, wp);
          w := wp.rcNormalPosition.right -
wp.rcNormalPosition.left;
          h := wp.rcNormalPosition.bottom -
wp.rcNormalPosition.top
        END;
        ret := WinApi.MoveWindow (wnd, x, y, w, h, 1);
        RETURN
      END;
      win := Windows.dir.Next (win)
    END
  END SetWindowPlacement;


Old code:

PROCEDURE SetWindowPlacement* (title : Views.Title; x, y, w, h :
INTEGER);
  VAR
    win : Windows.Window;
    wTitle : Views.Title;
    wnd : USER32.Handle;
    ret : USER32.Bool;
    wp : USER32.WindowPlacement;
  BEGIN
    win := Windows.dir.First ();
    WHILE win # NIL DO
      win.GetTitle (wTitle);
      IF wTitle = title THEN
        wnd := win(HostWindows.Window).wnd;
        IF (w = 0) & (h = 0) THEN
          ret := USER32.GetWindowPlacement (wnd, wp);
          w := wp.normPos.right - wp.normPos.left;
          h := wp.normPos.bottom - wp.normPos.top
        END;
        ret := USER32.MoveWindow (wnd, x, y, w, h, 1);
        RETURN
      END;
      win := Windows.dir.Next (win)
    END
  END SetWindowPlacement;

SELEX Sensors and Airborne Systems Limited
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14 3EL
A company registered in England & Wales. Company no. 02426132
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************

--- BlackBox
--- send subject HELP or UNSUBSCRIBE to blackbox{([at]})nowhere.xy


----boundary-LibPST-iamunique-1040985314_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"

e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy
c2V0MiBTeW1ib2w7fQ0Ke1xmM1xmbW9kZXJuXGZjaGFyc2V0MCBDb3VyaWVyIE5ldzt9fQ0Ke1xj
b2xvcnRibFxyZWQwXGdyZWVuMFxibHVlMDtccmVkMFxncmVlbjBcYmx1ZTI1NTt9DQpcdWMxXHBh
cmRccGxhaW5cZGVmdGFiMzYwIFxmMFxmczIwIFxwYXINCkhpXHBhcg0KXHBhcg0KSSBn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INClxwYXINClxwYXINClxwYXINCk5ldyBjb2RlOlxwYXINClxwYXINClBS
T0NFRFVSRSAgU2V0V2luZG93UGxhY2VtZW50KiAodGl0bGUgOiBWaWV3cy5UaXRsZTsgeCwgeSwg
dywgaCA6XHBhcg0KSU5URUdFUik7XHBhcg0KICBWQVJccGFyDQogICAgd2luICAgICA6ICBXaW5k
b3dzLldpbmRvdztccGFyDQogICAgd1RpdGxlICA6ICBWaWV3cy5UaXRsZTtccGFyDQogICAgd25k
ICAgICA6ICBXaW5BcGkuSFdORDtccGFyDQogICAgcmV0ICAgICA6ICBXaW5BcGkuQk9PTDtccGFy
DQogICAgd3AgICAgICA6ICBXaW5BcGkuV0lORE9XUExBQ0VNRU5UO1xwYXINCiAgQkVHSU5ccGFy
DQogICAgd2luICA6PSAgV2luZG93cy5kaXIuRmlyc3QgKCk7XHBhcg0KICAgIFdISUxFICB3aW4g
ICMgIE5JTCAgRE9ccGFyDQogICAgICB3aW4uR2V0VGl0bGUgKHdUaXRsZSk7XHBhcg0KICAgICAg
SUYgIHdUaXRsZSAgPSAgdGl0bGUgIFRIRU5ccGFyDQogICAgICAgIHduZCAgOj0gIHdpbihIb3N0
V2luZG93cy5XaW5kb3cpLnduZDtccGFyDQogICAgICAgIElGICAodyAgPSAgMCkgICYgIChoICA9
ICAwKSAgVEhFTlxwYXINCiAgICAgICAgICByZXQgIDo9ICBXaW5BcGkuR2V0V2luZG93UGxhY2Vt
ZW50ICh3bmQsIHdwKTtccGFyDQogICAgICAgICAgdyAgICA6PSAgd3AucmNOb3JtYWxQb3NpdGlv
bi5yaWdodCAgIC1ccGFyDQp3cC5yY05vcm1hbFBvc2l0aW9uLmxlZnQ7XHBhcg0KICAgICAgICAg
IGggICAgOj0gIHdwLnJjTm9ybWFsUG9zaXRpb24uYm90dG9tICAtXHBhcg0Kd3AucmNOb3JtYWxQ
b3NpdGlvbi50b3BccGFyDQogICAgICAgIEVORDtccGFyDQogICAgICAgIHJldCAgOj0gIFdpbkFw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Gl0IGZvciBh
bnkgcHVycG9zZSBub3IgZGlzY2xvc2Ugb3JccGFyDQpkaXN0cmlidXRlIGl0cyBjb250ZW50cyB0
byBhbnkgb3RoZXIgcGVyc29uLlxwYXINCioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq
KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqXHBhcg0KXHBhcg0KLS0tIEJsYWNr
Qm94XHBhcg0KLS0tIHNlbmQgc3ViamVjdCBIRUxQIG9yIFVOU1VCU0NSSUJFIHRvIGJsYWNrYm94
QG9iZXJvbi5jaFxwYXINClxwYXINCn0

----boundary-LibPST-iamunique-1040985314_-_---
Received on Mon May 07 2007 - 10:12:57 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:31:38 UTC