Board index » delphi » formstyle and borderstyle (MS Office bar)??

formstyle and borderstyle (MS Office bar)??

When I try to go from a normal window (presentation form):
        ...
        formstyle := fsNormal;
        borderstyle := bsSingle;
        ...
to a "abnormal" window (MS office bar) and vice versa
        ...
        formstyle := fsStayOnTop;
        borderstyle := bsNone;
        ...
in run time the window stopps acting on incoming user defined windows message
(WM_INITIALIZE  = WM_USER+0; ...)

I use:
...
var
        mess : TMessage;
begin
        mess.Msg := WM_INITIALIZE;      
        mess.LParam := 0;
        mess.WParam := 0;
        PostMessage(presentation_hwnd, mess.Msg, mess.Lparam, mess.WParam);
...

to post the messages to the presentation form (window).
If I start the presentation form in abnormal mode it works fine or if I don't
change mode it also works fine.

Does anyone have a clue?

/Fredrik Pettersson

 

Re:formstyle and borderstyle (MS Office bar)??


Fredrik Pettersson wrote in a message to All:

FP>  PostMessage(presentation_hwnd, mess.Msg, mess.Lparam, mess.WParam);
FP> ...

FP> to post the messages to the presentation form (window).
FP> If I start the presentation form in abnormal mode it works fine or
FP> if I don't  change mode it also works fine.

FP> Does anyone have a clue?

The saving of the window handle is the problem - when you change the style, the
window is recreated and the handle changes. To work around it, get the handle
again, or explicitly refer to PresentationForm.Handle instead - always safe...

Best regards,
   Christian // ctib...@silver.ct.se

.. Dachshund: Half a dog high by a dog and a half long.
.. Dachshund: Half a dog high by a dog and a half long

Other Threads