locked
WriteMsgQueue Fails RRS feed

  • Question

  • why writemsgqueue fails with insufficient buffer even the buffer is large enough to hold the data?

     

     

     


    Thanks & Regards Ezhilmani.R
    Thursday, April 8, 2010 11:55 AM

All replies

  • hi,

    can you post more details please, some code snipsets to help us help you :)


    If you find my post helpful, please market as an answer or vote for it.
    Check out the DualTouch SDK for Resistive touchscreens (WM) http://www.windowsphoneme.com/?p=386
    Visit our community, http://www.windowsPhoneME.com
    Friday, April 9, 2010 4:38 PM
  • Hi MANI 007,

    Do you solve the issue, if not, like Adel's suggestion, can you provide some code about the issue?

     

    Best regards,
    Guang-Ming Bian - MSFT


    Please remember to mark the replies as answers if they help and unmark them if they provide no help
    Monday, April 12, 2010 9:18 AM
  • hi,

    apolgise for the delay....here is the code snippet....

     

    MSGQUEUEOPTIONS myoptions;

     

    myoptions.dwSize=(BYTE)

    sizeof(MSGQUEUEOPTIONS);

    myoptions.dwFlags=MSGQUEUE_ALLOW_BROKEN ;

    myoptions.dwMaxMessages=0;

    myoptions.cbMaxMessage=1024;

    myoptions.bReadAccess=FALSE;

    DWORD errorval = 0;

     

    myqueueretval = CreateMsgQueue(TEXT(

    "MYQUEUE"),&myoptions);

     

     

    //HANDLE myqueueretval1=0;

    myqueueretval1 = OpenMsgQueue(g_hInst,myqueueretval,&myoptions);

     

     

    ReadMessage(g_hInst,myqueueretval1);

     TCHAR buff[10]= {

    'e','z','h','i','l'};

    BOOL val = WriteMsgQueue(myqueueretval,buff,INFINITE,6,0);

    DWORD ret = GetLastError();


    Thanks & Regards Ezhilmani.R
    Monday, April 12, 2010 11:22 AM
  • Most likely becuase you you applied the wrong arguments to thze cbDataSize / dwTimeout parameters

    The Signature is defined as:

    BOOL WriteMsgQueue (HANDLE hMsgQ, LPVOID lpBuffer, DWORD cbDataSize, DWORD dwTimeout, DWORD dwFlags);

    So, your code sould look like this:

    BOOL val = WriteMsgQueuev(myqueueretval,buff,6,INFINITE,0);

    MVP Windows Embedded
    Monday, April 19, 2010 5:20 PM