![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Newbie
Join Date: Mar 2005
Posts: 2
Rep Power: 0
![]() |
I am having an extremely hard time with Delphi 6 Personal. I've got the self-registering part down, but (being VBS writer forever) I can't seem to understand why IIS/ASP's CreateObject can't just be replaced with a string-getter to call a DLL that has no object to get some simple information.
Basically, I have a Console EXE that uses inline ASM code to get the CPU clock, CPu vendor, network IP, machine name (via netbios, again, ASM), and uses windows to get some memory status. This EXE outputs tabled HTML that a PHP or ASP (using ASPexe) includes for a full output. However, I don't want to proliferate the user's folders with EXE's to all of this information which they don't need. I've made a function to return the calls (IE "UpTime" returns the string of uptime in days, hours, minutes) to whatever calls them. However, the problem is IIS5 barfs saying invalid ProgID. It's just a function that calls for info from Subs.pas and GetStats.pas, each item is it's own function and all work properly. That's why I think it's in how I'm writing the DLL, since this is the first time trying this. Note: Delphi 6 Personal does *NOT* have any wizards, so what I have, I've found here or elsewhere, and trying to put it together in a working format is a serious pain without docs. library SystemInfo;
uses
ComServ, SysUtils, Classes, ActiveX, ComObj,
Subs, GetStats, winver, CallLocal;
//Put everything I could think I'd use in Users for now, not sure
//what a DLL would use outside Windows, Sysutils and my units.
exports
DllGetClassObject,
DllCanUnloadNow,
DllRegisterServer,
DllUnregisterServer,
SysCall;
{$R *.res}
begin
//Not sure if anything goes here, since the Function I want to
//use is in the Exports list...
end.unit CallLocal;
interface
uses
SysUtils, Windows, Subs, GetStats, winver;
//Note this was written and works as a consol program
function SysCall(itemname: string) : string; export;
implementation
function SysCall(itemname: string) : string;
var
temp: string;
begin
if itemname = 'UpTime' then temp := UpTime;
if itemname = 'OSType' then temp := GetWindowsTypeEx.Product;
if itemname = 'OSKind' then temp := GetWindowsTypeEx.Kind.AsString;
if itemname = 'OSPack' then temp := GetWindowsTypeEx.ServicePack;
if itemname = 'OSVer' then temp := GetWindowsTypeEx.OSVersion.AsString;
if itemname = 'OSSVer' then temp := GetWindowsTypeEx.ServicePackVersion.AsString;
if itemname = 'NetMachineIP' then temp := LocalIP;
if itemname = 'NetMachineName' then temp := GetComputerName;
if itemname = 'NetUserName' then temp := GetUserName;
if itemname = 'HWProcBench' then temp := Format('%f MHz', [CPU_Speed]);
if itemname = 'HWProcVendor' then temp := Cpu_Vendor;
SysCall := temp;
end;
end.I'm not sure at all how to do this, but I hope I can get some help on this, since this is a completely new field for me, having been writing everything self-contained, P-I, and independant of runtimes. Writing for a webserver isn't that easy. Basically, I'd like to see some working self-registering DLL code with a single function that returns text strings to an ASP page that uses: <%
'ASP to try to call the DLLs "SysCall" function with
'parameter "itemname" as "UpTime" to get the uptime string and insert it.
'I'm pretty sure this would be correct, however ASP/IIS barfs
Set Executor = Server.CreateObject("SystemInfo.SysCall")
Response.Write Executor.itemname("UpTime")
%>What I am lacking in is a fully working IIS-usable demo to see how to do this, since Delphi lacks any documentation on this usage. Is there an easier way to write non-object-needing DLL's to just reply a string/integer for a given request? That's basically all I need, not a pile of objects to eat up server memory. Last edited by daemonreaver; Mar 9th, 2005 at 2:13 PM. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|