Link to home
Start Free TrialLog in
Avatar of drama22
drama22

asked on

Copy file in dll not working but working on exe !

i am trying to compy files from location with dll here is my code

CopyFile(PChar(AppFolder +'\needed.dll'),Pchar(anotherfolder+'\needed.dll'), False);
memo1.Lines.Add(SysErrorMessage(GetLastError()))

Open in new window


i got The operation completed successfully , but sadly no files has been copied why this working in exe  application and not working in dll application ?

i try to copy file to CSIDL_COMMON_APPDATA path which is  ProgramData folder
Avatar of Pavel Gushchin
Pavel Gushchin

Show us error message.
Avatar of drama22

ASKER

No errors happend. It gives The operation completed successfully ... but not file copied
Try to search the file needed.dll on your disks. I think it was copied in another place.
You could try to output debug info of the AppFolder and anotherfolder from DLL and from EXE and compare them.
Avatar of drama22

ASKER

i searched no it does not copied to another place still exist only in the place that i want copy from .

i think i have  problem with permission in ProgramData  it should not be a problem because its working in exe bur in dll i dont know why its not working , i also unable to create folder inside that path from dll
Check your project settings.
I think you are have the different Character Set for the DLL and for the EXE projects.
One is Unicode, but another is not.
Avatar of drama22

ASKER

Thats really far away from the issue :) i dont know if you are familiar with delphi
Avatar of drama22

ASKER

I've requested that this question be deleted for the following reason:

none of the answer help i already created new question about this
Uhhh, I go through this text and this too ... Where is not recommending write to CSIDL_COMMON_APPDATA ... (as opposite to Microsoft suggestion). Maybe to CSIDL_LOCAL_APPDATA? Or create another sub-folder under CSIDL_COMMON_APPDATA.
Avatar of drama22

ASKER

I will try this sinisa and come back with result
Avatar of drama22

ASKER

The problem is I cannot create subfolder inside common_appdata because dll dont have manifest like in exe I already create question about it here
https://www.experts-exchange.com/questions/28945262/creating-manifest-for-my-dll-that-called-from-activex.html
Yes, it requires admin privilege... Have you try another folder (like CSIDL_LOCAL_APPDATA, inside custom folder)?
Avatar of drama22

ASKER

Yes and its same it gives that file copied but it doesn't
Avatar of drama22

ASKER

its obviously need manifest i tried to create one but i fail i made question about it
Avatar of drama22

ASKER

sense we have another question to handle with the same issue i will close this one
ASKER CERTIFIED SOLUTION
Avatar of drama22
drama22

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of drama22

ASKER

None of answers will help others thats final result .