www.digitalmars.com         C & C++   DMDScript  

c++.windows.32-bits - using a float equivalent value + general

reply Peter <Peter_member pathlink.com> writes:
Hi all,

A few questions really,
I apologise if some questions seem a bit off topic.
I've been playing around with different languages in order to get some sort of
overview. The following question keep popping up in my mind.

(1) How do I retrieve a float value from an edit box in a window, using w32
only?, ie. no MFC. I want to use an asm block.
What type of variable do I use?
I've tried declaring a InPut dd ? variable as per asm. it compiles but it don't
produce results, I'm using GetWindowWord and SetWindowWord. Any ideas!

(2) I was a bit taken back by the size of (compiled for release) C++ programs. A
simple win32 weight conversion program in C++ compiled to about 130k, Packed
using Aspack reduced it to 70k. While a friend of mine wrote one in VB6 which
turned out at 35k unpacked.
I've since written the same one in asm which turned out at 5k.
Question: Is C++ programs normally larger than VB programs?

(3) There seems to be very little info around on Pascal. I was wondering. Is it
an obsolete language? How does it compare in general with C++.

comments etc.
Jan 19 2003
parent reply "Matthew Wilson" <dmd synesis.com.au> writes:
Peter

(1)

TCHAR    sz[101];

::GetDlgItemText(hwndDlg, IDC_YOUREDITCONTROL, sz, 101);

double    value = atof(sz);

(2)

VB relies on gigabyte DLLs to be loaded (and shipped!)

The reason the C++ program is quite large is that DMC++ binds the runtime
libs statically.

If you have access to VC++ you should be able to get a very small one.
Follow the advice in
http://www.windevnet.com/documents/s=7625/win0302c/0302c.htm.

(3)

NFI

Matthew

"Peter" <Peter_member pathlink.com> wrote in message
news:b0ebb5$2pto$1 digitaldaemon.com...
 Hi all,

 A few questions really,
 I apologise if some questions seem a bit off topic.
 I've been playing around with different languages in order to get some

 overview. The following question keep popping up in my mind.

 (1) How do I retrieve a float value from an edit box in a window, using

 only?, ie. no MFC. I want to use an asm block.
 What type of variable do I use?
 I've tried declaring a InPut dd ? variable as per asm. it compiles but it

 produce results, I'm using GetWindowWord and SetWindowWord. Any ideas!

 (2) I was a bit taken back by the size of (compiled for release) C++

 simple win32 weight conversion program in C++ compiled to about 130k,

 using Aspack reduced it to 70k. While a friend of mine wrote one in VB6

 turned out at 35k unpacked.
 I've since written the same one in asm which turned out at 5k.
 Question: Is C++ programs normally larger than VB programs?

 (3) There seems to be very little info around on Pascal. I was wondering.

 an obsolete language? How does it compare in general with C++.

 comments etc.

Jan 19 2003
parent reply Peter <Peter_member pathlink.com> writes:
Matthew,

I forgot to mention that when I tried to pack the asm version it actually
increased in size to 10k. probably due to the added algo.

Will try you suggestion for C++ asap.

Peter


In article <b0esih$6m$1 digitaldaemon.com>, Matthew Wilson says...
Peter

(1)

TCHAR    sz[101];

::GetDlgItemText(hwndDlg, IDC_YOUREDITCONTROL, sz, 101);

double    value = atof(sz);

(2)

VB relies on gigabyte DLLs to be loaded (and shipped!)

The reason the C++ program is quite large is that DMC++ binds the runtime
libs statically.

If you have access to VC++ you should be able to get a very small one.
Follow the advice in
http://www.windevnet.com/documents/s=7625/win0302c/0302c.htm.

(3)

NFI

Matthew

Jan 20 2003
parent reply "Matthew Wilson" <dmd synesis.com.au> writes:
Glad to be of (some, at least) help.

Am planning to try and squeeze the DM (& other compilers) CRT libs in the
same way as have done with the Visual C++ one, but this may be a long time
hence.

I'd be keen to hear of your further exploits

