News:

Download Pelles C here: http://www.pellesc.se

Main Menu

Recent posts

#71
Projects developed with Pelles C / Re: Simple Calendar
Last post by John Z - July 11, 2026, 10:53:33 PM
Thanks Marco!

I really appreciate you taking the time and providing testing feedback.👍👍👍

From your test I should deselect PowerShell 7 in Choice Dialog and default back to C, I think that will correct the 'selected but disabled situation'.  Great test.

I also added checks in a few other places too just in case you really go wild  ;D , and improved messaging text. 

Nice to think outside the box!  Thanks again.

Version 2.0.1 attached.

John Z

P.S. I was testing PowerShell 7 absence just by renaming pwsh.exe - much easier than uninstall.

Update 7/17 removed attachment to conserve space.  Newer sources 2.0.2 attached further down.
#72
Projects developed with Pelles C / Re: Simple Calendar
Last post by Marco - July 11, 2026, 10:23:35 AM
Hi John,

Thank you for this update!

I tested the program on a PC without PowerShell 7 installed. When I click the 'Settings' button, the 'Use PowerShell 7' option is correctly disabled. After closing the program, as a test, I manually opened the 'zcalendar.ini' file and set the 'Method' key to 4. When I reopen the program and then the 'Choose method' dialog box, the 'Use PowerShell 7' option is both disabled and selected. In fact, when I then try to create a task, at the confirmation stage, the program naturally displays the 'Failed CreateProcess' error window with the message
"C:\Program Files\PowerShell\7\pwsh.exe" -WindowStyle Hidden -FILE "R:\Temp\calendar_exe\SCR1.PS1"

This is a deliberately unusual test scenario, but I simulated having subsequently uninstalled PowerShell 7 after setting it as the default task creation method in the program.

Marco
#73
Projects developed with Pelles C / Re: Simple Calendar
Last post by John Z - July 11, 2026, 08:28:14 AM
No biggy - just something to do...

Here is version 2.0 of the simple calendar program.  The calendar program now is also the alert program, meaning no longer is there an Alert.exe used to notify that a scheduled item is due.  Version 2.0 supports four 'Methods' to schedule an alert; VBS, PowerShell 5.1, C, and PowerShell 7.  The 'Method' to use can be selected, but defaults to C if no selection is made.  An ini file has been added to store the 'Method' chosen.

The help file has been updated.

Old sources removed to save space, new version posted on page 2

As the original, it can be run from a USB, just three files, nothing written to the registry, no phone home or telemetry.  Simple calendar with a few 'extras' thrown in...

John Z

All sources are in calendar_V2a_sources.ZIP
Just the calendar.exe and the help file calendar.chm are in calendar_v2a_exe.7z
#74
Work in progress / Re: Task Schedule 2.0 examples
Last post by John Z - July 06, 2026, 12:36:50 AM
While the prior code drop does work quite well, there was a hidden bug.  The bug manifests when there is even a 1 byte change in the last message box Title!  How lucky can you get :)

The new code is attached. the 'fix' is to SysAllocString(L"") the variant strings, even though they are NULL. Of course free them when done as well.  With these changes message box Title length no longer crashes the code, and complies with M$ documentation.

Revised source attached

John Z
#75
Beginner questions / Re: Working Directory woes
Last post by John Z - July 03, 2026, 11:20:02 PM
Hi PhilG57,

Have you tried setting the ofn.lpstrFile parameter to the path you want to start in?
I do this, it seems to work.  Documentation says this will be used as the initial directory when the dialog starts, unless the value is NULL.  Also may need to set lpstrInitialDir to NULL, but I don't recall doing that - ?

The file name used to initialize the File Name edit control.
The first character of this buffer must be NULL if initialization
is not necessary. When the GetOpenFileName or GetSaveFileName
function returns successfully, this buffer contains the drive
designator, path, file name, and extension of the selected file.

Windows 7:

    If lpstrInitialDir has the same value as was passed the
first time the application used an Open or Save As dialog box,
the path most recently selected by the user is used as the
initial directory.

    Otherwise, if lpstrFile contains a path, that path is
the initial directory.

Windows 2000/XP/Vista:

    If lpstrFile contains a path, that path is the initial directory.
    Otherwise, lpstrInitialDir specifies the initial directory.

https://learn.microsoft.com/en-us/windows/win32/api/commdlg/ns-commdlg-openfilenamea


John Z
#76
Beginner questions / Re: Working Directory woes
Last post by PhilG57 - July 03, 2026, 04:31:40 AM
Stack Overflow says the directory last selected by GetOpenFileName is stored in the registry and used the next time GetOpenFileName is called.  This seems to be the case, even though I make a point to reset the working directory to that obtained earlier in my code.  As also suggested there, I added the flag "OFN_NOCHANGEDIR" to the GetOpenFileName call with no change in behavior.

I do think this is a user caused error but have yet to determine where I went wrong.
#77
Beginner questions / Re: Importing a function from ...
Last post by Vortex - July 02, 2026, 08:12:59 PM
Hi jm,

Windows 64-bit supports only the fastcall calling convention.
#78
Beginner questions / Working Directory woes
Last post by PhilG57 - July 02, 2026, 04:16:44 PM
I have a Windows project with multiple versions kept in separate directories.  I edit and update in one directory and when those changes look and test good, I move them to another, separate, directory of more stable code.

In any of those project versions, when I open a file with GetOpenFileName(), the directory shown from which to select a file to open, is the directory last used by Pelles C.  For example, in the GetOpenFileName() dialog, if I change to a different directory and select a file from there, that directory becomes the 'default' location shown by GetOpenFileName() the next time it is called.

So far, so good I think.  What I don't understand is with the opening of a new or different project using the same instance of Pelles C, or especially with a new clean instance of Pelles C, why does the default GetOpenFileName() use what I selected before and not the default directory listed in my project's options. As part of the initialization code, I do execute a GetCurrentDirectory() followed by a SetCurrentDirectory() to no avail.

As always, thanks in advance.
#79
Announcements / CMake 4.4.0 Supports Pelles C
Last post by Robert - July 01, 2026, 04:08:26 AM
#80
Beginner questions / Re: Importing a function from ...
Last post by jm - June 30, 2026, 05:27:04 PM
Quote from: TimoVJL on June 30, 2026, 12:51:55 PMJust Enable Microsoft extensions to remove warning
Good to know that, thanks for your help.  The F1 help is great too, for anyone else new to Pelles C.