Windows Services & Other Stuff
Re: Windows Services & Other Stuff
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
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
Re: Windows Services & Other Stuff
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.
- 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.
Last edited by JHPJHP on Tue Sep 14, 2021 11:26 pm, edited 1 time in total.
Re: Windows Services & Other Stuff
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).
- 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).
Re: Windows Services & Other Stuff
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
- 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
Re: Windows Services & Other Stuff
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.
- 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.
Re: Windows Services & Other Stuff
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.
Other downloads that were updated with the modified DPI include file.
GIF Toolkit
Video Snipping Tool
Embed JS into PureBasic
Book & Viewer & Magnify
- 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.
The following Microsoft constants work correctly and can be verified using the same include file.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);
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
GIF Toolkit
Video Snipping Tool
Embed JS into PureBasic
Book & Viewer & Magnify
Re: Windows Services & Other Stuff
Updated:
- improved \Other_Stuff\ColorConversion\Convert\...
- added \Other_Stuff\PowerShell\Convert_HEIC_JPEG\
-- To_HEIC\ToHEIC.pb
-- To_JPEG\ToJPEG.pb
- added \Other_Stuff\PowerShell\PNG_Image_To_Icon\PNGImageIcon.pb
- added \Other_Stuff\ResizeImageFast\ResizeImageFast.pb
Color Conversion
Modified the 11 Color Space examples based on additional testing.
Convert_HEIC / JPEG
https://github.com/DavidAnson/ConvertTo-Heic
https://github.com/DavidAnson/ConvertTo-Jpeg
NB*: The Color Conversion algorithms have also been updated in GIF Toolkit, Spider Web Drawing and Large Image Viewer.
- improved \Other_Stuff\ColorConversion\Convert\...
- added \Other_Stuff\PowerShell\Convert_HEIC_JPEG\
-- To_HEIC\ToHEIC.pb
-- To_JPEG\ToJPEG.pb
- added \Other_Stuff\PowerShell\PNG_Image_To_Icon\PNGImageIcon.pb
- added \Other_Stuff\ResizeImageFast\ResizeImageFast.pb
Color Conversion
Modified the 11 Color Space examples based on additional testing.
Convert_HEIC / JPEG
https://github.com/DavidAnson/ConvertTo-Heic
https://github.com/DavidAnson/ConvertTo-Jpeg
NB*: The Color Conversion algorithms have also been updated in GIF Toolkit, Spider Web Drawing and Large Image Viewer.
Re: Windows Services & Other Stuff
Updated:
- added \Other_Stuff\OtherStuff\WindowOverlapped.pb
- added \Other_Stuff\JumpSprite\JumpSprite.pb
- improved \Other_Stuff\OtherStuff\EnumerateWindows.pb
Window Overlapped
Based on a question asked in this post.
Jump Sprite
Basic animated sprite demonstrating how to apply a smooth jumping algorithm to a walking character.
Based on a comment in this post.
- added \Other_Stuff\OtherStuff\WindowOverlapped.pb
- added \Other_Stuff\JumpSprite\JumpSprite.pb
- improved \Other_Stuff\OtherStuff\EnumerateWindows.pb
Window Overlapped
Based on a question asked in this post.
Jump Sprite
Basic animated sprite demonstrating how to apply a smooth jumping algorithm to a walking character.
Based on a comment in this post.
Re: Windows Services & Other Stuff
Updated:
- improved \Other_Stuff\JumpSprite\JumpSprite.pb
To make the example a little more interesting a bird was added via extracted GIF frames.
Jump the walking guy into the bird to splat the little critter; includes additional sound effects.
- improved \Other_Stuff\JumpSprite\JumpSprite.pb
To make the example a little more interesting a bird was added via extracted GIF frames.
Jump the walking guy into the bird to splat the little critter; includes additional sound effects.
Last edited by JHPJHP on Thu Apr 07, 2022 4:15 am, edited 1 time in total.
Re: Windows Services & Other Stuff
Hi BarryG,
Thank you for taking the time to post a friendly comment.
Please check your PM for the latest version of Jump Sprite; may be useful as a template for small game development.
For more advanced (completed) examples, see Invading Space Aliens and Death Star vs Asteroids.
NB*: Should be cross-platform, but like most of the stuff I've written, was coded in a bubble (zero to little outside testing).
Thank you for taking the time to post a friendly comment.
Please check your PM for the latest version of Jump Sprite; may be useful as a template for small game development.
For more advanced (completed) examples, see Invading Space Aliens and Death Star vs Asteroids.
NB*: Should be cross-platform, but like most of the stuff I've written, was coded in a bubble (zero to little outside testing).
Re: Windows Services & Other Stuff
Updated:
- added \Other_Stuff\OtherStuff\GetProgramData\GetProgramData_1.pb
-- renamed GetProgramData.pb to GetProgramData_2.pb
- modified \Other_Stuff\GoogleTranslate\GoogleTranslate.pb, GoogleTranslate_DLL.pb
GetProgramData_1.pb
Based on a question asked in this post.
Google Translate
As the Google Translate website changes, so the screen-scrape algorithms needed changing.
- added \Other_Stuff\OtherStuff\GetProgramData\GetProgramData_1.pb
-- renamed GetProgramData.pb to GetProgramData_2.pb
- modified \Other_Stuff\GoogleTranslate\GoogleTranslate.pb, GoogleTranslate_DLL.pb
GetProgramData_1.pb
Based on a question asked in this post.
Google Translate
As the Google Translate website changes, so the screen-scrape algorithms needed changing.
Last edited by JHPJHP on Tue Mar 15, 2022 5:55 pm, edited 4 times in total.
Re: Windows Services & Other Stuff
Thanks, I got it from your PM.
Re: Windows Services & Other Stuff
Updated:
- added \Other_Stuff\CrawlingText\DSvA.pb
- added \Other_Stuff\ImageMask\
-- image_mask.pb: DrawingBuffer method, filter black / show white
-- image_mask_alpha.pb: DrawingBuffer method, filter using alpha channel value
-- image_mask_PP.pb: Point / Plot method, filter black / show white
-- image_mask_alpha_PP.pb: Point / Plot method, filter using alpha channel value
-- image_mask_LT.pb: DrawingBuffer method, filter using Luminosity Threshold
- various other improvements to numerous examples
Crawling Text
Introduction from Death Star vs Asteroids based on code written by DK_PETER.
Image Mask
Based on a question asked in this post.
Similar coding techniques can also be found in:
PureBasic Interface to OpenCV
GIF Toolkit
Spider Web Drawing
Video Snipping Tool
Large Image Viewer
Original image plus five filters (the areas in black are transparent):
- added \Other_Stuff\CrawlingText\DSvA.pb
- added \Other_Stuff\ImageMask\
-- image_mask.pb: DrawingBuffer method, filter black / show white
-- image_mask_alpha.pb: DrawingBuffer method, filter using alpha channel value
-- image_mask_PP.pb: Point / Plot method, filter black / show white
-- image_mask_alpha_PP.pb: Point / Plot method, filter using alpha channel value
-- image_mask_LT.pb: DrawingBuffer method, filter using Luminosity Threshold
- various other improvements to numerous examples
Crawling Text
Introduction from Death Star vs Asteroids based on code written by DK_PETER.
Image Mask
Based on a question asked in this post.
Similar coding techniques can also be found in:
PureBasic Interface to OpenCV
GIF Toolkit
Spider Web Drawing
Video Snipping Tool
Large Image Viewer
Original image plus five filters (the areas in black are transparent):
Re: Windows Services & Other Stuff
Updated:
- added \Other_Stuff\DrawingBuffer\
-- Array.pb: two x/y loops
-- GrabImage.pb: single x/y loop
- improved \Other_Stuff\JumpSprite\JumpSprite.pb
- removed \Other_Stuff\OtherStuff\Grayscale.pb
Drawing Buffer
Based on a question asked in this post.
NB*: Comparing the two, GrabImage is over twice as fast as the Array method; see title bar for elapsed time in milliseconds.
Jump Sprite
- added \Other_Stuff\DrawingBuffer\
-- Array.pb: two x/y loops
-- GrabImage.pb: single x/y loop
- improved \Other_Stuff\JumpSprite\JumpSprite.pb
- removed \Other_Stuff\OtherStuff\Grayscale.pb
Drawing Buffer
Based on a question asked in this post.
NB*: Comparing the two, GrabImage is over twice as fast as the Array method; see title bar for elapsed time in milliseconds.
Jump Sprite