Working with Dll
-
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 thispA->ListFiles(itemText);
now I want to know how to extract all the file names and add it to list box in the interface. ???Use
LB_ADDSTRING
message for list box.char *pFileName = "SomeThing";
SendMessage(hLBox,LB_ADDSTRING,0,pFileName);Prasad Notifier using ATL | Operator new[],delete[][^]
-
Use
LB_ADDSTRING
message for list box.char *pFileName = "SomeThing";
SendMessage(hLBox,LB_ADDSTRING,0,pFileName);Prasad Notifier using ATL | Operator new[],delete[][^]
-
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[][^]
-
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[][^]
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 codechar *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. -
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 codechar *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.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[][^]
-
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[][^]
-
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.
I think you need understanding of COM for this . Who does develop interface in question ?
Prasad Notifier using ATL | Operator new[],delete[][^]
-
I think you need understanding of COM for this . Who does develop interface in question ?
Prasad Notifier using ATL | Operator new[],delete[][^]
-
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.
To start with, go through Interface[^] basics. Browse articles in same section for more info.
Prasad Notifier using ATL | Operator new[],delete[][^]
-
To start with, go through Interface[^] basics. Browse articles in same section for more info.
Prasad Notifier using ATL | Operator new[],delete[][^]