Intro Download and install Frequently Asked Questions Tips and tricks

Homepage







© J.C. Kessels 2009
MyDefrag Forum
May 26, 2013, 09:54:50 am *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: 1 2 3 [4]
  Print  
Author Topic: Error Use Library In Delphi.  (Read 41024 times)
puma
Newbie
*
Posts: 4


View Profile
« Reply #45 on: June 11, 2008, 07:02:08 am »

Yes while Im compiling I get the error I just............  The above error occured on following pascal that you provided in your library. Please guide me.....thankyou 

program Defrag;

{$APPTYPE CONSOLE}

Uses sysutils;
   ///////////////This is the Defragmentor function
procedure RunJkDefrag(
  Path: PWideChar;
  Mode: Integer;
  Speed: Integer;
  FreeSpace: Double;
  Excludes: array of PWideChar;
  SpaceHogs: array of PWideChar;
  Running: PInteger;
  RedrawScreen: PInteger;
  ShowStatus, ShowMove, ShowAnalyze, ShowDebug, DrawCluster, ClearScreen: Pointer;
  DebugMsg: array of PWideChar);
       stdcall; external 'JkDefragLib' name 'RunJkDefrag';
procedure StopJkDefrag(Running: Pointer; TimeOut: Integer);
 stdcall; external 'JkDefragLib' name 'StopJkDefrag';


procedure ShowStatus(Data: pointer); CDECL;
begin
writeln('Show the Status:');
end;

procedure ShowMove(Item: pointer; Clusters, FromLcn, ToLcn, FromVcn: int64); CDECL;
begin
writeln('Show the movement Move:');
end;

procedure ShowAnalyze(Data: pointer; Item: pointer); CDECL;
begin
writeln('Show the analyser Analyze:');
end;

procedure ShowDebug(Level: Integer; Item: Pointer; Format: PChar; Args: Array of const); CDECL;
begin
writeln('The Debug Information: ',Format);
end;

procedure DrawCluster(Data: pointer; ClusterStart, ClusterEnd: int64; Color: Integer); CDECL;
begin
writeln('Draw the Cluster Information:');
end;

procedure ClearScreen(Format: PChar; Args: Array of const); CDECL;
begin
writeln('ClearScreen: ',Format);
end;



var
Excludes : Array of PWideChar = nil;
SpaceHogs : Array[0..2] of PWideChar = (
  '?:\WINDOWS\ServicePackFiles\*',
  '*.zip',
  nil
  );
Running: Integer;
RedrawScreen: Integer;
VolumeName :PwideChar;
DriveId:Integer;
//Running,RedrawScreen:PInteger;
DefaultDebugMsg:Array of PWideChar = nil;
begin
DriveId:=5;
New(VolumeName);
VolumeName:= 'F:';
writeln('Starting Ultra Amco ');
//  DrawCluster(Data: pointer; ClusterStart, ClusterEnd: int64; Color: Integer);
//RunJkDefrag.....................0,0,1
//Volume name C
//Excluded......

Excludes:=nil;
RunJkDefrag(VolumeName,40,40,1,Excludes,
SpaceHogs,@Running,@RedrawScreen,
@ShowStatus,
@ShowMove,@ShowAnalyze,@ShowDebug,
@DrawCluster,
@ClearScreen,
DefaultDebugMsg);
//Volume is free
//
Dispose(VolumeName);
ReadLn;
end.
Logged
jeroen
Administrator
JkDefrag Hero
*****
Posts: 7155



View Profile WWW
« Reply #46 on: June 12, 2008, 03:36:18 am »

I see several differences between your code and the original JkDefrag example. In your code the RunJkDefrag and StopJkDefrag are declared as "stdcall", but in the original as CDECL. And you have defined the "Excludes" as "nil", not as an array of PWideChar.
Logged
puma
Newbie
*
Posts: 4


View Profile
« Reply #47 on: June 12, 2008, 04:43:15 am »

I tried the one provided in example but the story is same, Im facing the same error.  I have created a file of extension .pas, copied the code you have provided and compiled it. but it doesnt work.   Nothing happens.   Thankyou.....  can you tell me the problem.  I re-run the created exe file  on cmd and this is the following response.

Exception EAccessViolation in module JkDefragLib.dll at 00008C27.
Access violation at address 10008C27 in module 'JkDefragLib.dll'. Write of addre
ss 00000002.
Logged
jeroen
Administrator
JkDefrag Hero
*****
Posts: 7155



View Profile WWW
« Reply #48 on: June 12, 2008, 08:30:38 am »

