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
API
2 posts
• Page 1 of 1
API
If anyone knows...
Why does triggering this Ruby code with a button work in design mode but when I compile it to a standalone exe it doesn't work?
Why does triggering this Ruby code with a button work in design mode but when I compile it to a standalone exe it doesn't work?
- Code: Select all
require 'win32API'
api = Win32API.new('user32', 'MessageBox', ['L', 'P', 'P', 'L'], 'I')
message = "This is a sample Windows message box generated using Win32API"
title = "Win32API from Ruby"
api.call(0,message,title,0)
- Attachments
-
- apistuff.fsm
- (1.35 KiB) Downloaded 807 times
- S1User
- Posts: 58
- Joined: Thu Sep 17, 2015 4:05 pm
Re: API
You have to include the right ruby library folder in
$LOAD_PATH global variable
ruby use it to search the required file
When you ship or install your application in other pc, you have to enclose the required file with it.
./-- exe folder
|
|--ruby_library
$LOAD_PATH global variable
ruby use it to search the required file
- Code: Select all
# set the current exe ruby library directory to work with
Dir.chdir("C:\\your app folder\\ruby_library")
# list all sub directory
your_lib_dir=Dir["**/"].reject{|o| not File.directory?(o)}
your_lib_dir.each {|dir|
path = File.expand_path(dir)
# add the path to $LOAD_PATH where ruby search for the require method
$LOAD_PATH.unshift path unless $LOAD_PATH.include? path
}
When you ship or install your application in other pc, you have to enclose the required file with it.
./-- exe folder
|
|--ruby_library
- Tronic
- Posts: 539
- Joined: Wed Dec 21, 2011 12:59 pm
2 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 60 guests