Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QSharedMemory::handle doesnt exist error [SOLVED]
Forum Updated to NodeBB v4.3 + New Features

QSharedMemory::handle doesnt exist error [SOLVED]

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 3.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Raveendra
    wrote on last edited by
    #1

    I'm trying this bellow QT code :
    @
    #include <QtCore/QCoreApplication>
    #include<QDebug>
    QSharedMemory g_objSharedMemory(QString("Shared Memory"));

    int main(int argc, char *argv[])
    {
        QCoreApplication a(argc, argv);
        if(g_objSharedMemory.isAttached()==false)
        {
            qDebug()<<"Shared memory is not attached !!!!trying to attach it\n ";
            qDebug()<<g_objSharedMemory.errorString();
            if(g_objSharedMemory.attach()==false)
            {
                qDebug()<<"Failed to attach shared memory to the process!!!!";
                qDebug()<<g_objSharedMemory.errorString();
                return 0;
            }
        }
        
        return a.exec&#40;&#41;;
    }@
    

    I'm failed to attach the shared memory segment to the process. I'm building this code on windows xP
    I'm getting "QSharedMemory::handle doesnt exist error".
    How can i fix this error ?

    1 Reply Last reply
    0
    • G Offline
      G Offline
      guziemic
      wrote on last edited by
      #2

      Do you create this memory or it is created by other process?

      1 Reply Last reply
      0
      • R Offline
        R Offline
        Raveendra
        wrote on last edited by
        #3

        oh ya. i got the problem. i didnt created the memory here. so i'm getting error

        1 Reply Last reply
        0
        • G Offline
          G Offline
          guziemic
          wrote on last edited by
          #4

          Good :) If you could please add to the title of post prefix [solved] so other people will know that you find answer.

          1 Reply Last reply
          0
          • R Offline
            R Offline
            Raveendra
            wrote on last edited by
            #5

            i just added
            @ g_objSharedMemory.create(MEMORY_SIZE_BYTES) @
            in the 2nd line of main()

            1 Reply Last reply
            0
            • M Offline
              M Offline
              Macro
              wrote on last edited by
              #6

              Thanks for your Post and Replies guyz... Even i too did the same Mistake trying without creating the memory. After seeing your replies i got to know it.. Thanks a lot...

              Thanks & Regards...

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved