::PostMessage(HWND_BROADCAST, ...) causes Exception

  • Hello,


    I'm posting a message as a broadcast (on latest kernel 1.26) and get 2 exceptions in debug output of NetDCU11.
    The complete post message looks like:

    Code
    1. BOOL bReturn = ::PostMessage(
    2. HWND_BROADCAST,
    3. WM_USER + 0x66,
    4. 1,
    5. 32);


    The result (bReturn) is 1, so no error accurred.
    Unfortunately I receive in debug output of NetDCU11 following:

    Code
    1. Exception 'Data Abort' (4): Thread-Id=053f0002(pth=83eb59a0), Proc-Id=04070002(p
    2. prc=81f903e4) 'explorer.exe', VM-active=04070002(pprc=81f903e4) 'explorer.exe'
    3. PC=00027f44(explorer.exe+0x00017f44) RA=0002673c(explorer.exe+0x0001673c) SP=000
    4. efb80, BVA=00000030
    5. Exception 'Raised Exception' (-1): Thread-Id=053f0002(pth=83eb59a0), Proc-Id=004
    6. 00002(pprc=81081308) 'NK.EXE', VM-active=04070002(pprc=81f903e4) 'explorer.exe'
    7. PC=c003bc10(k.coredll.dll+0x0001bc10) RA=8011e2c0(kernel.dll+0x000062c0) SP=d15b
    8. f370, BVA=ffffffff


    It seems that the reason is the LPARAM parameter 32. When I change it to 0, there is no exception.
    A change into MAKELPARAM(32, 0) does not help.


    Can I ignore that or is that a problem?
    On NetDCU6 that worked without exceptions!


    Thanks a lot in advance,


    Kaiser.

  • Hello,
    strange, i think your message causes an action within an other application (exploren?) which causes the exception!


    Do you really need WM_BROADCAST, it is not enought to send the message to one special window?
    Did you try "RegisterWindowMessage()"?

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

  • Hello,


    HWND_BROADCAST was the fastest/easiest way to post messages to several applications running in the background.
    By the way, I haven't tried "RegisterWindowMessage()" method. Maybe this is a good solution. Will try this soon.
    Thanks a lot.


    Kaiser

  • Hello,


    there is a better/faster way to solve that problem. I just needed to replace WM_USER with WM_APP.

    Code
    1. BOOL bReturn = ::PostMessage(
    2. HWND_BROADCAST,
    3. WM_APP + 0x66,
    4. 1,
    5. 32);


    Best regards, Kaiser.