www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.dwt - HelloWorld using Win32lib

reply Derek Parnell <derek psych.ward> writes:
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
Feb 07 2006
parent reply "Andrew Fedoniouk" <news terrainformatica.com> writes:
"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.
Feb 07 2006
parent reply Derek Parnell <derek psych.ward> writes:
Content-type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit

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
Feb 07 2006
parent "Andrew Fedoniouk" <news terrainformatica.com> writes:
"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
Feb 07 2006