From: bachegool on
Hello,
I have this function call

PostMessage(pDisp->DisplayCommand->MainWidget, PM_OBJECT,
SHOW_INSTANCE, 0L);

as far as I know the message loop should "catch" the "SHOW_INSTANCE"
message. For some reason it doesn't catch it. any ideas why?

ehsan

P.S. I previously had sent a message to the mfc group about this
issue, before I founded out that it was the PostMessage() and message
loop. so here is the message:

I have created a new MFC dialog that loads a custom control grid , by
double clicking on cells(not all cells just one or two columns) it
will open a win32 dialog which has its own functionalities. The MFC
dialog is a modeless dialog box and is inside a DLL. I have created a
function that is exported from the DLL, this will create the dialog
box and show it. To run the win32 dialogs that are outside of the DLL
I use function pointers and GetProcAddress() to call the functions.
The problem is with the win32 dialog boxes, the buttons on them just
don't work, they just make the dialogs(win32) to disappear. The win32
dialogs worked correctly with the previous grid, non MFC. I have
checked the functionality of the win32 dialogs against our old grid,
for some reason the dialogs that are connected to the MFC dialogs go
through the message loop less that the ones that are connected to the
older grid version. the older grid was a based on pure cpp. can some
one give me any idea on how to fix the problem or just tell me what
the problem might be.
From: Jaelani on
bachegool wrote:
> Hello,
> I have this function call
>
> PostMessage(pDisp->DisplayCommand->MainWidget, PM_OBJECT,
> SHOW_INSTANCE, 0L);
>
> as far as I know the message loop should "catch" the "SHOW_INSTANCE"
> message. For some reason it doesn't catch it. any ideas why?
>
> ehsan
>
> P.S. I previously had sent a message to the mfc group about this
> issue, before I founded out that it was the PostMessage() and message
> loop. so here is the message:
>
> I have created a new MFC dialog that loads a custom control grid , by
> double clicking on cells(not all cells just one or two columns) it
> will open a win32 dialog which has its own functionalities. The MFC
> dialog is a modeless dialog box and is inside a DLL. I have created a
> function that is exported from the DLL, this will create the dialog
> box and show it. To run the win32 dialogs that are outside of the DLL
> I use function pointers and GetProcAddress() to call the functions.
> The problem is with the win32 dialog boxes, the buttons on them just
> don't work, they just make the dialogs(win32) to disappear. The win32
> dialogs worked correctly with the previous grid, non MFC. I have
> checked the functionality of the win32 dialogs against our old grid,
> for some reason the dialogs that are connected to the MFC dialogs go
> through the message loop less that the ones that are connected to the
> older grid version. the older grid was a based on pure cpp. can some
> one give me any idea on how to fix the problem or just tell me what
> the problem might be.

PostMessage only place the message in the message queue and will not be
processed immediately by the time PostMessage returns. Use SendMessage
instead.
From: bachegool on
On Sep 15, 5:42 pm, Jaelani <jaeju...(a)googlemail.com> wrote:
> bachegool wrote:
> > Hello,
> > I have  this function call
>
> > PostMessage(pDisp->DisplayCommand->MainWidget, PM_OBJECT,
> > SHOW_INSTANCE, 0L);
>
> > as far as I know the message loop should "catch" the "SHOW_INSTANCE"
> > message. For some reason it doesn't catch it. any ideas why?
>
> > ehsan
>
> > P.S. I previously had sent a message to the mfc group about this
> > issue, before I founded out that it was the PostMessage() and message
> > loop. so here is the message:
>
> > I have created a new MFC dialog that loads a custom control grid , by
> > double clicking on cells(not all cells just  one or two columns) it
> > will open a win32 dialog which has its own functionalities. The MFC
> > dialog is a modeless dialog box and is inside a DLL. I have created a
> > function that is exported from the DLL, this will create the dialog
> > box and show it. To run the win32 dialogs that are outside of the DLL
> > I use function pointers and GetProcAddress() to call the functions.
> > The problem is with the win32 dialog boxes, the buttons on them just
> > don't work, they just make the dialogs(win32) to disappear.  The win32
> > dialogs worked correctly with the previous grid, non MFC. I have
> > checked the functionality of the win32 dialogs against our old grid,
> > for some reason the dialogs that are connected to the MFC dialogs go
> > through the message loop less that the ones that are connected to the
> > older grid version. the older grid was a based on pure cpp. can some
> > one give me any idea on how to fix the problem or just tell me what
> > the problem might be.
>
> PostMessage only place the message in the message queue and will not be
> processed immediately by the time PostMessage returns. Use SendMessage
> instead.

it's the same. I've tried it.
From: r_z_aret on
On Tue, 15 Sep 2009 07:11:14 -0700 (PDT), bachegool
<esadeghi48(a)gmail.com> wrote:

>Hello,
>I have this function call
>
>PostMessage(pDisp->DisplayCommand->MainWidget, PM_OBJECT,
>SHOW_INSTANCE, 0L);

Are you sure you have the arguments correct? The 2nd and 3rd arguments
look switched to me.

You've passed 4 arguments, so you're using the Win32 version of the
function. That means the first argument needs to be the HWND for the
window that should receive the message. Is it?


>
>as far as I know the message loop should "catch" the "SHOW_INSTANCE"
>message. For some reason it doesn't catch it. any ideas why?

SHOW_INSTANCE doesn't look like a regular message ID, so I suspect it
is a private message. Are you sure you define it as a number in an
acceptable range (above WM_APP or WM_USER)? I'm not sure when message
need to be registered; I hope someone else will help out.

>
>ehsan
>
>P.S. I previously had sent a message to the mfc group about this
>issue, before I founded out that it was the PostMessage() and message
>loop. so here is the message:
>
>I have created a new MFC dialog that loads a custom control grid , by
>double clicking on cells(not all cells just one or two columns) it
>will open a win32 dialog which has its own functionalities. The MFC
>dialog is a modeless dialog box and is inside a DLL. I have created a
>function that is exported from the DLL, this will create the dialog
>box and show it. To run the win32 dialogs that are outside of the DLL
>I use function pointers and GetProcAddress() to call the functions.
>The problem is with the win32 dialog boxes, the buttons on them just
>don't work, they just make the dialogs(win32) to disappear. The win32
>dialogs worked correctly with the previous grid, non MFC. I have
>checked the functionality of the win32 dialogs against our old grid,
>for some reason the dialogs that are connected to the MFC dialogs go
>through the message loop less that the ones that are connected to the
>older grid version. the older grid was a based on pure cpp. can some
>one give me any idea on how to fix the problem or just tell me what
>the problem might be.

-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).

Robert E. Zaret, eMVP
PenFact, Inc.
20 Park Plaza, Suite 400
Boston, MA 02116
www.penfact.com
Useful reading (be sure to read its disclaimer first):
http://catb.org/~esr/faqs/smart-questions.html
From: Laurent on
"bachegool" <esadeghi48(a)gmail.com> a �crit dans le message de news:
816a737a-25eb-49b8-a469-babbdc46deee(a)l35g2000vba.googlegroups.com...
On Sep 15, 5:42 pm, Jaelani <jaeju...(a)googlemail.com> wrote:
> PostMessage only place the message in the message queue and will not be
> processed immediately by the time PostMessage returns. Use SendMessage
> instead.

>it's the same. I've tried it.

Have you checked if you see it with Spy++ ?