"Peter" <Peter_member pathlink.com> wrote in message
news:b0i00v$1rmp$1 digitaldaemon.com...
 Matthew,

 I forgot to mention that when I tried to pack the asm version it actually
 increased in size to 10k. probably due to the added algo.

 Will try you suggestion for C++ asap.

 Peter


 In article <b0esih$6m$1 digitaldaemon.com>, Matthew Wilson says...
Peter

(1)

TCHAR    sz[101];

::GetDlgItemText(hwndDlg, IDC_YOUREDITCONTROL, sz, 101);

double    value = atof(sz);

(2)

VB relies on gigabyte DLLs to be loaded (and shipped!)

The reason the C++ program is quite large is that DMC++ binds the runtime
libs statically.

If you have access to VC++ you should be able to get a very small one.
Follow the advice in
http://www.windevnet.com/documents/s=7625/win0302c/0302c.htm.

(3)

NFI

Matthew


Jan 20 2003
parent reply Peter <Peter_member pathlink.com> writes:
Hi Matthew,

Had M$ included the MFC and vb .dll's as a default to their o/s installation
cd's then it might have put the different language file sizes into a better
perspective.

My programming abilties are quite limited, Just do it for amusement when I want
to relax. So I tend to play around with different languages, (Don't know enough
about any particular one to be biased in my thoughts). So far I find that asm is
the most interesting and understandable.
Speed in a small utility isn't usually of much benefit but small file size is
good for sending on the net.
Below are some basic findings

An absolute minimum C++ file:

#include<iostream.h>
main(){}

Compiles to 31k. I thought that this may be due to the compiler attaching the
whole iostream.h so I deleted that bit and tried again ie. used just:

main(){}
It still compiled to 31k. Thats quite weird to me!

My next task might be to try to see if DMC will include Hutches \masm32.inc then
see if dmc will compile. Then I could hopefully use an asm block with real8
local variables. Probably little to gain though, even if it works!

*********************************************************
Typical w32 minimal ASM program to call a MessageBox. Compiles to 3k26
**********************************************************
386 
Model Flat ,StdCall
option casemap:none
include \masm32\include\windows.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib
ExitProcess         PROTO :DWORD
MessageBoxA         PROTO :DWORD,:DWORD,:DWORD,:DWORD
Data
MB_Name db "message box",0
MB_Text db "This is an asm win32 message box",0
Code
Main:
push 0h
push OFFSET MB_Name
push OFFSET MB_Text
push 0h
call MessageBoxA
push    0h
call    ExitProcess
end Main
*********************************************************
Typical w32 minimal MASM program to call a MessageBox. Compiles to 3k26
**********************************************************
386
Model Flat ,StdCall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\kernel32.lib
Data
MB_Name db "This is a masm MessageBox app",0
MB_Text db "message box",0
Code
Main:
invoke MessageBox, NULL,ADDR MB_Name, ADDR MB_Text, MB_OK
invoke ExitProcess,NULL; hInstance
end Main
*********************************************************
Typical w32 C++ minimal program to call a MessageBox. Compiles to 30k75
**********************************************************
#include<windows.h>
main()
{
MessageBox (NULL,"Text","Name",MB_OK);
}
***********************************************************
I must admit though, you can put together a working program much quicker in C++.

Peter.
Jan 21 2003
parent reply Peter <Peter_member pathlink.com> writes:
Hi Matthew,

I downloaded your article the same time as posting the last message. You have
already answered most of my questions in the first paragraph.
More reading to do...

Peter.
Jan 21 2003
parent "Matthew Wilson" <dmd synesis.com.au> writes:
Glad to be of help. :)

As I said, though, the techniques are aimed at Visual C++'s runtime library,
so not all may be applicable to DMC++. I have plans to ask Walter about all
this when I have time, but that may be a month or two away ... sigh

"Peter" <Peter_member pathlink.com> wrote in message
news:b0kgmf$65a$1 digitaldaemon.com...
 Hi Matthew,

 I downloaded your article the same time as posting the last message. You

 already answered most of my questions in the first paragraph.
 More reading to do...

 Peter.

Jan 21 2003