Вопрос

I am using FindFirstFile to traverse through a directory to search a dll.

When I get the dll, I use the WIN32_FIND_DATA structure's cfilename to get the name of that dll.

Now, I want to pass the dll to the function LoadLibrary() which expects Absoulte path to the dll.

Here's the Problem: The cfilename of WIN32_FIND_DATA structure returns a TCHAR[] array, which is just the name of the dll, not its path. I Should concatenate the path to the name to get the Absolute path.

The LoadLibrary() expects a LPCWSTR as parameter.

I need help: (1) To Convert the TCHAR[] returned by WIN32_FIND_DATA's cfilename to LPCWSTR (2) to concatenate the above converted LPCWSTR with a predefined path (L"C:\dir\example\") to get absolute path.

Any nudge towards right answer will make my day :)

regards, andy

Это было полезно?

Решение

Actually, LoadLibrary takes a LPCTSTR, so problem 1 is no longer an issue. Problem 2 is simple string concatenation.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top