Windows Services & Other Stuff

Developed or developing a new product in PureBasic? Tell the world about it.
User avatar
JHPJHP
Addict
Addict
Posts: 1853
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Windows Services & Other Stuff

Post by JHPJHP »

Hi BarryG,

Thank you for your kind words, they were very much appreciated.

---------------------------------------

Updated:
- subclass listview context menu
- added Home, History (back/forward), and Up One Folder buttons
- numerous code improvements

Subclass ListView Context Menu
While allowing access to the menu for individual items, the ListView menu is blocked.
In addition, a custom menu was added to replace the original blocked ListView menu.

Another option (overkill for this example) would have been to "merge" the ListView menu...

If the "merge" option is preferred, freak has already completed most of the leg work; see Add the Shell's context menu to your program.
- this also allows for adding custom menu items to the original Shell menu and/or replacing their default commands

Image

STATUS: Mostly Unavailable :: Downloads moved to My PureBasic Stuff; free executables, access key required for source code.
_________________
User avatar
JHPJHP
Addict
Addict
Posts: 1853
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Windows Services & Other Stuff

Post by JHPJHP »

Updated:
- added \Other_Stuff\OtherStuff\SetWinEventHook\SetWinEventHook.pb
- improved \Other_Stuff\OtherStuff\EnumerateWindows.pb
- improved AccessibleObjectFromEvent, AccessibleObjectFromPoint, AccessibleObjectFromWindow

SetWinEventHook
This new example combines AccessibleObjectFromPoint with SetWinEventHook (AccessibleObjectFromEvent) to better support Chromium Edge webpages, but will also work with any other objects supporting the IAccessible Interface.

See the following resources.
https://docs.microsoft.com/en-us/window ... neventhook
https://docs.microsoft.com/en-us/window ... tfromevent

Enumerate Windows
I've included a variation into IAccessible Interface as a way to more easily select windows for examination.

NB*: IAccessible Interface has been moved to its own thread.

Image
Last edited by JHPJHP on Tue Sep 14, 2021 11:26 pm, edited 1 time in total.

STATUS: Mostly Unavailable :: Downloads moved to My PureBasic Stuff; free executables, access key required for source code.
_________________
User avatar
JHPJHP
Addict
Addict
Posts: 1853
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Windows Services & Other Stuff

Post by JHPJHP »

Updated:
- updated \Other_Stuff\OtherStuff\SetFileSecurity.pb
- added \Other_Stuff\OtherStuff\SetWinEventHook_2
- added \Other_Stuff\OtherStuff\TransparentWindow_1.pb
- added \Other_Stuff\ProcessStuff\GetCurrentProcessPrivileges.pb
- updated \Other_Stuff\ProcessStuff\AdjustCurrentProcessPrivilege.pb
- various minor improvements to numerous examples

SetFileSecurity.pb was updated with additional error checking, as was my Network Share Management download which utilizes some of the same APIs.

I was motivated to revisit my SECURITY_DESCRIPTOR examples after reading the following post Creating named pipes with non-default permissions.
Not only are SIDs added to an ACL, but inclusive and exclusive access rights are demonstrated using a variety of methods.

SetWinEventHook_2
While the following post ListIconGadget event for scrollbar change used a standard Windows callback to resolve the issue, I wanted to demonstrate how the IAccessible Interface could also be used to solve the problem.

NB*: I would have responded directly to the original posts, but I was late to the party and both questions were already answered.

The ListIconGadget on the right is scrolled using the mouse-wheel, scrollbars and keypad.
The ListIconGadget on the left posts the scrollbar value from the captured events (only a single event was needed to capture all three actions).

Image

STATUS: Mostly Unavailable :: Downloads moved to My PureBasic Stuff; free executables, access key required for source code.
_________________
User avatar
JHPJHP
Addict
Addict
Posts: 1853
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Windows Services & Other Stuff

Post by JHPJHP »

Updated:
- added \Other_Stuff\FontStuff\
-- AddFontResourceEx.pb, EnumerateSystemFonts.pb, FontStuffFromFile_1.pb, FontStuffFromFile_2.pb, GetFontInformation.pb

FontStuffFromFile
After reading the following post Actual font location and name, I found the following article and source code Retrieving Font Name from TTF File.

With a little help from the following posts I was able to produce working examples.
- Compiling a list of WinAPI types and their Purebasic equals ~Kale
- Simple Big Endian / Little Endian byte order swap function ~wilbert

