From: Manish Sapariya Date: 2007-12-17T22:02:32+09:00 Subject: help using ruby/dl to pass LPDWORD Hi All, I want to get the process ID by supplying the window handle to the following API. DWORD GetWindowThreadProcessId(HWND hWnd,LPDWORD lpdwProcessId); However I am failing to understand how can I pass the Pointer to DWORD to DL call object. I tried passing PtrData object, but it does not seem to be returning the PID value as I had expected. Following is my irb session: =========================================== irb(main):001:0> require 'dl' => true irb(main):002:0> rpid = 0 => 0 irb(main):004:0> ptr = DL::PtrData.new(rpid) => # irb(main):005:0> user32=DL.dlopen("user32") => # irb(main):006:0> getpid = user32['GetWindowThreadProcessId', 'LLP'] => # irb(main):007:0> getpid.call(0x00120464, ptr) => [4032, [1180772, #]] irb(main):008:0> p ptr # => nil =========================================== I was expecting to ptr data to change to the pid of my process, however it has not changed at all. Am I missing something obvious. Is there any other way I can do this. Thanks and Regards, Manish