In Files

Parent

Methods

Win32::API::Function

Attributes

address[R]

The numeric address of the function pointer

Public Class Methods

click to toggle source
   API::Function.new(address, prototype = 'V', return_type = 'L')

Creates and returns an API::Function object. This object is similar to an API object, except that instead of a character function name you pass a function pointer address as the first argument, and there’s no associated DLL file.

Once you have your API::Function object you can then call it the same way you would an API object.

Example:

   require 'win32/api'
   include Win32

   LoadLibrary = API.new('LoadLibrary', 'P', 'L')
   GetProcAddress = API.new('GetProcAddress', 'LP', 'L')

   # Play a system beep
   hlib = LoadLibrary.call('user32')
   addr = GetProcAddress.call(hlib, 'MessageBeep')
   func = Win32::API::Function.new(addr, 'L', 'L')
   func.call(0)
static VALUE func_init(int argc, VALUE* argv, VALUE self){

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.