In Ruby's Win32API.new, isn't 'L' the same as 'I', and what about 'N' or 'P'?
I'm looking at the win32-api source code, and it looks like the only difference between 'L' and 'I' is that 'L' calls rb_num2ulong
and 'I' calls rb_num2int
in <ruby.h>
. So I guess the only difference is treatment as a signed value or not. 'P' also results rb_num2ulong
, but it follows additional logic so I would probably stick to what the documentation suggests. I coudln't find any mention of 'N' in the latest version of win32-api (1.4.5), so it's probably deprecated. The Windows APIs do not return boolean
, but some return BOOL
which is (surprise! ) an int
. In short, I don't think you should use 'I' for everything. The win32-api documentation is pretty scant from what I've seen. At least the source code is available for browsing.
How do I call Windows DLL functions from Ruby?
Have a look at Win32API
stdlib. It's a fairly easy (but arcane) interface to the Windows 32 API, or DLLs.
Documentation is here, some examples here. To give you a taste:
require "Win32API"
def get_computer_name
name = " " * 128
size = "128"
Win32API.new('kernel32', 'GetComputerName', ['P', 'P'], 'I').call(name, size)
name.unpack("A*")
end
Can I call REST web services from Windows Mobile app
Yes you can. I've done it lots using the Win32 wininet API.
You can also do it in C# using the System.Net HttpWebRequest API.
Related Topics
What Is The Linux Equivalent Of: Multibytetowidechar & Widechartomultibyte
Why Can Template Instances Not Be Deduced in 'Std::Reference_Wrapper'S
How to Construct or Return the Underlying Deque from a Stack
Accessing Same-Type Inactive Member in Unions
Compiling Simple Static Opengl 4.0 Program Using Mingw, Freeglut and Glew
Conversion from 'Myitem*' to Non-Scalar Type 'Myitem' Requested
Read and Write on Serial Port in Ubuntu with C/C++ and Libserial
How Boost Auto-Linking Makes Choice
Convert from Utf-8 to Unicode C++
What Happens When Calling the Destructor of a Thread Object That Has a Condition Variable Waiting
All K Nearest Neighbors in 2D, C++
Good C++ Array Class for Dealing with Large Arrays of Data in a Fast and Memory Efficient Way
Is It Okay to Use "And", "Or" etc. Instead of "&&", "||"
Factor a Large Number Efficiently with Gmp
Running a Windows Program and Detect When It Ends with C++
Linux, Need Accurate Program Timing. Scheduler Wake Up Program