ACtually my first question here is unrelated:
How to center a window? Isn't there a WS_CENTERWINDOW or something? I can't find it on MSDN.
Main question:
Somebody (I think it was bitRAKE) said something about somebody (I think it was f0dder) knew how to make C progs smaller in exe size. Can I get an explanation (or the likes) on that?
thanks
How to center a window? Isn't there a WS_CENTERWINDOW or something? I can't find it on MSDN.
Main question:
Somebody (I think it was bitRAKE) said something about somebody (I think it was f0dder) knew how to make C progs smaller in exe size. Can I get an explanation (or the likes) on that?
thanks
Well, for the biggest reduction...
Compile your C programs in a C compiler like lcc. Not a C++ compiler.
Compile your C programs in a C compiler like lcc. Not a C++ compiler.
C : 3kb
C++ : 50kb
CenterScreen proc hwnd:HWND
LOCAL DlgHeight:DWORD
LOCAL DlgWidth:DWORD
LOCAL DlgRect:RECT
LOCAL DesktopRect:RECT
invoke GetWindowRect,hwnd,ADDR DlgRect
invoke GetDesktopWindow
mov ecx,eax
invoke GetWindowRect,ecx,addr DesktopRect
push 0
mov eax,DlgRect.bottom
sub eax,DlgRect.top
mov DlgHeight,eax
push eax
mov eax,DlgRect.right
sub eax,DlgRect.left
mov DlgWidth,eax
push eax
mov eax,DesktopRect.bottom
sub eax,DlgHeight
shr eax,1
push eax
mov eax,DesktopRect.right
sub eax,DlgWidth
shr eax,1
push eax
push hwnd
call MoveWindow
ret
CenterScreen endp
Iczelion wrote this one in one of his tuts...
Talk about size, check out the 512 byte OpenGL Demo on the Hugi Disk Mag 24!
Compile your C programs in a C compiler like lcc. Not a C++ compiler.
That makes no difference, as long as you know your compiler+linker
settings, and code "properly".
I bet some of the "how to get stuff small" threads pop up if you
search the board for FILEALIGN .
And as for the 512byte hugi thingy... that probably isn't compatible
with all windows versions, making it useless (but still fun ;) )
He did versions for compatiblity. (Even XP) :rolleyes:
It's cool for 512 bytes - check it out!
It's cool for 512 bytes - check it out!
Contrary to popular belief a C\Win32 EXE can be as small as
an ASM\Win32 EXE.
The methods employed to create compact C\Win32 EXE's are:-
--File alignment (Linker setting)
--Optimise for size instead of speed (compiler setting)
--Compile for DLL runtime library (on VC++ 6)
--PE Segment merging (Not recommended)
--Start-up code removal, ie define your own entry point
--Intelligent coding (the hardest part)
Using the above methods you can create a Win32 "Hello World!"
ie. display a message box, in under 2Kb.
an ASM\Win32 EXE.
The methods employed to create compact C\Win32 EXE's are:-
--File alignment (Linker setting)
--Optimise for size instead of speed (compiler setting)
--Compile for DLL runtime library (on VC++ 6)
--PE Segment merging (Not recommended)
--Start-up code removal, ie define your own entry point
--Intelligent coding (the hardest part)
Using the above methods you can create a Win32 "Hello World!"
ie. display a message box, in under 2Kb.
Using the above methods you can create a Win32 "Hello World!"
ie. display a message box, in under 2Kb.
Hi FYBO
Do you have maybe the Visual C++ workspace, and C fileof this 2 k Hello World, that you could share,if you can I know you have to
send then up as textfiles, or paste them on the board because , of the types of files allowed to be uploaded ,but that would be cool,
I tried to follow the things you said but I got loss,
But I'm kind of familiar with Visual C console projects
Thanks Andy
ie. display a message box, in under 2Kb.
Hi FYBO
Do you have maybe the Visual C++ workspace, and C fileof this 2 k Hello World, that you could share,if you can I know you have to
send then up as textfiles, or paste them on the board because , of the types of files allowed to be uploaded ,but that would be cool,
I tried to follow the things you said but I got loss,
But I'm kind of familiar with Visual C console projects
Thanks Andy
JimmyClif,
Is that the only way to center a window? I mean I want it to start center screen, like when I do createwindow(ex) there's no like WS_EX_CENTERSCREEN style or anything?
<hr>
-Beware of Newbie Question-
What exactly is FILEALIGN (looking for brief or in-depth explanation (or link))?
Is that the only way to center a window? I mean I want it to start center screen, like when I do createwindow(ex) there's no like WS_EX_CENTERSCREEN style or anything?
<hr>
-Beware of Newbie Question-
What exactly is FILEALIGN (looking for brief or in-depth explanation (or link))?
If you want to optimize with visual C++ make sure you have at least the professional edition I have the standard eddition and I found it it dosen't include the optimizing compiler.
Well, I'm kinda poor so I only have borland's freecommandlinetools. :(
For an in-depth explanation of filealign, see the PE documentation.
If you want a good free compiler, check out www.openwatcom.org .
Watcom used to be the best compiler in the old days, and now that
it's free, it's probably at least the best *free* compiler.
If you want a good free compiler, check out www.openwatcom.org .
Watcom used to be the best compiler in the old days, and now that
it's free, it's probably at least the best *free* compiler.
thanx for that link fodder I've had it with the buggy lcc-win32
f0dder, that is very impressive. The FTP has full docs, and can't wait to browse the source code. SciTech is a nice group of people (I lived in Chico for five years, and met some of the people that worked there at the bars :)). They did some work on NASM, too.
Sorry for the wait... I was busy killing na*is in RTCW ;)
For the centering:
I guess so :( afaik for normal CreateWindow it is.
A Dialog on the other hand can get Centered using the
DS_CENTER (0x0800L) style.
For the centering:
I guess so :( afaik for normal CreateWindow it is.
A Dialog on the other hand can get Centered using the
DS_CENTER (0x0800L) style.