Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Working with Dll

Working with Dll

Scheduled Pinned Locked Moved C / C++ / MFC
questionjsontutorial
13 Posts 2 Posters 0 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.
  • S Suresh H

    Hi Prasad, Thank you very much for the response. I have this ListFiles Function in my Dll File , and I checked in the Console interface its lists all the files , now I want to add each and every file names to win 32 Api interface in the list box. Listfiles function in the Dll file. **STDMETHODIMP_ (void) CMyA::XMyAObj::ListFiles (char *dir) { ----- ---------- ---------------- _chdir(dir); if( (File_handle = _findfirst( "*", &file_s )) == -1L ) { printf( "No files in current directory!\n" ); } else if (file_s.attrib & _A_NORMAL){ sprintf (name, "%s",dir); fnum++; insert (fnum, dir); } else { do { if (strcmp (file_s.name, ".") == 0 || strcmp (file_s.name, "..") == 0) continue; if (strlen (dir) + strlen (file_s.name) + 2 > sizeof (name)) { fprintf (stderr, "Dir name too long\n"); return; } if (file_s.attrib & _A_SUBDIR) { sprintf (name, "%s/%s",dir, file_s.name); ListFiles(name); } ----- ---------- ----------------** In interface I am passing the directory name like this pA->ListFiles(itemText); now I want to know how to extract all the file names and add it to list box in the interface. ???

    P Offline
    P Offline
    prasad_som
    wrote on last edited by
    #4

    Use LB_ADDSTRING message for list box.

    char *pFileName = "SomeThing";
    SendMessage(hLBox,LB_ADDSTRING,0,pFileName);

    Prasad Notifier using ATL | Operator new[],delete[][^]

    S 1 Reply Last reply
    0
    • P prasad_som

      Use LB_ADDSTRING message for list box.

      char *pFileName = "SomeThing";
      SendMessage(hLBox,LB_ADDSTRING,0,pFileName);

      Prasad Notifier using ATL | Operator new[],delete[][^]

      S Offline
      S Offline
      Suresh H
      wrote on last edited by
      #5

      Can I directly access the Interface List box from the Dll ??? is that so simple ???

      P 1 Reply Last reply
      0
      • S Suresh H

        Can I directly access the Interface List box from the Dll ??? is that so simple ???

        P Offline
        P Offline
        prasad_som
        wrote on last edited by
        #6

        What do you mean by interface ? Are you using a UI COM component, havinig list box in it, and you want to add file names to it ?

        Prasad Notifier using ATL | Operator new[],delete[][^]

        S 1 Reply Last reply
        0
        • P prasad_som

          What do you mean by interface ? Are you using a UI COM component, havinig list box in it, and you want to add file names to it ?

          Prasad Notifier using ATL | Operator new[],delete[][^]

          S Offline
          S Offline
          Suresh H
          wrote on last edited by
          #7

          Prasad I have two files now one Win32 api interface (.exe) where I have the list box. 2nd one is I have dll file with List file function. I am passing the parameter to dll from exe by below code IClassFactory *pclsf; IUnknown *pUnk; IMyA *pA; //Initialize the OLE liberaries CoInitialize(NULL); //get the IClassFactory interface pointer HRESULT hr = CoGetClassObject( MYA_CLSID, CLSCTX_INPROC, NULL, IID_IClassFactory, (void **) &pclsf); pA->ListFiles(“Dir name”); now I am actually passing the values to dll which does the process. After that process its list some file names which I have to add in my interface. Since the List box is in Interface(exe), I want to know how to access List box from the dll ??? Can I directly give this code char *pFileName = "SomeThing"; SendMessage(hLBox,LB_ADDSTRING,0,pFileName); in the DLL will this work ???? but how to get handle of the list box and all ??? can u please tell me.

          P 1 Reply Last reply
          0
          • S Suresh H

            Prasad I have two files now one Win32 api interface (.exe) where I have the list box. 2nd one is I have dll file with List file function. I am passing the parameter to dll from exe by below code IClassFactory *pclsf; IUnknown *pUnk; IMyA *pA; //Initialize the OLE liberaries CoInitialize(NULL); //get the IClassFactory interface pointer HRESULT hr = CoGetClassObject( MYA_CLSID, CLSCTX_INPROC, NULL, IID_IClassFactory, (void **) &pclsf); pA->ListFiles(“Dir name”); now I am actually passing the values to dll which does the process. After that process its list some file names which I have to add in my interface. Since the List box is in Interface(exe), I want to know how to access List box from the dll ??? Can I directly give this code char *pFileName = "SomeThing"; SendMessage(hLBox,LB_ADDSTRING,0,pFileName); in the DLL will this work ???? but how to get handle of the list box and all ??? can u please tell me.

            P Offline
            P Offline
            prasad_som
            wrote on last edited by
            #8

            Suresh H wrote:

            Since the List box is in Interface(exe), I want to know how to access List box from the dll ???

            Your interface should have some method to do this. Because, it will have access to window handle. Or, interface should expose listbox's handle as property, where as you can use it from your code.

            Prasad Notifier using ATL | Operator new[],delete[][^]

            S 1 Reply Last reply
            0
            • P prasad_som

              Suresh H wrote:

              Since the List box is in Interface(exe), I want to know how to access List box from the dll ???

              Your interface should have some method to do this. Because, it will have access to window handle. Or, interface should expose listbox's handle as property, where as you can use it from your code.

              Prasad Notifier using ATL | Operator new[],delete[][^]

              S Offline
              S Offline
              Suresh H
              wrote on last edited by
              #9

              Hi Prasad, I am very much new to this .. can u please give an example how to do this. How to pass and access list box from dll.

              P 1 Reply Last reply
              0
              • S Suresh H

                Hi Prasad, I am very much new to this .. can u please give an example how to do this. How to pass and access list box from dll.

                P Offline
                P Offline
                prasad_som
                wrote on last edited by
                #10

                I think you need understanding of COM for this . Who does develop interface in question ?

                Prasad Notifier using ATL | Operator new[],delete[][^]

                S 1 Reply Last reply
                0
                • P prasad_som

                  I think you need understanding of COM for this . Who does develop interface in question ?

                  Prasad Notifier using ATL | Operator new[],delete[][^]

                  S Offline
                  S Offline
                  Suresh H
                  wrote on last edited by
                  #11

                  Prasad I have basic idea of working with COM, like creating dll , Interface , connecting each other etc …. Can u please give me some links where I can get some material on this. Thanking you, Suresh HC.

                  P 1 Reply Last reply
                  0
                  • S Suresh H

                    Prasad I have basic idea of working with COM, like creating dll , Interface , connecting each other etc …. Can u please give me some links where I can get some material on this. Thanking you, Suresh HC.

                    P Offline
                    P Offline
                    prasad_som
                    wrote on last edited by
                    #12

                    To start with, go through Interface[^] basics. Browse articles in same section for more info.

                    Prasad Notifier using ATL | Operator new[],delete[][^]

                    S 1 Reply Last reply
                    0
                    • P prasad_som

                      To start with, go through Interface[^] basics. Browse articles in same section for more info.

                      Prasad Notifier using ATL | Operator new[],delete[][^]

                      S Offline
                      S Offline
                      Suresh H
                      wrote on last edited by
                      #13

                      Thanks Prasad, i will start with that article.

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups