source: project/wiki/eggref/4/win32-msgbox @ 29336

Last change on this file since 29336 was 29336, checked in by mikele, 7 years ago

dropped colons in examples

File size: 3.7 KB
Line 
1[[tags: egg]]
2[[toc:]]
3
4== win32-msgbox
5
6win32-msgbox is a Scheme interface to the Windows API [[http://msdn.microsoft.com/en-us/library/windows/desktop/ms645505(v=vs.85).aspx|MessageBox]] function.
7
8<enscript highlight=sh>
9[procedure] (msgbox MSG #!key (title "")
10                              (buttons 'ok)
11                              (default-button 1)
12                              (icon 'none)
13                              (foreground #t)
14                              (topmost #f))
15
16</enscript>
17
18Valid symbols for the ''buttons'' option are:
19
20* ok
21* ok/cancel
22* abort/retry/ignore
23* yes/no/cancel
24* yes/no
25* retry/cancel
26* cancel/try/continue
27
28Valid symbols for the ''icon'' option are:
29
30* none
31* stop
32* question
33* exclamation
34* information
35
36''msgbox'' returns the symbol associated to each button (e.g. the ''retry'' button returns the '''retry'' symbol).
37
38=== Requirements
39
40A Windows platform of course.
41
42=== Usage
43
44<enscript highlight=scheme>
45(use win32-msgbox)
46</enscript>
47
48The ''-Wl,--subsystem,windows'' linker switch ensures that the application is built as a Windows GUI application, and not as a console application.
49
50<enscript highlight=sh>
51csc -Wl,--subsystem,windows test.scm
52</enscript>
53
54==== Example 1
55
56<enscript highlight=scheme>
57(use win32-msgbox)
58
59(msgbox "Your public IP address is:\n\n7.19.211.65"
60        title: "Info"
61        icon: 'information)
62</enscript>
63
64[[image:https://bitbucket.org/miklam/win32-msgbox/wiki/msgbox1.png|example1]]
65
66==== Example 2
67
68<enscript highlight=scheme>
69(use win32-msgbox)
70
71(define user-input (msgbox "Resource not available\nDo you want to try again?"
72                            title: "Warning"
73                            buttons: 'retry/cancel
74                            icon: 'exclamation))
75
76(or (eq? user-input 'retry)
77    (exit 1))
78...
79</enscript>
80
81[[image:https://bitbucket.org/miklam/win32-msgbox/wiki/msgbox2.png|example1]]
82
83=== About this software
84
85The source code is hosted at [[https://bitbucket.org/miklam/win32-msgbox/|Bitbucket]]. Feel free to send pull requests or open an issue there. Alternatively, send an e-mail to the [[mailto://chicken-users@nongnu.org|chicken-users]] mailing list for information or requests.
86
87==== Author
88
89Michele La Monaca
90
91==== Version history
92
93; 1.0 : Initial release
94
95==== License
96
97 Copyright (c) 2013
98 Michele La Monaca (mikele~lamonaca.net)
99 All rights reserved.
100 
101 Redistribution and use in source and binary forms, with or without
102 modification, are permitted provided that the following conditions are
103 met:
104 
105 1) Redistributions of source code must retain the above copyright
106 notice, this list of conditions and the following disclaimer.
107 
108 2) Redistributions in binary form must reproduce the above copyright
109 notice, this list of conditions and the following disclaimer in the
110 documentation and/or other materials provided with the distribution.
111 
112 3) Neither the name of the author nor the names of its contributors
113 may be used to endorse or promote products derived from this software
114 without specific prior written permission.
115 
116 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
117 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
118 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
119 FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
120 COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
121 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
122 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
123 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
124 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
125 STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
126 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
127 OF THE POSSIBILITY OF SUCH DAMAGE.
Note: See TracBrowser for help on using the repository browser.