forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


C++ Extensions DLLs developer - Take a look at this please

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
henrywood
Contributor
Contributor


Joined: 21 Sep 2004
Posts: 66
Location: Copenhagen, Denmark

PostPosted: Thu Sep 01, 2005 10:17 pm    Post subject: C++ Extensions DLLs developer - Take a look at this please Reply with quote

Hi guys !

I have a Visual C++ CPUUsage Class with this functions:

int processID=0;
CCpuUsage usageA;
CCpuUsage usageB;
CCpuUsage usageC;

int SystemWideCpuUsage = usageA.GetCpuUsage();
int ProcessCpuUsageByName = usageB.GetCpuUsage("explorer");
int ProcessCpuUsageByID = usageC.GetCpuUsage(processID);



I am looking for either someone being able to compile this into a VDS DLL for me OR a C++ Extension sample so I may do it myself.

I tried visiting developer.vdsworld.com but it was closed ?

I have attached the class source


Henrik



CpuUsage_src.zip
 Description:

Download
 Filename:  CpuUsage_src.zip
 Filesize:  7.15 KB
 Downloaded:  1289 Time(s)

Back to top
View user's profile Send private message Send e-mail
henrywood
Contributor
Contributor


Joined: 21 Sep 2004
Posts: 66
Location: Copenhagen, Denmark

PostPosted: Fri Sep 09, 2005 7:05 pm    Post subject: Tried building a nonVDS DLL for this - Please help Reply with quote

Hi guys !

I tried building a non-VDS DLL for this and it builds OK

I have this test script

Code:



#INCLUDE cpupu.dsc

#list create,1
#list tasklist,1,NI
#info @text(1)

# Get systemwide CPU usage
%A = @getCPUUsage(Get)
# Get usage for a specific process name: @getCPUUsage(get,<exename>,<list>)
%B = @getCPUUsage(get,Skype.exe,1)
# Get usage for a specific process ID: @getCPUUsage(get,<ProcessID>,<list>)
%C = @getCPUUsage(get,3404,1)
%D = SystemWide CPU Usage: %A "%" @cr()Skype.exe Usage: %B "%" (ByName)@cr()Skype.exe Usage: %C "%" (by ID)
info %D
freelib test
stop



and cpupu.dsc contains

Code:

#
# Contents of test.h
#
# #ifdef TEST_EXPORTS
# #define TEST_API __declspec(dllexport)
# #else
# #define TEST_API __declspec(dllimport)
# #endif
#
# ///////////////////////////////////////////////////////
# //
# // EXPORTS
# //
# ///////////////////////////////////////////////////////
#
# TEST_API int GetSystemWideCpuUsage(void);
# TEST_API int GetCPUUsageByID ( DWORD dwProcessID );
# TEST_API int GetCpuUsageByName(LPCTSTR pProcessName);
#

#DEFINE FUNCTION,getCPUUsage

:getCPUUsage
goto getCPUUsage_%1

:getCpuUsage_Get
%R =
LOADLIB test.dll

if @numeric(%2)

   if @getCPUUsage(ProcessIDExists,%2,%3)

   %R = @lib(test.dll,GetCPUUsageByID,int:,int:%2)

   else
      error 9001
   end
   
elsif %2

   if @getCPUUsage(ProcessExists,%2,%3)

      %R = @lib(test,GetCpuUsageByName,int:,str:@name(%2))

   else
      error 9001
   end

else

   %R = @lib(test,GetSystemWideCpuUsage,int:)

end

exit %R

:getCPUUsage_ProcessIDExists
%R =
list create,%3
list tasklist,%3,I
%C = @match(%3,%2)
list close,%3
exit %C

:getCPUUsage_ProcessExists
%R =
list create,%3
list tasklist,%3,N
%C = @match(%3,%2)
list close,%3
exit %C


The problem is that I keep getting "Library function not found" error in VDS. I included the declarations in test.h (my dll is called test) above and they appear to be OK and I can see them as exports with PEBrowser Pro ?

So why cant I call this functions ?

Exports as seen by PEBrowserPro:

int __cdecl GetSystemWideUsage(void)
int __cdecl GetCpuUsageByName(char const*)
int __cdecl GetCPUUsageByID(unsigned long)


I take it that case is important ?

I have compiled using MS Visual Studio 2003

Can anyone shed some light on this, please ?


Henrik
Back to top
View user's profile Send private message Send e-mail
ShinobiSoft
Professional Member
Professional Member


Joined: 06 Nov 2002
Posts: 790
Location: Knoxville, Tn

PostPosted: Fri Sep 09, 2005 7:21 pm    Post subject: Reply with quote

Are you including a ".DEF" file in your build process?
The .def file contains the names of your exported functions. See your
compilers documentation for more on a .def file.

_________________
Bill Weckel
ShinobiSoft Software

"The way is known to all, but not all know it."
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
henrywood
Contributor
Contributor


Joined: 21 Sep 2004
Posts: 66
Location: Copenhagen, Denmark

PostPosted: Sat Sep 10, 2005 8:32 am    Post subject: DEF file Reply with quote

Hi Bill !

I was wondering about the DEF file. It is not compiled in so that may be it.
As mentioned I compiled with MS VS 2003 and they didn't mention anything about a DEF file. However Dev-Cpp and LCC I thinks mentions them in tutorials etc. However I cannot compile using those due to missing include files...

But I will check the MS VC++ doc for def file info

Thanks !
Back to top
View user's profile Send private message Send e-mail
henrywood
Contributor
Contributor


Joined: 21 Sep 2004
Posts: 66
Location: Copenhagen, Denmark

PostPosted: Sat Sep 10, 2005 12:10 pm    Post subject: CPUPU.DLL Released Reply with quote

Hi guys !

I just finished the CPUPU DLL.

It provides possibilities for:

- Getting the system wide CPU Usage
- Getting the CPU Usage of a process specified either by name or process ID

Please note that this is a NON-VDS DLL. Therefore it comes with a VDS Wrapper to ease its use.

Please see included demo for help on its usage.


You can download it here:

http://www.vdsworld.com/download.php?id=475



Henrik
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group