Hi, all!
I have some experience with RasDial, but there are some things I am not quite
sure about. I've been trying to investigate the issues I'm having, but I can't
seem to find the right answers. I think my problem is fairly simple. I'm hoping
that someone out there has done what I want to do and can give me some
information about how to "fix" the problem.
I'm developing in eVC4 on a Pocket PC (2003). I have a dialog that creates an
instance of CDataComm (a class I created that will create a RAS entry and then
dial it). This class has a function called Connect(), which will dial the
specified RAS entry. (Note: the class is rather specific to our applications and
is not intended to be generic in any way. Suffice it to say that I am able to
create an entry and start dialing with RasDial.) The Connect() function calls
RasDial(NULL,NULL,0xFFFFFFFF,m_hWnd,&m_hRasConn) and it returns immediately, as
it should. I then go into a loop checking the connection status. I want RasDial
to send the WM_RASDIALEVENT to my dialog so it can trap and handle any specific
error conditions. Also, the dialog will "communicate" with the class object
using CDataComm::HandleEvent(x). This will indicate to the object that the user
has requested something to be done (i.e.: retry the connection, cancel, etc.).
I think that, logically, I have everything worked out. However, the RasDial()
function doesn't seem to be sending the messages to my dialog. I've tried using
the m_hWnd of the dialog, as well as the dialog's "this" pointer. Neither are
working.
To recap:
1. CMyDialog creates an instance of CDataComm and "registers" itself.
2. CMyDialog provides a message map/handler for WM_RASDIALEVENT.
3. CMyDialog calls CDataComm::Connect() to connect to the RAS entry.
4. CDataComm calls RasDial() with the window handle and returns immediately.
5. Connect() goes into a loop reading statuses and user-specific requests.
6. The CMyDialog event handlers are *NOT* called. (this is the problem)
Hopefully, someone has had this problem and can tell me what I'm doing wrong.
Thanks,
Kevin
GG - 23 Jul 2008 16:35 GMT
> Hi, all!
[cut]
> To recap:
> 1. CMyDialog creates an instance of CDataComm and "registers" itself.
[quoted text clipped - 8 lines]
> Hopefully, someone has had this problem and can tell me what I'm doing
> wrong.
I had the same problem a while ago. Are you using MFC ? AFAIR it's a problem
in MFC (don't remember exactly why). My workaround was to override
PreTranslateMessage in the CDialog-derived class and handle the
WM_RASDIALEVENT message here.
HTH,

Signature
Giuseppe Govi
Kevin - 23 Jul 2008 16:42 GMT
>> Hi, all!
> [cut]
[quoted text clipped - 17 lines]
>
> HTH,
Thanks! I've not done that before, but I'll try it.
Kevin
Kevin - 23 Jul 2008 17:23 GMT
>> Hi, all!
> [cut]
[quoted text clipped - 17 lines]
>
> HTH,
I overrode the PreTranslateMessage() function, but it's not seeing my messages.
I know it's working, because I set a breakpoint at the beginning of the function
and the application stopped.
I might understand why WM_RASDIALRETRY would not work, since it is a message I
made up. Maybe I didn't register the message or something. But, WM_RASDIALEVENT
is a "registered" message. Is there something else I'm not doing that would make
this work? Am I not providing the correct handle or pointer to my dialog? Also,
I'm using PostMessage(WM_RASDIALRETRY,w,l) to post my message. I thought
RasDial() would automatically post the WM_RASDIALEVENT.
Thanks for your help!
Frustrated (Kevin)
Darren Beckley - 07 Aug 2008 21:28 GMT
> I think that, logically, I have everything worked out. However, the
> RasDial() function doesn't seem to be sending the messages to my dialog.
> I've tried using the m_hWnd of the dialog, as well as the dialog's "this"
> pointer. Neither are working.
WM_RASDIALEVENT is defined in ras.h as 0xCCCD which is in the range for
registered events, so try using ON_REGISTERED_MESSAGE() in your MFC message
map e.g.
static UINT uiRasDialEvent = WM_RASDIALEVENT;
BEGIN_MESSAGE_MAP(CMyRasDlg, CDialog)
...
ON_REGISTERED_MESSAGE(uiRasDialEvent, OnRasDialEvent)
...
END_MESSAGE_MAP()
Of course you normally have to use RegisterWindowMessage() to get the
numeric value of a registered message, but since the numeric value of
WM_RASDIALEVENT is defined in ras.h I'm assuming it's always the same.
Hope that helps,
Darren