I tried the one provided in example but the story is same, Im facing the same error.
I am sorry, but I have no idea what the problem could be. Your statements about "same error" and "nothing happens" seem to be conflicting, and as far as I know the example should simply work. I am not a Delphi/Pascal programmer myself, so I have no suggestions. Sorry! If you find a solution then please let me know!
Logged
puma
Newbie
*
Posts: 4


View Profile
« Reply #49 on: June 12, 2008, 11:36:58 am »

Ok thaks.......  I have some querries.......

1) How do you get the VCN and LCN of cluster on which the file is copied thorugh FSCTL_GET_RETRIEVAL_POINTERS?

2) FSCTL_GET_VOLUME_BITMAP doesnt give information regarding the LCN and VCN of the clusters so how do I get this information which is used in FSCTL_GET_RETRIEVAL_POINTERS?

3) Does the cluster size matters?
Logged
jeroen
Administrator
JkDefrag Hero
*****
Posts: 7155



View Profile WWW
« Reply #50 on: June 12, 2008, 05:58:57 pm »

I have some querries.......
For more information about those function calls see the Microsoft manuals. For a working example see the sources of JkDefrag, the "JkDefragLib.cpp" file.

Quote
3) Does the cluster size matters?
No, not really. To move a file it's not necessary to know the cluster size.
Logged
C0derr
Newbie
*
Posts: 1


View Profile
« Reply #51 on: November 07, 2010, 03:25:37 pm »

Hi everybody!
I have the same problem with using dll in Delphi.

Exception EAccessViolation in module JkDefragLib.dll at 00008C27.
Access violation at address 10008C27 in module 'JkDefragLib.dll'. Write of addre
ss 00000002.

Has anybody solved it?

PS: I used the example in src without any changes.
PSS: that's very important Smiley
« Last Edit: November 07, 2010, 07:00:53 pm by C0derr » Logged
raybackjoe
Newbie
*
Posts: 1



View Profile
« Reply #52 on: February 04, 2013, 07:28:49 pm »

Thanks for you replied.
Logged

Joe Rayback
643xzvo3r
Newbie
*
Posts: 4


View Profile
« Reply #53 on: May 24, 2013, 03:39:51 am »

In addition to his part-time work with the Afrigo Band,christian louboutin, Cliff also does freelance music production with studios like Soul Records. Cliff s most outstanding achievement is probably the project he has undertaken to rejuvenate the music of his late dad.
A copy of the contract provided to The Associated Press on Friday by the Oklahoma Health Care Authority shows that Dr. W. Scott Harrington was required to keep clean equipment, properly train assistants and develop a safety policy to prevent communicable diseases.
Expecting to see more new immigrants to Singapore as community leaders in the future, Singapore's People's Association is planning to induct more of them into the ranks of grassroots leadership, local TV Channel NewsAsia reported on Saturday.Currently, some 3,000 new immigrants are grassroots leaders. They make up nine percent of Singapore's 33,000-member strong grassroots leadership.The People's Association hopes to make community leaders out of 300 more new Singaporeans -- increasing the proportion of grassroots leaders who are new immigrants from the current nine percent to 10 percent by 2014, according to Channel NewsAsia.Finding new leaders to serve is more than just about creating volunteering opportunities through mass community integration events,ray ban sunglasses, the association will work with clan and immigrant associations to search for potential leaders who are willing to volunteer.Grace Fu with the Prime Minister's Office was quoted as saying that immigrant bodies and local organizations have struck a close working relationship, which in turn promotes deeper cross-cultural understanding.Fu said through interaction with others, grassroots leaders can facilitate common understanding,louboutin shoes, even if it involves the work of dispute resolution."We hope to get more people to step forward and represent views of diverse groups so that the government can actually have a more diverse representation,http://www.raybanrains.com/, and understand the needs of each community stakeholder better," she said."So whether you're a new citizen, old citizen,louis vuitton outlet, we'd like you to step forward,louis vuitton outlet, do something for the society, and that's how we can get engagement from our citizens."
I had a prospective Labour Councillor at my door canvassing about how important it was to preserve services in the face of Government cuts. I was speechless that a clothing allowance of £12000 is more important than preserving possibly one job for a low paid council worker. Of course over 5ys that becomes £60,000 a not inconsiderable sum.
Young students walk home after school in the field of rape flowers in Rong'an County of southwest China's Guangxi Zhuang Autonomous Region, March 5,louboutin pas cher, 2013. Rape flowers began to blossom as temperature went up here, attracting large amount of tourists. (Xinhua/Tan Kaixing)
Related articles:
 
 
   Days after Antrix Corporation the Indian Space Research Organisation s
 
   we had a lot of rain. Four months later
 
   it was irritating rain
Logged
Pages: 1 2 3 [4]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.5 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!