This is a pop MessaheBox example, but I don't know how to open fiel
dialog?
shell = Win32API.new('user32','MessageBox',['L', 'P', 'P', 'L'],'I')
shell.Call(0,"hello world","ShadowZ",0)
--
Posted via http://www.ruby-forum.com/.
|
|
0
|
|
|
|
Reply
|
iMelody
|
9/23/2010 9:58:11 AM |
|
I find an example from http://www.java2s.com , but pop error:
main.rb:21:in `initialize': failed to create WIN32OLE object from
`MSComDlg.CommonDialog' (WIN32OLERuntimeError)
HRESULT error code:0x80040112
cd = WIN32OLE.new("MSComDlg.CommonDialog")
cd.filter = "All Files(*.*)|*.*" +"|Ruby Files(*.rb)|*.rb"
cd.filterIndex = 2
cd.maxFileSize = 128 # Set MaxFileSize
cd.showOpen()
file = cd.fileName # Retrieve file, path
if not file or file==""
puts "No filename entered."
else
puts "The user selected: #{file}\n"
end
--
Posted via http://www.ruby-forum.com/.
|
|
0
|
|
|
|
Reply
|
iMelody
|
9/24/2010 1:45:53 PM
|
|
On Fri, 24 Sep 2010 08:45:53 -0500, iMelody Ooo <imelody@msn.com>
wrote in <d61562559868e149eda1814ad5283ae1@ruby-forum.com>:
>I find an example from http://www.java2s.com , but pop error:
>
>main.rb:21:in `initialize': failed to create WIN32OLE object from
>`MSComDlg.CommonDialog' (WIN32OLERuntimeError)
> HRESULT error code:0x80040112
Most likely you don't have comdlg32.ocx installed on the box. I'd
just use the raw API via comdlg32.dll instead. Here's a thread that I
found on this topic:
<http://www.groupsrv.com/computers/about185459.html>
--
Charles Calvert
Moderator - alt.computer.consultants.moderated
Submission Address: accm@celticwolf.net
Contact Address: accm_mod@celticwolf.net
|
|
0
|
|
|
|
Reply
|
cbciv (101)
|
10/19/2010 2:33:25 PM
|
|
Charles Calvert wrote in post #955442:
> On Fri, 24 Sep 2010 08:45:53 -0500, iMelody Ooo <imelody@msn.com>
> wrote in <d61562559868e149eda1814ad5283ae1@ruby-forum.com>:
>
>>I find an example from http://www.java2s.com , but pop error:
>>
>>main.rb:21:in `initialize': failed to create WIN32OLE object from
>>`MSComDlg.CommonDialog' (WIN32OLERuntimeError)
>> HRESULT error code:0x80040112
>
> Most likely you don't have comdlg32.ocx installed on the box. I'd
> just use the raw API via comdlg32.dll instead. Here's a thread that I
> found on this topic:
> <http://www.groupsrv.com/computers/about185459.html>
Charles is it possible to open this MessageBox on client side??
--
Posted via http://www.ruby-forum.com/.
|
|
0
|
|
|
|
Reply
|
amittomer25 (21)
|
10/19/2010 2:40:41 PM
|
|
On Thu, 23 Sep 2010 04:58:11 -0500, iMelody Ooo <imelody@msn.com>
wrote in <33bff42a89f93b4fe7d81cb0d212aa9d@ruby-forum.com>:
>This is a pop MessaheBox example, but I don't know how to open fiel
>dialog?
>
>shell = Win32API.new('user32','MessageBox',['L', 'P', 'P', 'L'],'I')
>shell.Call(0,"hello world","ShadowZ",0)
The signature of this function is:
int MessageBox(
HWND hWnd, // handle to owner window
LPCTSTR lpText, // text in message box
LPCTSTR lpCaption, // message box title
UINT uType // message box style
);
so your call looks correct at first glance. Note that user32.dll
doesn't export a function named "MessageBox". Instead, it exports
"MessageBoxA" and "MessageBoxW". The former handles ASCII strings and
the latter wide strings (i.e. Unicode). When writing C or C++ code,
one includes the appropriate headers that define the name "MessageBox"
as one of those two using a macro. It may be that you need to call
the appropriate version of the function directly if the Win32API
library doesn't handle that for you.
--
Charles Calvert
Moderator - alt.computer.consultants.moderated
Submission Address: accm@celticwolf.net
Contact Address: accm_mod@celticwolf.net
|
|
0
|
|
|
|
Reply
|
cbciv (101)
|
10/19/2010 2:58:49 PM
|
|
On Tue, 19 Oct 2010 09:40:41 -0500, Amit Tomar <amittomer25@yahoo.com>
wrote in <7efc8bf3561dcf8c2bf70a0a228d67fe@ruby-forum.com>:
>Charles Calvert wrote in post #955442:
>> On Fri, 24 Sep 2010 08:45:53 -0500, iMelody Ooo <imelody@msn.com>
>> wrote in <d61562559868e149eda1814ad5283ae1@ruby-forum.com>:
>>
>>>I find an example from http://www.java2s.com , but pop error:
>>>
>>>main.rb:21:in `initialize': failed to create WIN32OLE object from
>>>`MSComDlg.CommonDialog' (WIN32OLERuntimeError)
>>> HRESULT error code:0x80040112
>>
>> Most likely you don't have comdlg32.ocx installed on the box. I'd
>> just use the raw API via comdlg32.dll instead. Here's a thread that I
>> found on this topic:
>> <http://www.groupsrv.com/computers/about185459.html>
>
>Charles is it possible to open this MessageBox on client side??
As I just responded to you in another thread, this question makes no
sense. The Win32 API is the API for the 32 bit version of Windows,
which is an OS. It is inherently client-side.
--
Charles Calvert
Moderator - alt.computer.consultants.moderated
Submission Address: accm@celticwolf.net
Contact Address: accm_mod@celticwolf.net
|
|
0
|
|
|
|
Reply
|
cbciv (101)
|
10/21/2010 4:02:23 PM
|
|
|
5 Replies
891 Views
(page loaded in 0.113 seconds)
Similiar Articles: How to open file dialog in Ruby, and get open FileName? :-( - comp ...This is a pop MessaheBox example, but I don't know how to open fiel dialog? shell = Win32API.new('user32','MessageBox',['L', 'P', 'P', 'L'],'I') ... Simply open a file using a variable - comp.lang.rubyHow to open file dialog in Ruby, and get open FileName? :-( - comp ... Variables in dialog box? - comp.soft-sys.matlab How to open file dialog in Ruby, and get open ... File Open Dialog - Files of type - comp.cad.solidworksHow to open file dialog in Ruby, and get open FileName? :-( - comp ... How to open .dvi files - comp.unix.solaris Open file, return to last cursor position? - comp.emacs ... Rewrite data to a file - comp.lang.rubyHow to open file dialog in Ruby, and get open FileName? :-( - comp ... Rewrite data to a file - comp.lang.ruby... how do you rewrite data in ruby? How to open .dvi files - comp.unix.solarisHow to open file dialog in Ruby, and get open FileName? :-( - comp ... How to open .dvi files - comp.unix.solaris Open file, return to last cursor position? - comp.emacs ... Script to save a file and use the auto incremented filename - comp ...How to open file dialog in Ruby, and get open FileName? :-( - comp ... Script to save a file and use the auto incremented filename - comp ... How to call Save As Dialog by ... How to call Save As Dialog by using Script ??? - comp.lang ...How to open file dialog in Ruby, and get open FileName? :-( - comp ... Script to save a file and use the auto incremented filename - comp ... How to call Save As Dialog by ... file download dialog box events - comp.lang.javascriptHow to open file dialog in Ruby, and get open FileName? :-( - comp ... file download dialog box events - comp.lang.javascript How to open file dialog in Ruby, and get open ... Open file, return to last cursor position? - comp.emacsHow to open file dialog in Ruby, and get open FileName? :-( - comp ... How to open .dvi files - comp.unix.solaris Open file, return to last cursor position? - comp.emacs ... Variables in dialog box? - comp.soft-sys.matlabHow to open file dialog in Ruby, and get open FileName? :-( - comp ... Variables in dialog box? - comp.soft-sys.matlab How to open file dialog in Ruby, and get open ... How to open file dialog in Ruby, and get open FileName? :-( - comp ...This is a pop MessaheBox example, but I don't know how to open fiel dialog? shell = Win32API.new('user32','MessageBox',['L', 'P', 'P', 'L'],'I') ... Class: File (Ruby 1.9.3)Returns the last component of the filename given in file_name ... home/gumby/work/ruby.rb") #=> "ruby.rb" File. ... In this instance, File.open returns the value of ... 7/22/2012 4:03:35 AM
|