NO

Author Topic: Useful Bits  (Read 314 times)

Offline WiiLF23

  • Member
  • *
  • Posts: 62
Useful Bits
« on: August 14, 2023, 12:16:46 AM »
At a glance, this is what made things more streamlined for me.

Enable Visual Styles (Common-controls v6)

Code: [Select]
#pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
Now your manifest will reflect this at compile-time.

Embedding Manifest - Project Settings > Macros > LINKFLAGS

Code: [Select]
-machine:x86 -subsystem:windows -safeseh /MANIFEST:EMBED kernel32.lib user32.lib gdi32.lib comctl32.lib comdlg32.lib advapi32.lib delayimp.lib
Update or replace your own LINKFLAGS to embed the manifest file at compile-time - /MANIFEST:EMBED
Rebuild project. Now you can delete the manifest file if you wish (recommended to retain file for development/learning).

Just a few things that helped me out on my 3rd day using this language and IDE. Cheers.

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2096
Re: Useful Bits
« Reply #1 on: August 14, 2023, 11:41:35 AM »
Hello WiiLF23
Welcome on board!  8)
It is better to be hated for what you are than to be loved for what you are not. - Andre Gide

Offline John Z

  • Member
  • *
  • Posts: 786
Re: Useful Bits
« Reply #2 on: August 14, 2023, 12:27:47 PM »
Hi WiiLF23

Welcome to the forum, nice tip.

There is another method I found to be easier.  Pelles C supports manifest as a resource.
Right click in the resource window and select NEW then manifest, then paste or type in the manifest instructions.
for example in my case paste:
Code: [Select]
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel level='asInvoker' uiAccess='false' />
      </requestedPrivileges>
    </security>
  </trustInfo>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*' />
    </dependentAssembly>
  </dependency>
</assembly>


Now it is readily available to the program.  Someone here passed this on to me when I was struggling with getting
the new visual styles working using pragma.

John Z

Offline Vortex

  • Member
  • *
  • Posts: 792
    • http://www.vortex.masmcode.com
Re: Useful Bits
« Reply #3 on: August 14, 2023, 01:10:45 PM »
Hi WiiLF23,

Attached is a quick example for you. It displays a dialog box built with a manifest file, the resource script :

Code: [Select]
// RESOURCE SCRIPT generated by "Pelles C for Windows, version 12.00".

#include <windows.h>
#include <commctrl.h>
#include <richedit.h>

LANGUAGE LANG_ENGLISH,SUBLANG_ENGLISH_US

1 MANIFEST "manifest.xml"

DLGTEMPLATE DIALOGEX DISCARDABLE 250, 100, 250, 102
STYLE WS_THICKFRAME|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_MAXIMIZEBOX|WS_VISIBLE
CAPTION "Dialog box with manifest"
FONT 8, "MS Sans Serif", 0, 0, 1
{
  CONTROL "Test dialog", IDOK, "Static", SS_CENTER, 4, 12, 56, 12
}
Code it... That's all...

Offline WiiLF23

  • Member
  • *
  • Posts: 62
Re: Useful Bits
« Reply #4 on: August 14, 2023, 08:11:55 PM »
Thank you everyone for your contributions!