News:

Download Pelles C here: http://www.smorgasbordet.com/pellesc/

Main Menu

Recent posts

#11
User contributions / Simple resizer Library
Last post by John Z - November 30, 2025, 12:36:30 PM
A simple to use resizer library -

Use both zresizer.c and zsizer.h when building the library

Use ResizerZ.lib and zsizerlib.h in the application, zsizer.h 
is not needed when implementing resizing using the library.

Use all three files if implementing as source code and not as library.
Entire project zip file is attached.
--------------
Basic Features:
For the most part resizing a Dialog resizes and moves everything
based on the Dialog window size changes.

Individual controls can be prevented from changing size but not
from moving. 

Two controls (pushbuttons like "ok") and Calendar can be globally
prevented from resizing by setting BUTTON_RESIZE, and/or
CALENDAR_RESIZE respectively to FALSE. In this case there is no
need to identify every control of these types to not resize.

Dialogs can be restricted to no smaller than original design by
setting LIMIT_SHRINK = TRUE. Works but a bit glitchy when trying to
drag smaller than original...

All settings are done initially in ResizerZ.lib, but the programs
can manipulate these as well since they are global in zsizerlib.h.

Only three functions are needed.  These are added to each Dialog to be resized
Init_Resizer(HANDLE hwndDlg,int n);// last line in WM_INITDIALOG
Form_Resize(HANDLE hwndDlg, int n);// in WM_SIZE
Free_zsizer(int n);                // in WM_CLOSE

The library the version number can be obtained by
What_Version(); //returns a double which is the lib version

Easy to implement worked well in test cases testing more than 20 of the control types
If bugs are fixed, or improvements are made it would be nice to post the revision.

More detailed information is within zsizerlib.h

John Z


#12
Expert questions / Re: Adding version rc to Libra...
Last post by Vortex - November 30, 2025, 11:44:24 AM
Hi Timo,

Thanks, you are right. John's idea is nice :

QuoteI think instead I'll just add a function in the lib which will return the version # on request. int or maybe float = Get_Version(); something like that

One can even can modify the static library to update the version number, a find and replace binary data utility can do the job.
#13
Expert questions / Re: Adding version rc to Libra...
Last post by TimoVJL - November 29, 2025, 09:50:09 PM
Wasn't what wanted.
Windows file manager was a basic problem.
#14
Expert questions / Re: Adding version rc to Libra...
Last post by Vortex - November 29, 2025, 09:35:24 PM
Microsoft's Windows Resource To Object Converter cvtres.exe can convert a .res file to an .obj file.
#15
Expert questions / Re: Adding version rc to Libra...
Last post by TimoVJL - November 29, 2025, 06:35:05 PM
Use unique symbol name for getting version.
#16
Expert questions / Re: Adding version rc to Libra...
Last post by John Z - November 29, 2025, 06:04:20 PM
Thanks Timo,

Not quite what I was looking for. I was hoping to be able to right click on the .lib file and the select properties which would show a version number like it does with an .exe file.

I think instead I'll just add a function in the lib which will return the version # on request. int or maybe float = Get_Version(); something like that -

John Z


#18
Expert questions / Adding version rc to Library
Last post by John Z - November 29, 2025, 02:45:35 PM
Is it possible to add a version resource to a library?
I get an error when I try to add it to the ResizerZ.lib build.
Building Add_version.res.
*** Error:   "C:\Program Files\PellesC\Files\ResizerZ\Add_version.rc" -Fo"C:\Program Files\PellesC\Files\ResizerZ\output\Add_version.res"
*** Error: The parameter is incorrect. 
Done

I tried with the Pelle Control dialog, default version resource without any changes, also with just a rc script.

Or is there any other way to incorporate a viewable version number in a .lib?

Any help is appreciated!

John Z
#19
Assembly discussions / Re: Rich Edit sample
Last post by Vortex - November 28, 2025, 01:23:04 PM
Hi Timo,

