Thread overview | ||||||
---|---|---|---|---|---|---|
|
February 08, 2006 HelloWorld using Win32lib | ||||
---|---|---|---|---|
| ||||
Ok, in the interests of GUI comparisons, here is the entire HW program using the Windows library I want to port to D.
import win32lib;
void startApp()
{
createForm("My First Message", -- Window title
"Hello World!" -- Put some text in it
)
}
--
Derek
(skype: derek.j.parnell)
Melbourne, Australia
"Down with mediocracy!"
8/02/2006 12:41:35 PM
|
February 08, 2006 Re: HelloWorld using Win32lib | ||||
---|---|---|---|---|
| ||||
Posted in reply to Derek Parnell | "Derek Parnell" <derek@psych.ward> wrote in message news:vsay7aqghfwh.191c9c9rc6ex6.dlg@40tude.net... > Ok, in the interests of GUI comparisons, here is the entire HW program using the Windows library I want to port to D. > > import win32lib; > void startApp() > { > createForm("My First Message", -- Window title > "Hello World!" -- Put some text in it > ) > } > And you will get syntax error :) Form is MessageBox here I beleive. MessageBox(0, "My First Message", "Hello World!", MB_OK) is even shorter. Form to be practical should be parametrized by some resource - its layout definition so createForm(caption, text) will work if text is some markup otherwise it should be createForm(caption, dlgResId) Not so easy, huh? :) Andrew. |
February 08, 2006 Re: HelloWorld using Win32lib | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrew Fedoniouk Attachments:
| On Tue, 7 Feb 2006 18:08:15 -0800, Andrew Fedoniouk wrote: > "Derek Parnell" <derek@psych.ward> wrote in message news:vsay7aqghfwh.191c9c9rc6ex6.dlg@40tude.net... >> Ok, in the interests of GUI comparisons, here is the entire HW program using the Windows library I want to port to D. >> >> import win32lib; >> void startApp() >> { >> createForm("My First Message", -- Window title >> "Hello World!" -- Put some text in it >> ) >> } >> > > And you will get syntax error :) Ok, so I copied the code from a *working* Euphoria program, thus the wrong comment syntax. > Form is MessageBox here I beleive. You believe wrongly. > MessageBox(0, "My First Message", "Hello World!", MB_OK) is > even shorter. But that's not what this program does. See the attachment. > Form to be practical should be parametrized by some resource - > its layout definition so > createForm(caption, text) will work if text is some markup otherwise it > should be createForm(caption, dlgResId) My example is *one* way to skin the cat. If we are talking commercial applications then all user visible text needs to be parameterized and resolved at runtime. setUserLanguage( langCode ) . . . createForm("<apptitle>", // Window title "<hwtext>" // Put some text in it ) Where 'apptitle' and 'hwtext' are resource identifiers that are replaced at runtime by the real text for the user's chosen language (if defined). > Not so easy, huh? :) Yes, it is. I've done it in this library already and it works. -- Derek (skype: derek.j.parnell) Melbourne, Australia "Down with mediocracy!" 8/02/2006 1:10:30 PM |
February 08, 2006 Re: HelloWorld using Win32lib | ||||
---|---|---|---|---|
| ||||
Posted in reply to Derek Parnell | "Derek Parnell" <derek@psych.ward> wrote in message news:14mxblmynomu9.177qhx00fo875.dlg@40tude.net... > On Tue, 7 Feb 2006 18:08:15 -0800, Andrew Fedoniouk wrote: > >> "Derek Parnell" <derek@psych.ward> wrote in message news:vsay7aqghfwh.191c9c9rc6ex6.dlg@40tude.net... >>> Ok, in the interests of GUI comparisons, here is the entire HW program using the Windows library I want to port to D. >>> >>> import win32lib; >>> void startApp() >>> { >>> createForm("My First Message", -- Window title >>> "Hello World!" -- Put some text in it >>> ) >>> } >>> >> >> And you will get syntax error :) > > Ok, so I copied the code from a *working* Euphoria program, thus the wrong comment syntax. > >> Form is MessageBox here I beleive. > > You believe wrongly. > >> MessageBox(0, "My First Message", "Hello World!", MB_OK) is >> even shorter. > > But that's not what this program does. See the attachment. > >> Form to be practical should be parametrized by some resource - >> its layout definition so >> createForm(caption, text) will work if text is some markup otherwise it >> should be createForm(caption, dlgResId) > > My example is *one* way to skin the cat. If we are talking commercial applications then all user visible text needs to be parameterized and resolved at runtime. > > setUserLanguage( langCode ) > . . . > createForm("<apptitle>", // Window title > "<hwtext>" // Put some text in it > ) > > Where 'apptitle' and 'hwtext' are resource identifiers that are replaced > at > runtime by the real text for the user's chosen language (if defined). So what does <hwtext> on the Form? Or what this Form does? Shows plain text? Purpose? In the whole win32 API there is only one function which accepts window caption and window text ::MessageBox. To be short: createForm in the given example is capable to serve only HelloWorld purposes. Or show full signature of createForm. Probably I don't understand something in principle. > >> Not so easy, huh? :) > > Yes, it is. I've done it in this library already and it works. > > -- I trust you. Andrew Fedoniouk. http://terrainformatica.com |
Copyright © 1999-2021 by the D Language Foundation