Intro Download and install Frequently Asked Questions Tips and tricks

Homepage







© J.C. Kessels 2009
MyDefrag Forum
May 22, 2013, 12:20:03 am *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: VB6 with dll  (Read 7070 times)
hermick
Newbie
*
Posts: 4


View Profile
« on: January 04, 2007, 01:56:00 am »

How can I call the JKDefrag .dll from my VB 6 project? Stupid question, perhaps, but hopefully a simple one.
Logged
jeroen
Administrator
JkDefrag Hero
*****
Posts: 7155



View Profile WWW
« Reply #1 on: January 04, 2007, 11:28:29 am »

As far as I know nobody has tried VB 6 yet, certainly nobody has posted an example. The only DLL documentation are the comments in the sources. Take a look at "JkDefragDll.h", it describes all the calls available in the DLL. There are only three: RunDefrag, StopDefrag, and DefragInitialize. The last one needs 6 callback functions that you have to create, and an array with textstrings. See JkDefrag.cpp for a working example in C. I think it's a relatively simple DLL, as they go, and I am told it's fairly easy to use.
Logged
hermick
Newbie
*
Posts: 4


View Profile
« Reply #2 on: March 06, 2007, 04:44:10 am »

How about C#? I'm new with the language, and I'm having trouble getting the callback functions to work. I've tried to remove the callback functions from the dll code, just to see if I can get RunDefrag() to work, but even that fails, telling me:

"Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

I'm not trying to do anything fancier than call the .dll from a C# windows service. I encounter the same error accessing it from a regular Windows application.
Logged
jeroen
Administrator
JkDefrag Hero
*****
Posts: 7155



View Profile WWW
« Reply #3 on: March 06, 2007, 06:59:30 am »

Quote from: "hermick"
How about C#?

I don't know... The DLL has been compiled with Visual C++ 2005, so I would be very surprised if it does not work with C#. If have no example code or anything like that, sorry.
Logged
hermick
Newbie
*
Posts: 4


View Profile
« Reply #4 on: March 06, 2007, 07:19:26 pm »

Is there *any* example code of anybody using the .dll in *any* language? And is the developer the only one who actually reads these posts? I assumed I was talking to a community.
Logged
jeroen
Administrator
JkDefrag Hero
*****
Posts: 7155



View Profile WWW
« Reply #5 on: March 07, 2007, 10:47:41 am »

Yes, Matt has posted some Delphi code in another thread. I agree that the developer section isn't very busy. My impression is that most of the DLL users are developers working for companies, and don't want to share their code.
Logged
Mamba
Newbie
*
Posts: 1


View Profile
« Reply #6 on: May 16, 2007, 07:04:31 am »

My impression: This isn't your usual ActiveX/COM dll we VB folk are used to. Notice that you can't register it with regsvr or within the VB IDE. It's a regular old Windows C++ dll. I think you're going to have to declare it with the proper parameters like you would one of the Windows API dlls in the declarations section of your form. Judging from the comments, I assume none of us are up to snuff on that. The only time I've done it just copying code. Throw in the callbacks and it's not for the inexperienced.

Unless someone comes up with a code example in VB or writes a COM wrapper for the dll, I'm not gonna mess with it. If you just need it for personal use, just do what I did and make a form to gather the parameters and shell execute the exe version.[/img]
Logged
Pages: [1]
  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!