The problem is described in the title.
I have two functions. In the first I get file name (variable text), but the function does not return expected value. After returning the value text, it becomes an abrakadabra. But in the second function variable text is returned correctly. Any help would be greatly appreciated.
char* GetCurrentClipboardData(...)
{
char* text;
wchar_t file[MAX_PATH];
if( OpenClipboard(NULL) )
{
HGLOBAL hFile = (HGLOBAL)GetClipboardData(CF_HDROP);
if (hFile)
{
HDROP hDrop = (HDROP)GlobalLock(hFile);
DragQueryFile(hDrop, 0, file, MAX_PATH);
_bstr_t b(file);
text = b;
if (text != Text)
{
SaveDataToFile (file_path, current_time, text);
char* copy = ReadFile(shadowcopy_path);
if (copy == "1")
MakeFileShadowCopy(file, shadowcopies);
}
GlobalUnlock(hFile);
}
HBITMAP hBitmap = (HBITMAP)GetClipboardData(CF_BITMAP);
if (hBitmap)
{
text = "Изображение";
if (text != Text)
{
SaveDataToFile (image_path, current_time, text);
char* copy = ReadFile(shadowcopy_path);
if (copy == "1")
MakeImageShadowCopy(hBitmap, shadowcopies, current_date, current_time);
}
GlobalUnlock(hBitmap);
}
CloseClipboard();
}
return text;
}