Extracted from Bahnschrift.ttf
[ 000 ] ⏵ © 2018 Microsoft Corporation. All rights reserved.
[ 001 ] ⏵ Bahnschrift
[ 002 ] ⏵ Regular
[ 003 ] ⏵ Bahnschrift Regular
[ 004 ] ⏵ Bahnschrift
[ 005 ] ⏵ Version 2.06
[ 006 ] ⏵ Bahnschrift
[ 008 ] ⏵ Microsoft Corporation
[ 009 ] ⏵ Aaron Bell
[ 011 ] ⏵ http://www.microsoft.com/typography/fonts/
[ 012 ] ⏵ http://www.sajatypeworks.com
[ 013 ] ⏵ Microsoft supplied font. You may use this font to create, display, and print content as permitted by the license terms or terms of use, of the Microsoft product, service, or content in which this font was included. You may only (i) embed this font in content as permitted by the embedding restrictions included in this font; and (ii) temporarily download this font to a printer or other output device to help print content. Any other use is prohibited.
[ 014 ] ⏵ https://docs.microsoft.com/typography/about
[ 016 ] ⏵ Bahnschrift
[ 256 ] ⏵ Weight
[ 257 ] ⏵ Width
[ 258 ] ⏵ Light
[ 259 ] ⏵ SemiLight
[ 260 ] ⏵ Regular
[ 261 ] ⏵ SemiBold
[ 262 ] ⏵ Bold
[ 263 ] ⏵ Light SemiCondensed
[ 264 ] ⏵ SemiLight SemiCondensed
[ 265 ] ⏵ SemiCondensed
[ 266 ] ⏵ SemiBold SemiCondensed
[ 267 ] ⏵ Bold SemiCondensed
[ 268 ] ⏵ Light Condensed
[ 269 ] ⏵ SemiLight Condensed
[ 270 ] ⏵ Condensed
[ 271 ] ⏵ SemiBold Condensed
[ 272 ] ⏵ Bold Condensed

STATUS: Mostly Unavailable :: Downloads moved to My PureBasic Stuff; free executables, access key required for source code.
_________________
User avatar
JHPJHP
Addict
Addict
Posts: 1853
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Windows Services & Other Stuff

Post by JHPJHP »

Updated:
- added \Other_Stuff\FontStuff\FindFontFile.pb
- improved \Other_Stuff\FontStuff\EnumerateSystemFonts.pb, GetFontInformation.pb

FindFontFile: Based on code from Get a font filename based on the font handle.
Scans the Windows font directory and creates a fingerprint dictionary of all True Type Fonts.
Using the PureBasic FontRequestor, a fingerprint hash is created from the selected font and compared against the dictionary.

EnumerateSystemFonts.pb has been expanded to include the same algorithms used in the FontStuffFromFile examples.

FontStuffFromFile examples have been updated with better filtering.

Image

STATUS: Mostly Unavailable :: Downloads moved to My PureBasic Stuff; free executables, access key required for source code.
_________________
User avatar
JHPJHP
Addict
Addict
Posts: 1853
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Windows Services & Other Stuff

Post by JHPJHP »

Updated:
- removed \Other_Stuff\GadgetStuff\ScrollAreaGadget\ScrollAreaGadget.pb
- \Other_Stuff\MonitorStuff\includes\SetDpiAwareness.pbi

Based on some additional reading and after various tests, I don't believe the DPI Awareness constants posted by Rinzwind should be relied on.
NOTE: Currently this is only conjecture based on some unsubstantiated documentation and a few personal tests.
A DPI_AWARENESS_CONTEXT contains multiple pieces of information. For example, it includes both the current and the inherited DPI_AWARENESS.

DPI_AWARENESS_CONTEXT GetThreadDpiAwarenessContext();
DPI_AWARENESS_CONTEXT GetWindowDpiAwarenessContext(HWND hwnd);

BOOL AreDpiAwarenessContextsEqual(DPI_AWARENESS_CONTEXT dpiContextA, DPI_AWARENESS_CONTEXT dpiContextB);
The following Microsoft constants work correctly and can be verified using the same include file.

Code: Select all

#DPI_AWARENESS_CONTEXT_UNAWARE              = -1
#DPI_AWARENESS_CONTEXT_SYSTEM_AWARE         = -2
#DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE    = -3
#DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 = -4
#DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED    = -5
Other downloads that were updated with the modified DPI include file.
GIF Toolkit
Video Snipping Tool
Embed JS into PureBasic
Book & Viewer & Magnify

STATUS: Mostly Unavailable :: Downloads moved to My PureBasic Stuff; free executables, access key required for source code.
_________________
User avatar
JHPJHP
Addict
Addict
Posts: 1853
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Windows Services & Other Stuff

Post by JHPJHP »

Updated:
- added \Other_Stuff\ResizeImageFast\ResizeImageFast.pb
- added \Other_Stuff\PowerShell\PNGImage2Icon\PNGImage2Icon.pb
- improved \Other_Stuff\ColorConversion\Convert\...

Color Conversion
Modified the 11 Color Space examples based on additional testing.

NB*: The Color Conversion algorithms have also been updated in GIF Toolkit, Spider Web Drawing and Large Image Viewer.

STATUS: Mostly Unavailable :: Downloads moved to My PureBasic Stuff; free executables, access key required for source code.
_________________
Post Reply