Thanks for your version.
#20
Assembly discussions / Re: Rich Edit sample
Last post by TimoVJL - November 28, 2025, 05:18:37 AM
A dialog without any resource section in one source.
Just a one test material for poasm
;.model flat,fastcall
INCLUDELIB kernel32.lib
INCLUDELIB user32.lib

WM_DESTROY    equ 2
WM_CLOSE      equ 10h
WM_INITDIALOG equ 110h

GetModuleHandleW PROTO :QWORD
ExitProcess PROTO :QWORD
DialogBoxIndirectParamW PROTO :QWORD,:QWORD,:QWORD,:QWORD,:QWORD
EndDialog PROTO :QWORD,:QWORD
PostQuitMessage PROTO :QWORD
MessageBoxW PROTO :QWORD,:QWORD,:QWORD,:QWORD
;----------------------
DlgProc PROTO :QWORD,:DWORD,:QWORD,:QWORD
WMInitdialog PROTO :QWORD
WMDestroy    PROTO
WMClose      PROTO :QWORD

ifdef __POASM__
.drectve segment
db '/subsystem:windows '
.drectve ends
endif

.data
;align 4
DlgBox  dw  1   ; dlgVer
    dw  0FFFF   ; signature
    dd  0       ; helpID
    dd  0       ; exStyle
    dd  10CA0800h   ; style
    dw  0       ; cDlgItems
    dw  0       ; x
    dw  0       ; y
    dw  200     ; cx
    dw  100     ; cy
    dw  0       ; empty menu
    dw  0       ; empty windowClass
    ;dw "Test",0    ; title POAsm
    dw  'T','e','s','t',0   ; title

;sMsg dw  "OK to close",0
sMsg dw  'O','K',' ','t','o',' ','c','l','o','s','e',0

.code
; parameters RCX, RDX, R8 and R9
start PROC  PARMAREA=5*sizeof QWORD
    INVOKE  GetModuleHandleW,0
    mov rcx,rax
    INVOKE  DialogBoxIndirectParamW,rcx,ADDR DlgBox,0,ADDR DlgProc,0
    INVOKE  ExitProcess, rax
start ENDP

DlgProc PROC hWnd:QWORD,uMsg:DWORD,wParam:QWORD,lParam:QWORD PARMAREA=4*sizeof QWORD
    ;mov hWnd, rcx  ; ?
    mov QWORD PTR [rsp+30h],rcx
    ;mov uMsg, rdx
    mov DWORD PTR [rsp+38h],edx
    ;mov wParam, r8
    mov QWORD PTR [rsp+40h],r8
    ;mov lParam, r9
    mov QWORD PTR [rsp+48h],r9
    mov     eax,uMsg
    .if uMsg==WM_INITDIALOG
        INVOKE  WMInitdialog, hWnd
    .elseif uMsg==WM_CLOSE
        INVOKE  WMClose, hWnd
    .elseif uMsg==WM_DESTROY
        INVOKE  WMDestroy 
    .else
@@:     xor     rax,rax
    .endif
    ret
DlgProc ENDP

WMInitdialog PROC hWnd:QWORD PARMAREA=4*sizeof QWORD
    ;mov    hWnd,rcx
    ;mov     qword ptr [rsp+30h],rcx
    mov     rax,1
    ret
WMInitdialog ENDP

WMDestroy PROC
    INVOKE  PostQuitMessage,0
    mov     rax,1
    ret
WMDestroy ENDP

WMClose PROC hWnd:QWORD PARMAREA=4*sizeof QWORD
    ;mov    hWnd,rcx
    mov QWORD PTR [rsp+30h],rcx
    INVOKE  MessageBoxW,hWnd,ADDR sMsg, 0, 21h
    .if rax == 1
        ;mov rcx,hWnd
        mov rcx,QWORD PTR [rsp+30h]
        INVOKE  EndDialog,rcx,0
    .endif
    ret
WMClose ENDP

END start