Board index » delphi » message

message

Hi,

I tried to send a message from a modal dialog to a non-modal window:

SendMessage(SomeWindow^.HWindow, WM_COMMAND, WordParam, LongParam);

But nothing happens. Then I used the following code:

SomeWindow^.DefCommandProc(Msg);

This works. But it doesn't feel good. Is this a propper way? Why can't
I use de SendMessage method?

TC

 

Re:message


Quote
In article <2q0tot4u8vqq736c3ejuq1b7tos95g8...@4ax.com>, TC wrote:
> Hi,

> I tried to send a message from a modal dialog to a non-modal window:

> SendMessage(SomeWindow^.HWindow, WM_COMMAND, WordParam, LongParam);

> But nothing happens. Then I used the following code:

> SomeWindow^.DefCommandProc(Msg);

> This works. But it doesn't feel good. Is this a propper way? Why can't
> I use de SendMessage method?

You can't use the win32 api in Turbo Pascal.

Re:message


On 30 Aug 2001 21:20:39 GMT, mar...@toad.stack.nl (Marco van de Voort)
wrote:

Quote
>In article <2q0tot4u8vqq736c3ejuq1b7tos95g8...@4ax.com>, TC wrote:
>> Hi,

>> I tried to send a message from a modal dialog to a non-modal window:

>> SendMessage(SomeWindow^.HWindow, WM_COMMAND, WordParam, LongParam);

>> But nothing happens. Then I used the following code:

>> SomeWindow^.DefCommandProc(Msg);

>> This works. But it doesn't feel good. Is this a propper way? Why can't
>> I use de SendMessage method?

>You can't use the win32 api in Turbo Pascal.

I don't see anything marking that as specifically Win32, in fact the
WordParam/LongParam distinction looks Win16 to me.

Could be Turbo or Borland Pascal for Windows code.

Stephen Posey
slpo...@concentric.net

Re:message


Quote
On Thu, 30 Aug 2001 18:27:33 GMT, TC <x...@y.z> wrote:
>Hi,

>I tried to send a message from a modal dialog to a non-modal window:

>SendMessage(SomeWindow^.HWindow, WM_COMMAND, WordParam, LongParam);

>But nothing happens. Then I used the following code:

>SomeWindow^.DefCommandProc(Msg);

>This works. But it doesn't feel good. Is this a propper way? Why can't
>I use de SendMessage method?

I don't think that's likely to work, the whole point of a Modal Dialog
is that the underlying process basically stops (i.e. its message loop
is stalled) until the Modal Dialog returns.

What are you trying to accomplish?

Stephen Posey
slpo...@concentric.net

Re:message


Quote
"Stephen Posey" <slpo...@concentric.net> wrote in message

news:3b90fc6d.7413883@news.concentric.net...

Quote
> On 30 Aug 2001 21:20:39 GMT, mar...@toad.stack.nl (Marco van de Voort)
> wrote:
> >In article <2q0tot4u8vqq736c3ejuq1b7tos95g8...@4ax.com>, TC wrote:
> >> Hi,

> >> I tried to send a message from a modal dialog to a non-modal window:
> >> SendMessage(SomeWindow^.HWindow, WM_COMMAND, WordParam, LongParam);
> >> But nothing happens. Then I used the following code:
> >> SomeWindow^.DefCommandProc(Msg);
> >> This works. But it doesn't feel good. Is this a propper way? Why
can't
> >> I use de SendMessage method?

> >You can't use the win32 api in Turbo Pascal.

> I don't see anything marking that as specifically Win32, in fact the
> WordParam/LongParam distinction looks Win16 to me.

> Could be Turbo or Borland Pascal for Windows code.

From the help files:

---------
SendMessage (2.x)     (WINPROCS unit)

function SendMessage(Wnd: HWnd; Msg, wParam: Word; lParam: LongInt):
LongInt;

The SendMessage function sends the specified message to the given
window or windows. The function calls the window procedure for
the window and does not return until that window procedure has
processed the message. This is in contrast to the PostMessage
function, which places (posts) the message in the window's message
queue and returns immediately.
[...]
----------

Your point about modal vs. modeless dialogs seems likely to be
correct, I think.

--
The Scarlet Manuka

Re:message


On 31 Aug 2001 02:41:03 GMT, slpo...@concentric.net (Stephen Posey)
wrote:

Quote
>>In article <2q0tot4u8vqq736c3ejuq1b7tos95g8...@4ax.com>, TC wrote:
>>> Hi,

>>> I tried to send a message from a modal dialog to a non-modal window:

>>> SendMessage(SomeWindow^.HWindow, WM_COMMAND, WordParam, LongParam);

>>> But nothing happens. Then I used the following code:

>>> SomeWindow^.DefCommandProc(Msg);

>>> This works. But it doesn't feel good. Is this a propper way? Why can't
>>> I use de SendMessage method?

>>You can't use the win32 api in Turbo Pascal.

>I don't see anything marking that as specifically Win32, in fact the
>WordParam/LongParam distinction looks Win16 to me.

>Could be Turbo or Borland Pascal for Windows code.

It Is BPW. In fact, the program was written in BPW en now maintained
in Delphi 1. The modal window is a dialog. It calls it's parent (a
MdiChildWindow)  to open another modal dialog.

This morning I figured out that, although the DefCommandProc receives
no message, the DefWndProc does receive the message.

Still wondering if this is the proper way.

TC

Re:message


On 31 Aug 2001 02:43:22 GMT, slpo...@concentric.net (Stephen Posey)
wrote:

Quote
>>SendMessage(SomeWindow^.HWindow, WM_COMMAND, WordParam, LongParam);

>>But nothing happens. Then I used the following code:

>>SomeWindow^.DefCommandProc(Msg);

>>This works. But it doesn't feel good. Is this a propper way? Why can't
>>I use de SendMessage method?

>I don't think that's likely to work, the whole point of a Modal Dialog
>is that the underlying process basically stops (i.e. its message loop
>is stalled) until the Modal Dialog returns.

>What are you trying to accomplish?

A modal dialog contains a "specify" button. After pressing this button
a new dialog must appear. The code new dialog is encapsulated in the
implementation section of some unit and only reachable through a
message. This message is normally handled bye the DefCommandProc of
the parent window, a decendant of TWindow and a child window in the
MDI application. I found that the DefWndProc will receive the message.

TC

Re:message


Quote
On Fri, 31 Aug 2001 10:24:14 GMT, TC <x...@y.z> wrote:
>On 31 Aug 2001 02:43:22 GMT, slpo...@concentric.net (Stephen Posey)
>wrote:

>>>SendMessage(SomeWindow^.HWindow, WM_COMMAND, WordParam, LongParam);

>>>But nothing happens. Then I used the following code:

>>>SomeWindow^.DefCommandProc(Msg);

>>>This works. But it doesn't feel good. Is this a propper way? Why can't
>>>I use de SendMessage method?

>>I don't think that's likely to work, the whole point of a Modal Dialog
>>is that the underlying process basically stops (i.e. its message loop
>>is stalled) until the Modal Dialog returns.

>>What are you trying to accomplish?

>A modal dialog contains a "specify" button. After pressing this button
>a new dialog must appear. The code new dialog is encapsulated in the
>implementation section of some unit and only reachable through a
>message. This message is normally handled bye the DefCommandProc of
>the parent window, a decendant of TWindow and a child window in the
>MDI application. I found that the DefWndProc will receive the message.

Glad you found a solution.

Stephen Posey
slpo...@concentric.net

Other Threads