Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TSHFileOpStruct and AV's

Status
Not open for further replies.

corsair2

IS-IT--Management
Feb 21, 2001
55
0
0
GB
Hi, All

Have the following function in my program (a procedure checks for updated data file on form creation and if found calls this function) -

function WinCopyFile(Source, Dest: string): Boolean;
var
Struct : TSHFileOpStruct;
Resultval: integer;
begin
ResultVal := 1;
try
Source := Source + #0#0;
Dest := Dest + #0#0;
Struct.wnd := 0;
Struct.wFunc := FO_COPY;
Struct.pFrom := PChar(Source);
Struct.pTo := PChar(Dest);
Struct.fFlags:= FOF_SIMPLEPROGRESS or FOF_NOERRORUI or FOF_NOCONFIRMATION;
Struct.fAnyOperationsAborted := False;
Struct.hNameMappings := nil;
Resultval := ShFileOperation(Struct);
finally
Result := (Resultval = 0);
end;
end;

Worked fine until we had latest security updates to OS (NT4) and MS Office (2000) after which the following error is reported when the function is called -

'Access violation at address 77F34EB5 in module ‘kernel32.dll’. Read of address B2D21C11'

Any ideas?

Thanks in advance..
 
Sorry to have bothered anyone but have figured out the fix.

Change the line;

'Struct.fFlags:= FOF_SIMPLEPROGRESS or FOF_NOERRORUI or FOF_NOCONFIRMATION;'

to read;

'Struct.fFlags:= FOF_SIMPLEPROGRESS or FOF_NOCONFIRMATION;'

Noticed when re-reading the MS API notes on SHFileOpStruct that 'FOF_NOERRORUI' is apparently not supported.

Function now works fine. Hope this is useful to someone else!

Regards

Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top