Sign in to follow this  

Post message from dll function

This topic is 4840 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I have a client app with a progress bar ( MFC Visual C++). The client calls a dll function , and I need to update the progress bar on the client dialog from my dll function,i'm using this setting:
ClientDlg.h app:

#define WM_USER_UPDATE_PROGRESS (WM_APP+0x102)

afx_msg LRESULT OnUpdateProgress(WPARAM wParam,LPARAM lParam);
//------------------------------------------------------------
ClientDlg.cpp app:

ON_MESSAGE(WM_USER_UPDATE_PROGRESS, OnThreadUpdateProgress)
LRESULT CClientDlg::OnUpdateProgress(WPARAM wParam,LPARAM lParam)
{
     m_ProgressBar.SetPos(100*(int)wParam/(int)lParam);
     return 0;
}


After transfering the CWnd* pWnd from the client app,and including the header file of the message definitions,i tried to call this function:
pWnd->PostMessage(WM_USER_UPDATE_PROGRESS,3,100);
from my dll function, but I'm getting Assertion Failed:-( What seems to be the problem? Dani. (Edited by moderator to utilise [ source ][ /source ] tags) [Edited by - Timkin on September 15, 2004 6:51:48 PM]

Share this post


Link to post
Share on other sites
First off, I find it somewhat humourous that you have a variable name "pWnd".[smile] *Ahem* Humour aside, however:

Clicky

This appears to be a tutorial site that contains source code similiar to the stuff you provided. I would think, at first glance, that your error lies in the fact that you have "OnUpdateProgress", then "OnThreadUpdateProgress", then "OnUpdateProgress". But then again, I know little in this area(DLL's and threads). Hope it helps!

Share this post


Link to post
Share on other sites

This topic is 4840 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this