If you have a problem or need to report a bug please email : support@dsprobotics.com
There are 3 sections to this support area:
DOWNLOADS: access to product manuals, support files and drivers
HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects
USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here
NEW REGISTRATIONS - please contact us if you wish to register on the forum
Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright
Ruby: Win32::API::Callback object?
8 posts
• Page 1 of 1
Ruby: Win32::API::Callback object?
manual describes the possibility of using inTypes as a callback
K or k - a Win32::API::Callback object?
but this is not possible because there is not the extension used, it seems to be an external,
I believe this win32-api
then not already being equipped how to proceed in order to have the possibility to use callback with Win32API?
however, I wanted to draw attention to that with Win32API does not seem the best way to load DLL.
there are many external extensions whose work is much better.
So the other question is:
You can get instructions on how to build from Visual Studio, the extensions?
which sdk use? which version of ruby is.
thanks as always for your attention.
K or k - a Win32::API::Callback object?
but this is not possible because there is not the extension used, it seems to be an external,
I believe this win32-api
then not already being equipped how to proceed in order to have the possibility to use callback with Win32API?
however, I wanted to draw attention to that with Win32API does not seem the best way to load DLL.
there are many external extensions whose work is much better.
So the other question is:
You can get instructions on how to build from Visual Studio, the extensions?
which sdk use? which version of ruby is.
thanks as always for your attention.
- Tronic
- Posts: 539
- Joined: Wed Dec 21, 2011 12:59 pm
Re: Ruby: Win32::API::Callback object?
Sorry Tronic, I don't quite understand your question. Would you be able to re-phrase or explain further. Are you asking how to use a callback?
-
support - Posts: 151
- Joined: Fri Sep 07, 2012 2:10 pm
Re: Ruby: Win32::API::Callback object?
apologizes,
too many questions in one.
in order:
1. in the manual it says to use K or k - a Win32::API::Callback object, as inTypes
but Win32::APi is not present as a library.
So you have to add it to use the inTypes K?
2. How to compile other libraries, so that the version of ruby inside recognizes them?
As I understand your ruby is compiled with Visual Studio, so if I wanted to generate other compiled libraries, such as those already accompanied Win32API etc.., What version of ruby to use, and what to keep this in Visual Studio to get it to work?
Finally, an example of how to use an external library with a callback would definitely help.
Thank you for your patience, unfortunately English is not my native language.
too many questions in one.
in order:
1. in the manual it says to use K or k - a Win32::API::Callback object, as inTypes
but Win32::APi is not present as a library.
So you have to add it to use the inTypes K?
2. How to compile other libraries, so that the version of ruby inside recognizes them?
As I understand your ruby is compiled with Visual Studio, so if I wanted to generate other compiled libraries, such as those already accompanied Win32API etc.., What version of ruby to use, and what to keep this in Visual Studio to get it to work?
Finally, an example of how to use an external library with a callback would definitely help.
Thank you for your patience, unfortunately English is not my native language.
Last edited by Tronic on Sun Nov 11, 2012 2:05 pm, edited 1 time in total.
- Tronic
- Posts: 539
- Joined: Wed Dec 21, 2011 12:59 pm
Re: Ruby: Win32::API::Callback object?
Yes, this is something I'd like to know too. Could you give us a simple example on how to use a win32 api call with a callback function pointer? For example the midiInOpen function:
http://msdn.microsoft.com/de-de/library ... 85%29.aspx
and it's callback:
[Edit, additional notes:]
Pretty all Ruby examples that cover callbacks require the 'win32/api' lib rather than 'Win32API' (http://stackoverflow.com/questions/3327 ... e-but-what).
Also I read somewhere that "Win32API is now (after 1.9.x) deprecated in favor of using the DL library". What's your take on this?
But since your manual mentions the 'k' key for callbacks, providing an example should be an easy task for you, right?
http://msdn.microsoft.com/de-de/library ... 85%29.aspx
- Code: Select all
MMRESULT midiInOpen(
LPHMIDIIN lphMidiIn,
UINT uDeviceID,
DWORD_PTR dwCallback,
DWORD_PTR dwCallbackInstance,
DWORD dwFlags
);
and it's callback:
- Code: Select all
void CALLBACK MidiInProc(
HMIDIIN hMidiIn,
UINT wMsg,
DWORD_PTR dwInstance,
DWORD_PTR dwParam1,
DWORD_PTR dwParam2
);
[Edit, additional notes:]
Pretty all Ruby examples that cover callbacks require the 'win32/api' lib rather than 'Win32API' (http://stackoverflow.com/questions/3327 ... e-but-what).
Also I read somewhere that "Win32API is now (after 1.9.x) deprecated in favor of using the DL library". What's your take on this?
But since your manual mentions the 'k' key for callbacks, providing an example should be an easy task for you, right?
- rlr
- Posts: 27
- Joined: Tue Jul 13, 2010 9:17 pm
Re: Ruby: Win32::API::Callback object?
More investigation, more confusion: As Tronic said in his post it looks like you used win32/api rather than win32API, but there are differences (other library name, different ordering of parameters), so maybe you've built a customized version.
Also there seems to be some traces of the 'dl' library.
require 'dl' does not work, but require 'win32API' creates some objects of the dl library (not the full set though).
Bottom line: Dear FS team, I think the best is to provide an example on how to use an external call with a callback as in midiInOpen (see post above) or EnumWindows.
(These callback functions can be found all over the win32 api).
Also I'd like to know what parts of the dl library are supported.
Thank you for your attention
Also there seems to be some traces of the 'dl' library.
require 'dl' does not work, but require 'win32API' creates some objects of the dl library (not the full set though).
Bottom line: Dear FS team, I think the best is to provide an example on how to use an external call with a callback as in midiInOpen (see post above) or EnumWindows.
(These callback functions can be found all over the win32 api).
Also I'd like to know what parts of the dl library are supported.
Thank you for your attention
- rlr
- Posts: 27
- Joined: Tue Jul 13, 2010 9:17 pm
Re: Ruby: Win32::API::Callback object?
Thanks for clarifying your questions Tronic. No need to apologise whatsoever. I should have been able to answer this without the need for clarification but was in a bit of a rush.
So it's actually us that need to apologise, seems we made an error when documenting. As you may have found, good information on all of this is quite hard to find. Win32API::API::Callback objects are part of Win32::API and not Win32API. When putting together the parameter types we got our wires crossed and mistakenly put the K parameter on the list thinking it was one that was supported. This should have been checked and spotted so apologies for that. We have updated the user guide to correct this.
The version of Win32API we are using is not custom built, it's the standard one from the 1.9.3. You're right that after 1.9.1 it is deprecated so it's using dl under the hood to provide the necessary functionality.
We decided to use this version of Win32API for several reasons but the main reason was that we tried it and it works. It's also less complicated to describe how it works (compared with dl), or at least it is if you don't make an error in your documentation! .
I appreciate that this still leaves you without an answer as to how to use a callback with an external DLL. As Win32::API appears to support this I would be tempted to look in that direction. We'd need to look into it further but that may take a while. Sorry for not being able to bring you better news.
Now, Tronic regarding compiling other libraries using Visual Studio - this isn't something we have tried yet so I can't help much here either at the moment. To compile the ruby dll we used the make file and .bat files that are provided in the Win32 folder of 1.9.3. More investigation is required here too.
So it's actually us that need to apologise, seems we made an error when documenting. As you may have found, good information on all of this is quite hard to find. Win32API::API::Callback objects are part of Win32::API and not Win32API. When putting together the parameter types we got our wires crossed and mistakenly put the K parameter on the list thinking it was one that was supported. This should have been checked and spotted so apologies for that. We have updated the user guide to correct this.
The version of Win32API we are using is not custom built, it's the standard one from the 1.9.3. You're right that after 1.9.1 it is deprecated so it's using dl under the hood to provide the necessary functionality.
We decided to use this version of Win32API for several reasons but the main reason was that we tried it and it works. It's also less complicated to describe how it works (compared with dl), or at least it is if you don't make an error in your documentation! .
I appreciate that this still leaves you without an answer as to how to use a callback with an external DLL. As Win32::API appears to support this I would be tempted to look in that direction. We'd need to look into it further but that may take a while. Sorry for not being able to bring you better news.
Now, Tronic regarding compiling other libraries using Visual Studio - this isn't something we have tried yet so I can't help much here either at the moment. To compile the ruby dll we used the make file and .bat files that are provided in the Win32 folder of 1.9.3. More investigation is required here too.
-
support - Posts: 151
- Joined: Fri Sep 07, 2012 2:10 pm
8 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 67 guests