Jump to content

Learning dll calls


 Share

Recommended Posts

Hello!

I think that it is finaly time for me to learn how to practicly do some dll calls, and I found this reference point at msdn and I thought that this would be a good start.

How would I get the total physical memory for example, the reference is: MSDN link

Ps. I do know some c++ / win32 programming, but just a little :P

Edited by monoceres

Broken link? PM me and I'll send you the file!

Link to comment
Share on other sites

  • Moderators

Hello!s say

I think that it is finaly time for me to learn how to practicly do some dll calls, and I found this reference point at msdn and I thought that this would be a good start.

How would I get the total physical memory for example, the reference is: MSDN link

Ps. I do know some c++ / win32 programming, but just a little :P

If you know "some" C++ ... you know that's not a call to a dll right?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

Yes, but I need to work out how you use this in the Psapi.dll dll call.

Which Psapi.dll function are you trying to use?

Edit:

Anyone having an issue with Psapi.dll and GetPerformanceInfo? I keep getting function unknown :P\

Edit2:

I have to run now, here's a "non" working version:

Local $aPERFORMANCE_INFORMATION[15] = ["", "cb", "CommitTotal", "CommitLimit", _
    "PhysicalTotal", "PhysicalAvailable", "SystemCache", "KernelTotal", "KernelPaged", _
    "KernelNonpaged", "PageSize", "HandleCount", "ProcessCount", "ThreadCount"]
    
Local $nCB = 80000
Local $tPERFORMANCE_INFORMATION = DllStructCreate("dword;int[10];dword[3]")
Local $aGPI = DllCall("Psapi.dll", "int", "GetPerformanceInfo", "ptr", DllStructGetPtr($tPERFORMANCE_INFORMATION), "dword", $nCB)
If IsArray($aGPI) Then
    Local $sHold = ""
    For $i = 1 To 14
        $sHold &= $aPERFORMANCE_INFORMATION[$i] & " = " & DllStructGetData($tPERFORMANCE_INFORMATION, $i) & @CRLF
    Next
    MsgBox(64, "Info", $sHold)
EndIf
I can't figure out why it says that the function doesn't exist (I checked, it does)... I'm obviously calling it wrong, and my struct must be set up wrong.... maybe someone would like to take over where I left off... Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • 1 month later...

SmOke_N

I can't figure out why it says that the function doesn't exist

Maybe this will explain it:

PSAPI.DLL (Process Status Helper) is one of the possible DLLs may cause error in Windows system. You may get some error message such as below during the boot up process:

Procedure entry point GetProcessImageFileNameW could not be located in the dynamic link library. PSAPI.DLL

According to Microsoft, there is only one PSAPI.DLL file in your PC and it is under the Windows\System 32 folder. Additional PSAPI.DLL file may be installed by third party programs such as SmartBridge, often the older version. If you have other versions of the PSAPI.DLL file in the system, it can cause your IE 7 or other windows programs that interact with IE7 to crash when you start it up. Beside, you may have annoying error message like above too.

To solve the PSAPI.DLL incompatibility issue and overcome this problem, search your PC or check the program folder of the application that crashes for a PSAPI.DLL file:

Open up Search from Start Menu.

Find all instances PSAPI.DLL on your PC.

Rename all extra copies of PSAPI.DLL files found EXCEPT the one located in \Windows\System32\ folder to some other names like PSAPIOLD.DLL (never delete or do anything with the PSAPI.DLL file in your Windows or Windows/System 32 folder).

Reboot the system.

It work for me if i use full path to system dir, i.e. DllCall(@SystemDir & "\Psapi.dll"....) :).

BTW, the Psapi.dll wil present on all Windows platforms, or only on WIN NT 4? (accourding to the help file).

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

noob help

dll?

cheers C.W

C.Wnew rules:1.dont use plz in a post or title use please instead2.always use help file as it is now muchly over rated3. dont think where not watching u4.please wait 24 hours after last post ot bump XD i use to make that mistake

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...