winapi | Minimal but useful Lua bindings to the Windows API

 by   stevedonovan C Version: 1.4.2 License: Non-SPDX

kandi X-RAY | winapi Summary

kandi X-RAY | winapi Summary

winapi is a C library. winapi has no bugs, it has no vulnerabilities and it has low support. However winapi has a Non-SPDX License. You can download it from GitHub.

This module provides some basic tools for working with Windows systems, finding out system resources, and gives you more control over process creation. In this introduction any plain reference is in the winapi table, so that find_window means winapi.find_window. Normally winapi works with the current Windows code page, but can be told to use UTF-8 with @{set_encoding}; interally string operations are in Unicode.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              winapi has a low active ecosystem.
              It has 178 star(s) with 38 fork(s). There are 19 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 23 open issues and 4 have been closed. On average issues are closed in 7 days. There are 4 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of winapi is 1.4.2

            kandi-Quality Quality

              winapi has 0 bugs and 0 code smells.

            kandi-Security Security

              winapi has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              winapi code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              winapi has a Non-SPDX License.
              Non-SPDX licenses can be open source with a non SPDX compliant license, or non open source licenses, and you need to review them closely before use.

            kandi-Reuse Reuse

              winapi releases are not available. You will need to build from source code and install.
              Installation instructions are not available. Examples and code snippets are available.
              It has 9 lines of code, 0 functions and 1 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of winapi
            Get all kandi verified functions for this library.

            winapi Key Features

            No Key Features are available at this moment for winapi.

            winapi Examples and Code Snippets

            No Code Snippets are available at this moment for winapi.

            Community Discussions

            QUESTION

            Delphi VCL application layout changes when switching theme
            Asked 2022-Jan-17 at 07:59

            I have a toy program and it looks like this:

            This is the code:

            ...

            ANSWER

            Answered 2022-Jan-14 at 23:30

            Windows 10 paints the border of a window with a 1 pixel wide line in dark color immediately outside of the client area. In addition, outside of this 1 pixel line it paints a 6 or 7 pixels wide light shadow or optionally fully transparent. (The shadow / no shadow is selectable from Performance settings.

            Most, if not all (I didn't check) styles, paint the border in a more traditional way, with a clearly visible 7 pixels wide border.

            Here, an example of Windows 10 (no style):

            And here a dark style (Carbon):

            Finally also the Light style

            To use the Light and the Carbon styles gives a similar looking light and dark layout.

            Source https://stackoverflow.com/questions/70716850

            QUESTION

            Adding a component to the Titlebar using CustomTitleBar
            Asked 2021-Dec-22 at 16:00

            I have added a ComboBox to the Title bar by doing the following:

            1. On the Main form I set CustomTitleBar.enabled to true;
            2. Add a TitleBarPanel to the form and set the CustomTitleBar.Control to the TitleBarPanel.
            3. Place a ComboBox on the TitleBarPanel and align it appropriately.

            This works well when I run it but if I add a MainMenu to the form the menu appears under the TitleBarPanel. I have trawled the web for solutions but without success. Is there something else which needs to happen before the MainMenu displays properly.

            This is my form:

            ...

            ANSWER

            Answered 2021-Dec-22 at 16:00

            TMainMenu is just a thin wraper around default windows functionality. You can't change its position. But you can replace it with TActionMainMenuBar. This one can be moved to TTitleBarPanel.

            Source https://stackoverflow.com/questions/70437417

            QUESTION

            Two-Window App Where One Has WS_EX_NOACTIVATE
            Asked 2021-Dec-21 at 18:32

            First of all, this question can be a duplicate but the question doesnt have enough information to solve the problem.

            I have two windows in my native Win32 application. The first is a layered window with WS_EX_NOACTIVATE extended style and the second is a normal window. I want the layered one to be non-activatable. The problem is that, when I have two window in the same application, the layered one which must be non-activatable, gets activated when switching between them. But there is no problem when switching between two external windows, one being not belong to my application. How can I solve this problem? Or Can I solve that? Is there anything I missed? The following is a minimal reproducable example (didn't include any error checking for minimality.) Thank you for taking time.

            ...

            ANSWER

            Answered 2021-Dec-21 at 18:32

            Although I still don't understand the cause of the problem, with the help of @IInspectable's guidance and documentation, I was able to prevent the window from being activated by processing the WM_MOUSEACTIVATE message. The updated window procedure is as follows.

            Source https://stackoverflow.com/questions/70438220

            QUESTION

            Copy all files .doc or .docx in folder and subfolder into another folder
            Asked 2021-Dec-08 at 14:06

            I am new to C++ and winapi, currently working on a project to create a winapi application with a function to copy all files .doc and .docx in one drive to another folder. Below is what I have done and it doesn't seem to work:

            Can anyone show me how to do this properly ?

            ...

            ANSWER

            Answered 2021-Dec-08 at 14:06
            if (!wcscmp(FileSearch.c_str(), L".doc") || !wcscmp(FileSearch.c_str(), L".docx"))
            

            Source https://stackoverflow.com/questions/70269418

            QUESTION

            How to validate user login and PIN
            Asked 2021-Dec-08 at 03:11

            Windows 10/11 provides login to the system with user Login/PIN instead of a password. Is there any winapi way to validate the pair Login/PIN?

            ...

            ANSWER

            Answered 2021-Dec-08 at 03:11

            You can check out the authentication API in this document, which describes several authentication sections (Credentials Management, LSA Authentication, Network Provider API, Smart Card Authentication, SSPI, Winlogon and Credential Providers), and here is an introduction to using Windows Authentication in C#.

            Source https://stackoverflow.com/questions/70204752

            QUESTION

            Determine which window the message was sent (SetWindowsHookEx & WH_KEYBOARD)
            Asked 2021-Dec-02 at 21:47

            I need to be able to determine which window the message is intended for, but I don’t understand how to do it correctly. In WH_MOUSE has a special structure (MOUSEHOOKSTRUCT) that stores the hwnd of the window, but where to get the hwnd in WH_KEYBOARD?

            ...

            ANSWER

            Answered 2021-Dec-02 at 21:33

            I think what you might be looking for is a hook of type WH_JOURNALRECORD.

            With this, the callback procedure that Windows will call in response to the various events that this hook intercepts is of type JournalRecordProc, and the lparam parameter passed to this function points to an EVENTMSG structure, which looks like this:

            Source https://stackoverflow.com/questions/70206640

            QUESTION

            Replace C++ preprocessor macro with something that can initialize a struct
            Asked 2021-Nov-24 at 04:15

            I'm working with WinAPI's CreateDialogIndirect function, which has some requirements on the DLGTEMPLATE and DLGTEMPLATEEX structures pointed to by the second parameter. My code works well, however, I would like to get rid of the #define macros.

            I created a simplified example to focus on the macros. This is a working program with macros, it can be compiled, and outputs what is expected:

            ...

            ANSWER

            Answered 2021-Nov-24 at 00:23

            DLGTEMPLATEEX is a special case. In fact, there is no structures with such a name in the wndows headers. If you want to use a structure, you must create you own, with custom array sizes.4

            Example

            Source https://stackoverflow.com/questions/70088834

            QUESTION

            Creating a thread safe atomic counter
            Asked 2021-Nov-07 at 12:07

            I have a specific requirement in one of the my projects, that is keeping "count" of certain operations and eventually "reading" + "resetting" these counters periodically (eg. 24 hours).

            Operation will be:

            • Worker threads -> increment counters (randomly)
            • Timer thread (eg. 24 hours) -> read count -> do something -> reset counters

            The platform I am interested in is Windows, but if this can be cross platform even better. I'm using Visual Studio and target Windows architecture is x64 only.

            I am uncertain if the result is "ok" and if my implementation is correct. Frankly, never used much std wrappers and my c++ knowledge is quite limited.

            Result is:

            ...

            ANSWER

            Answered 2021-Nov-03 at 04:50

            This looks suspicious:

            Source https://stackoverflow.com/questions/69819729

            QUESTION

            Event Tracing for Windows: OpenTrace/ProcessTrace not returning any events - callback not being called
            Asked 2021-Nov-01 at 19:14
            Short Version

            I'm trying to use OpenTrace and ProcessTrace to read the events of a .etl file.

            • the call to OpenTrace successfully returns a TRACEHANDLE
            • the call to ProcessTrace returns ERROR_SUCCESS
            • but ProcessTrace never calls my EVENT_CALLBACK callback function

            I know it's a valid .etl file, because i can open it in:

            Long Version

            Microsoft provides sample code on reading the events of a .etl file. The basic gist is:

            1. Initialize an EVENT_TRACE_LOGFILE structure with the filename we want to open, and the address of our callback function. The callback function is called once for every event in the file:

              ...

            ANSWER

            Answered 2021-Nov-01 at 19:14

            The answer is exactly what I knew it would be.

            • i started with headers translated by Franck Soranio
            • where some definitions were packed records
            • when that didn't work, I tried adding $ALIGN 8 - the ABI required by Windows
            • when that didn't work, I tried adding packed to all records

            When that didn't work, i asked Stackoverflow.

            In the meantime, i spun up Visual Studio C++, and compared the sizeof of the original structures, and the Delphi translations.

            They didn't match.

            The problem was the packed records.

            • sizeof(EVENT_TRACE_LOGFILEW): 416 bytes (was 404)
              • sizeof(EVENT_TRACE): 88 bytes (was 80)
                • sizeof(EVENT_TRACE_HEADER): 44 bytes (was 40)
              • sizeof(TRACE_LOGFILE_HEADER): 272 bytes

            Removing the record packing fixed it.

            Source https://stackoverflow.com/questions/69780730

            QUESTION

            An algorithm to convert normal filename to DOS 8.3 format
            Asked 2021-Nov-01 at 18:57

            As the title suggests I'm looking for a way to convert "normal" filename into a short 8.3 format. But I need to do it completely without using any external tool for that, I have to know the algorithm.

            Maybe I should explain why: I'm working with a module for SD cards on Arduino, and I found that this module for some reason saves files using 8.3 format, even that the same card inserted into normal computer can have got files with normal filenames.

            The problem is, that when I want to save a file with this module, I have to choose a filename that conforms to the 8.3 format, or I'll be unable to save the file. Some similar problem exists with reading a file: if I give the module a normal filename then the module won't convert it automatically to 8.3 and I won't be able to read it.

            Because I'm coding for Arduino I can't use any external tool like WinAPI's GetShortPathName function. I have to know the right algorithm.

            ...

            ANSWER

            Answered 2021-Nov-01 at 18:57

            The algorithm is described in the Microsoft Extensible Firmware Initiative FAT32 File System Specification. Download fatgen103.doc

            The technique chosen to auto-generate short names from long names is modeled after Windows NT. Auto-generated short names are composed of the basis-name and an optional numeric-tail.

            The Basis-Name Generation Algorithm

            The basis-name generation algorithm is outlined below. This is a sample algorithm and serves to illustrate how short names can be auto-generated from long names. An implementation should follow this basic sequence of steps.

            1. The UNICODE name passed to the file system is converted to upper case.
            2. The upper cased UNICODE name is converted to OEM.
              If (the uppercased UNICODE glyph does not exist as an OEM glyph in the OEM code page) or (the OEM glyph is invalid in an 8.3 name)
              {
              Replace the glyph to an OEM '_' (underscore) character.
              Set a "lossy conversion" flag.
              }
            3. Strip all leading and embedded spaces from the long name.
            4. Strip all leading periods from the long name.
            5. While (not at end of the long name) and (char is not a period) and (total chars copied < 8)
              {
              Copy characters into primary portion of the basis name
              }
            6. Insert a dot at the end of the primary components of the basis-name iff the basis name has an extension after the last period in the name.
            7. Scan for the last embedded period in the long name.
              If (the last embedded period was found)
              {
              While (not at end of the long name) and (total chars copied < 3)
              {
              Copy characters into extension portion of the basis name
              }
              }
            8. Proceed to numeric-tail generation.
            The Numeric-Tail Generation Algorithm

            If (a "lossy conversion" was not flagged) and (the long name fits within the 8.3 naming conventions) and (the basis-name does not collide with any existing short name)
            {
            The short name is only the basis-name without the numeric tail.
            }
            else
            {
            Insert a numeric-tail "~n" to the end of the primary name such that the value of the "~n" is chosen so that the name thus formed does not collide with any existing short name and that the primary name does not exceed eight characters in length.
            }

            The "~n" string can range from "~1" to "~999999". The number "n" is chosen so that it is the next number in a sequence of files with similar basis-names. For example, assume the following short names existed: LETTER~1.DOC and LETTER~2.DOC. As expected, the next auto-generated name of name of this type would be LETTER~3.DOC. Assume the following short names existed: LETTER~1.DOC, LETTER~3.DOC. Again, the next auto-generated name of name of this type would be LETTER~2.DOC. However, one absolutely cannot count on this behavior. In a directory with a very large mix of names of this type, the selection algorithm is optimized for speed and may select another "n" based on the characteristics of short names that end in "~n" and have similar leading name patterns.

            Source https://stackoverflow.com/questions/69690140

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install winapi

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/stevedonovan/winapi.git

          • CLI

            gh repo clone stevedonovan/winapi

          • sshUrl

            git@github.com:stevedonovan/winapi.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Consider Popular C Libraries

            linux

            by torvalds

            scrcpy

            by Genymobile

            netdata

            by netdata

            redis

            by redis

            git

            by git

            Try Top Libraries by stevedonovan

            gentle-intro

            by stevedonovanRust

            luar

            by stevedonovanGo

            runner

            by stevedonovanRust

            luabuild

            by stevedonovanC

            UnderC

            by stevedonovanC++