Другое С/С++ Вопрос - Ответ

atizoff

приобретаю кашель за деньги
Проверенный
1,295
1,183
как применить стиль в имгуи?
 

4el0ve4ik

Известный
Всефорумный модератор
1,560
1,379
как применить стиль в имгуи?
как то так:
C++:
ImGuiStyle& style = ImGui::GetStyle();
        style.Colors[ImGuiCol_Text] = ImVec4(0.90f, 0.90f, 0.90f, 0.93f);
        style.Colors[ImGuiCol_TextDisabled] = ImVec4(0.60f, 0.60f, 0.60f, 0.68f);
        style.Colors[ImGuiCol_WindowBg] = ImVec4(0.16f, 0.16f, 0.16f, 0.96f);
        style.Colors[ImGuiCol_PopupBg] = ImVec4(0.10f, 0.10f, 0.10f, 0.94f);
        style.Colors[ImGuiCol_Border] = ImVec4(0.34f, 0.33f, 0.34f, 1.00f);
        style.Colors[ImGuiCol_FrameBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.33f);
        style.Colors[ImGuiCol_FrameBgHovered] = ImVec4(0.80f, 0.80f, 1.00f, 0.40f);
        style.Colors[ImGuiCol_FrameBgActive] = ImVec4(0.50f, 0.58f, 0.85f, 0.65f);
        style.Colors[ImGuiCol_TitleBg] = ImVec4(0.40f, 0.40f, 0.39f, 0.80f);
        style.Colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.22f, 0.39f, 0.73f, 0.52f);
        style.Colors[ImGuiCol_TitleBgActive] = ImVec4(0.13f, 0.41f, 0.71f, 1.00f);
        style.Colors[ImGuiCol_MenuBarBg] = ImVec4(0.30f, 0.31f, 0.31f, 0.80f);
        style.Colors[ImGuiCol_ScrollbarBg] = ImVec4(0.20f, 0.25f, 0.30f, 0.00f);
        style.Colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.40f, 0.40f, 0.40f, 0.39f);
        style.Colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.40f, 0.40f, 0.40f, 0.59f);
        style.Colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.50f, 0.50f, 0.50f, 0.72f);
        style.Colors[ImGuiCol_CheckMark] = ImVec4(0.27f, 0.58f, 1.00f, 1.00f);
        style.Colors[ImGuiCol_SliderGrabActive] = ImVec4(0.20f, 0.57f, 1.00f, 0.84f);
        style.Colors[ImGuiCol_Button] = ImVec4(0.27f, 0.58f, 1.00f, 0.78f);
        style.Colors[ImGuiCol_ButtonHovered] = ImVec4(0.37f, 0.64f, 1.00f, 0.94f);
        style.Colors[ImGuiCol_ButtonActive] = ImVec4(0.27f, 0.44f, 1.00f, 1.00f);
        style.Colors[ImGuiCol_Header] = ImVec4(0.49f, 0.49f, 0.49f, 0.46f);
        style.Colors[ImGuiCol_HeaderHovered] = ImVec4(0.45f, 0.45f, 0.50f, 0.49f);
        style.Colors[ImGuiCol_HeaderActive] = ImVec4(0.53f, 0.53f, 0.57f, 0.75f);
        style.Colors[ImGuiCol_ColumnHovered] = ImVec4(0.60f, 0.60f, 0.70f, 1.00f);
        style.Colors[ImGuiCol_ColumnActive] = ImVec4(0.70f, 0.70f, 0.90f, 1.00f);
        style.Colors[ImGuiCol_ResizeGrip] = ImVec4(1.00f, 1.00f, 1.00f, 0.47f);
        style.Colors[ImGuiCol_ResizeGripActive] = ImVec4(0.78f, 0.76f, 1.00f, 1.00f);
        style.Colors[ImGuiCol_CloseButton] = ImVec4(0.50f, 0.50f, 0.50f, 0.89f);
        style.Colors[ImGuiCol_CloseButtonHovered] = ImVec4(0.70f, 0.70f, 0.71f, 0.60f);
        style.Colors[ImGuiCol_PlotLinesHovered] = ImVec4(0.27f, 0.54f, 1.00f, 0.47f);
        style.Colors[ImGuiCol_PlotHistogram] = ImVec4(0.24f, 0.58f, 1.00f, 1.00f);
        style.Colors[ImGuiCol_PlotHistogramHovered] = ImVec4(0.23f, 0.47f, 1.00f, 1.00f);
        style.Colors[ImGuiCol_TextSelectedBg] = ImVec4(0.16f, 0.37f, 0.98f, 0.75f);
 
  • Нравится
Реакции: atizoff

atizoff

приобретаю кашель за деньги
Проверенный
1,295
1,183
как то так:
C++:
ImGuiStyle& style = ImGui::GetStyle();
        style.Colors[ImGuiCol_Text] = ImVec4(0.90f, 0.90f, 0.90f, 0.93f);
        style.Colors[ImGuiCol_TextDisabled] = ImVec4(0.60f, 0.60f, 0.60f, 0.68f);
        style.Colors[ImGuiCol_WindowBg] = ImVec4(0.16f, 0.16f, 0.16f, 0.96f);
        style.Colors[ImGuiCol_PopupBg] = ImVec4(0.10f, 0.10f, 0.10f, 0.94f);
        style.Colors[ImGuiCol_Border] = ImVec4(0.34f, 0.33f, 0.34f, 1.00f);
        style.Colors[ImGuiCol_FrameBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.33f);
        style.Colors[ImGuiCol_FrameBgHovered] = ImVec4(0.80f, 0.80f, 1.00f, 0.40f);
        style.Colors[ImGuiCol_FrameBgActive] = ImVec4(0.50f, 0.58f, 0.85f, 0.65f);
        style.Colors[ImGuiCol_TitleBg] = ImVec4(0.40f, 0.40f, 0.39f, 0.80f);
        style.Colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.22f, 0.39f, 0.73f, 0.52f);
        style.Colors[ImGuiCol_TitleBgActive] = ImVec4(0.13f, 0.41f, 0.71f, 1.00f);
        style.Colors[ImGuiCol_MenuBarBg] = ImVec4(0.30f, 0.31f, 0.31f, 0.80f);
        style.Colors[ImGuiCol_ScrollbarBg] = ImVec4(0.20f, 0.25f, 0.30f, 0.00f);
        style.Colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.40f, 0.40f, 0.40f, 0.39f);
        style.Colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.40f, 0.40f, 0.40f, 0.59f);
        style.Colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.50f, 0.50f, 0.50f, 0.72f);
        style.Colors[ImGuiCol_CheckMark] = ImVec4(0.27f, 0.58f, 1.00f, 1.00f);
        style.Colors[ImGuiCol_SliderGrabActive] = ImVec4(0.20f, 0.57f, 1.00f, 0.84f);
        style.Colors[ImGuiCol_Button] = ImVec4(0.27f, 0.58f, 1.00f, 0.78f);
        style.Colors[ImGuiCol_ButtonHovered] = ImVec4(0.37f, 0.64f, 1.00f, 0.94f);
        style.Colors[ImGuiCol_ButtonActive] = ImVec4(0.27f, 0.44f, 1.00f, 1.00f);
        style.Colors[ImGuiCol_Header] = ImVec4(0.49f, 0.49f, 0.49f, 0.46f);
        style.Colors[ImGuiCol_HeaderHovered] = ImVec4(0.45f, 0.45f, 0.50f, 0.49f);
        style.Colors[ImGuiCol_HeaderActive] = ImVec4(0.53f, 0.53f, 0.57f, 0.75f);
        style.Colors[ImGuiCol_ColumnHovered] = ImVec4(0.60f, 0.60f, 0.70f, 1.00f);
        style.Colors[ImGuiCol_ColumnActive] = ImVec4(0.70f, 0.70f, 0.90f, 1.00f);
        style.Colors[ImGuiCol_ResizeGrip] = ImVec4(1.00f, 1.00f, 1.00f, 0.47f);
        style.Colors[ImGuiCol_ResizeGripActive] = ImVec4(0.78f, 0.76f, 1.00f, 1.00f);
        style.Colors[ImGuiCol_CloseButton] = ImVec4(0.50f, 0.50f, 0.50f, 0.89f);
        style.Colors[ImGuiCol_CloseButtonHovered] = ImVec4(0.70f, 0.70f, 0.71f, 0.60f);
        style.Colors[ImGuiCol_PlotLinesHovered] = ImVec4(0.27f, 0.54f, 1.00f, 0.47f);
        style.Colors[ImGuiCol_PlotHistogram] = ImVec4(0.24f, 0.58f, 1.00f, 1.00f);
        style.Colors[ImGuiCol_PlotHistogramHovered] = ImVec4(0.23f, 0.47f, 1.00f, 1.00f);
        style.Colors[ImGuiCol_TextSelectedBg] = ImVec4(0.16f, 0.37f, 0.98f, 0.75f);
сделал также, но чёт ничего
C++:
#include <sstream>
#include <Windows.h>

#include "imgui/imgui.h"
#include "GUI.h"
#include "Config.h"
#include "Hacks/Misc.h"
#include "Hacks/Visuals.h"

constexpr auto windowFlags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize
| ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse;

void GUI::style() noexcept
{
#define HI(v)   ImVec4(0.502f, 0.075f, 0.256f, v)
#define MED(v)  ImVec4(0.455f, 0.198f, 0.301f, v)
#define LOW(v)  ImVec4(0.232f, 0.201f, 0.271f, v)
    // backgrounds (@todo: complete with BG_MED, BG_LOW)
#define BG(v)   ImVec4(0.200f, 0.220f, 0.270f, v)
// text
#define TEXT(v) ImVec4(0.860f, 0.930f, 0.890f, v)

    auto &style = ImGui::GetStyle();
    style.Colors[ImGuiCol_Text] = TEXT(0.78f);
    style.Colors[ImGuiCol_TextDisabled] = TEXT(0.28f);
    style.Colors[ImGuiCol_WindowBg] = ImVec4(0.13f, 0.14f, 0.17f, 1.00f);
    style.Colors[ImGuiCol_PopupBg] = BG(0.9f);
    style.Colors[ImGuiCol_Border] = ImVec4(0.31f, 0.31f, 1.00f, 0.00f);
    style.Colors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
    style.Colors[ImGuiCol_FrameBg] = BG(1.00f);
    style.Colors[ImGuiCol_FrameBgHovered] = MED(0.78f);
    style.Colors[ImGuiCol_FrameBgActive] = MED(1.00f);
    style.Colors[ImGuiCol_TitleBg] = LOW(1.00f);
    style.Colors[ImGuiCol_TitleBgActive] = HI(1.00f);
    style.Colors[ImGuiCol_TitleBgCollapsed] = BG(0.75f);
    style.Colors[ImGuiCol_MenuBarBg] = BG(0.47f);
    style.Colors[ImGuiCol_ScrollbarBg] = BG(1.00f);
    style.Colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.09f, 0.15f, 0.16f, 1.00f);
    style.Colors[ImGuiCol_ScrollbarGrabHovered] = MED(0.78f);
    style.Colors[ImGuiCol_ScrollbarGrabActive] = MED(1.00f);
    style.Colors[ImGuiCol_CheckMark] = ImVec4(0.71f, 0.22f, 0.27f, 1.00f);
    style.Colors[ImGuiCol_SliderGrab] = ImVec4(0.47f, 0.77f, 0.83f, 0.14f);
    style.Colors[ImGuiCol_SliderGrabActive] = ImVec4(0.71f, 0.22f, 0.27f, 1.00f);
    style.Colors[ImGuiCol_Button] = ImVec4(0.47f, 0.77f, 0.83f, 0.14f);
    style.Colors[ImGuiCol_ButtonHovered] = MED(0.86f);
    style.Colors[ImGuiCol_ButtonActive] = MED(1.00f);
    style.Colors[ImGuiCol_Header] = MED(0.76f);
    style.Colors[ImGuiCol_HeaderHovered] = MED(0.86f);
    style.Colors[ImGuiCol_HeaderActive] = HI(1.00f);
    style.Colors[ImGuiCol_ResizeGrip] = ImVec4(0.47f, 0.77f, 0.83f, 0.04f);
    style.Colors[ImGuiCol_ResizeGripHovered] = MED(0.78f);
    style.Colors[ImGuiCol_ResizeGripActive] = MED(1.00f);
    style.Colors[ImGuiCol_PlotLines] = TEXT(0.63f);
    style.Colors[ImGuiCol_PlotLinesHovered] = MED(1.00f);
    style.Colors[ImGuiCol_PlotHistogram] = TEXT(0.63f);
    style.Colors[ImGuiCol_PlotHistogramHovered] = MED(1.00f);
    style.Colors[ImGuiCol_TextSelectedBg] = MED(0.43f);
    // [...]

    style.WindowPadding = ImVec2(6, 4);
    style.WindowRounding = 0.0f;
    style.FramePadding = ImVec2(5, 2);
    style.FrameRounding = 3.0f;
    style.ItemSpacing = ImVec2(7, 1);
    style.ItemInnerSpacing = ImVec2(1, 1);
    style.TouchExtraPadding = ImVec2(0, 0);
    style.IndentSpacing = 6.0f;
    style.ScrollbarSize = 12.0f;
    style.ScrollbarRounding = 16.0f;
    style.GrabMinSize = 20.0f;
    style.GrabRounding = 2.0f;

    style.WindowTitleAlign.x = 0.50f;

    style.Colors[ImGuiCol_Border] = ImVec4(0.539f, 0.479f, 0.255f, 0.162f);
    style.FrameBorderSize = 0.0f;
    style.WindowBorderSize = 1.0f;
}

void GUI::render() noexcept
{
    renderMenuBar();
    renderGlowWindow();
    renderVisualsWindow();
    renderMiscWindow();
}

void GUI::checkBoxAndColorPicker(const std::string& name, bool* enable, float* color) noexcept
{
    ImGui::Checkbox(("##" + name).c_str(), enable);
    ImGui::SameLine(0.0f, 5.0f);
    bool openPopup = ImGui::ColorButton(("##" + name + "ColorButton").c_str(), ImColor{ color[0], color[1], color[2] }, ImGuiColorEditFlags_NoTooltip);
    ImGui::SameLine(0.0f, 5.0f);
    ImGui::Text(name.c_str());
    if (openPopup)
        ImGui::OpenPopup(("##" + name + "Popup").c_str());
    if (ImGui::BeginPopup(("##" + name + "Popup").c_str())) {
        ImGui::ColorPicker3(("##" + name + "Picker").c_str(), color, ImGuiColorEditFlags_DisplayRGB | ImGuiColorEditFlags_NoSidePreview);
        ImGui::EndPopup();
    }
}

void GUI::hotkey(int& key) noexcept
{
    ImGui::Text((std::ostringstream{ } << "[ " << (key ? std::to_string(key) : "key") << " ]").str().c_str());
    if (ImGui::IsItemHovered()) {
        ImGuiIO& io = ImGui::GetIO();
        for (int i = 0; i < IM_ARRAYSIZE(io.KeysDown); i++)
            if (ImGui::IsKeyPressed(i) && i != VK_INSERT)
                key = i != VK_ESCAPE ? i : 0;
    }
}

void GUI::renderMenuBar() noexcept
{
    if (ImGui::BeginMainMenuBar()) {
        auto &style = ImGui::GetStyle();
        ImGui::MenuItem("glow", nullptr, &window.glow);
        ImGui::MenuItem("visuals", nullptr, &window.visuals);
        ImGui::MenuItem("misc", nullptr, &window.misc);

        if (ImGui::BeginMenu("config")) {
            if (ImGui::MenuItem("load"))
                config.load();
            if (ImGui::MenuItem("save"))
                config.save();
            if (ImGui::MenuItem("reset"))
                config.reset();
            ImGui::EndMenu();
        }
        ImGui::EndMainMenuBar();
    }
}

void GUI::renderGlowWindow() noexcept
{
    if (window.glow) {
        auto &style = ImGui::GetStyle();
        ImGui::SetNextWindowSize({ 320.0f, 185.0f });
        ImGui::Begin("glow", &window.glow, windowFlags);
        ImGui::Columns(2, nullptr, false);
        ImGui::SetColumnOffset(1, 170.0f);
        ImGui::PushItemWidth(150.0f);
        ImGui::Checkbox("Enable", &config.glow.enabled);
        ImGui::SliderFloat("##1", &config.glow.thickness, 0.0f, 1.0f, "Thiccness: %.2f");
        ImGui::SliderFloat("##2", &config.glow.alpha, 0.0f, 1.0f, "Alpha: %.2f");
        ImGui::SliderInt("##3", &config.glow.style, 0, 3, "Style: %d");
        checkBoxAndColorPicker("Temmates", &config.glow.allies, config.glow.alliesColor);
        checkBoxAndColorPicker("Enemies", &config.glow.enemies, config.glow.enemiesColor);
        ImGui::NextColumn();
        checkBoxAndColorPicker("Local Player", &config.glow.localPlayer, config.glow.localPlayerColor);
        checkBoxAndColorPicker("Weapons", &config.glow.weapons, config.glow.weaponsColor);
        checkBoxAndColorPicker("C4", &config.glow.C4, config.glow.C4Color);
        checkBoxAndColorPicker("Planted C4", &config.glow.plantedC4, config.glow.plantedC4Color);
        checkBoxAndColorPicker("Chickens", &config.glow.chickens, config.glow.chickensColor);
        ImGui::End();
    }
}

void GUI::renderVisualsWindow() noexcept
{
    if (window.visuals) {
        auto &style = ImGui::GetStyle();
        ImGui::SetNextWindowSize({ 520.0f, 315.0f });
        ImGui::Begin("Visuals", &window.visuals, windowFlags);
        ImGui::Columns(2, nullptr, false);
        ImGui::SetColumnOffset(1, 210.0f);
        ImGui::Checkbox("Off visual recoil", &config.visuals.noVisualRecoil);
        ImGui::Checkbox("Off sleeves", &config.visuals.noSleeves);
        ImGui::Checkbox("Off smoke", &config.visuals.noSmoke);
        ImGui::Checkbox("No blur", &config.visuals.noBlur);
        ImGui::Checkbox("Off scope overlay", &config.visuals.noScopeOverlay);
        ImGui::Checkbox("Wireframe smoke", &config.visuals.wireframeSmoke);
        ImGui::Checkbox("Sniper crosshair", &config.misc.sniperCrosshair);
        ImGui::NextColumn();
        ImGui::Checkbox("Third person", &config.visuals.thirdperson);
        ImGui::SameLine();
        hotkey(config.visuals.thirdpersonKey);
        ImGui::PushItemWidth(290.0f);
        ImGui::SliderInt("##1", &config.visuals.thirdpersonDistance, 0, 200, "Third person distance: %d");
        ImGui::SliderInt("##2", &config.visuals.viewmodelFov, -60, 60, "Viewmodel fov: %d");
        ImGui::SliderInt("##3", &config.visuals.flashReduction, 0, 100, "Flash reduction: %d%%");
        ImGui::SliderFloat("##4", &config.visuals.brightness, 0.0f, 1.0f, "Brightness: %.2f");
        ImGui::PopItemWidth();
        ImGui::Combo("Skybox", &config.visuals.skybox, "Default\0cs_baggage_skybox_\0cs_tibet\0embassy\0italy\0jungle\0nukeblank\0office\0sky_cs15_daylight01_hdr\0sky_cs15_daylight02_hdr\0sky_cs15_daylight03_hdr\0sky_cs15_daylight04_hdr\0sky_csgo_cloudy01\0sky_csgo_night_flat\0sky_csgo_night02\0sky_day02_05_hdr\0sky_day02_05\0sky_dust\0sky_l4d_rural02_ldr\0sky_venice\0vertigo_hdr\0vertigo\0vertigoblue_hdr\0vietnam");
        ImGui::ColorEdit3("World color", config.visuals.worldColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoTooltip);
        ImGui::End();
    }
}

void GUI::renderMiscWindow() noexcept
{
    if (window.misc) {
        auto &style = ImGui::GetStyle();
        ImGui::SetNextWindowSize({ 220.0f, 340.0f });
        ImGui::Begin("Misc", &window.misc, windowFlags);
        ImGui::Checkbox("Bhop", &config.misc.bunnyHop);
        static char buffer[16];
        ImGui::PushItemWidth(120.0f);
        ImGui::InputText("##1", buffer, IM_ARRAYSIZE(buffer));
        ImGui::SameLine();
        if (ImGui::Button("Clantag")) {
            Misc::setClanTag(buffer);
            Misc::animateClanTag(buffer);
        }
        ImGui::Checkbox("Animate clantag", &config.misc.animatedClanTag);
        ImGui::Checkbox("Spectators", &config.misc.spectatorList);
        ImGui::Checkbox("Watermark", &config.misc.watermark);
        ImGui::Checkbox("Fast duck", &config.misc.fastDuck);
        ImGui::Checkbox("Reveal ranks", &config.misc.ranks);
        ImGui::Checkbox("Auto pistol", &config.misc.autoPistol);
        ImGui::End();
    }
}
 

Sarutobi1

Новичок
1
0
void *obj = *(void **)((DWORD)samp + 0x95CD0);
((void(__thiscall *) (void *, int, bool)) ((DWORD)samp + 0x95CD0))(obj, iToggle ? 3 : 0, !iToggle);

За что отвечают эти два адреса ?
 

mrdiimax

Известный
566
79
Как занопать определенные фрагменты памяти? Пример, я знаю что врайтпроцессмемори, но как занопать несколько сразу
 

Cake_

Потрачен
Проверенный
263
314
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Как воспроизвести аудио файл в SAMPFUNCS? Можно пример?
 

Belo4ka_belka

Известный
191
7
Здравствуйте, товарищи, возникла проблема. Использую moonloader, необходимо отправить сообщение через sendmessage (или postmessage) окну имея его PID. Использую для этого библиотеку ffi, которая способна выполнять win api функции через луа. Однако эта библиотека использует синтаксис СИ обычного (я так понял это C, просто я в C++ C# и С не разбираюсь, они вроде бы одно и тоже, но почему тогда разные названия :)?). Все мое движение уперлось в написании кода на СИ, который потом можно будет выполнить через луа. Приведу то, что я нарыл в гугле и попытался использовать:
Код:
ffi.cdef[[
int SendMessage(int hWnd, int Msg, int wParam, int lParam);
]]
ffi.C.SendMessage(9576, 0x1002, 0xFF, 0xFFF)
Все что внутри ffi.cdef между [[ ]] это код на СИ, я так понял нужно записать этот код так, как будто он выполнялся бы на СИ, а аргументы получит через луа, который переделает параметры под стандарты СИ. Или это экспорт функции SendMessage... UPD: погуглил, это похоже сигнатура функции... Этот код вызывает следующую ошибку:
Код:
[19:54:12.474688] (error)    test.lua: C:\Games\GTA San Andreas\moonloader\test.lua:33: cannot resolve symbol 'SendMessage': Не найдена указанная процедура.
Возможно это поможет вам понять, что я сделал не так. Помогите пожалуйста записать СИшный код правильно, я конечно спросил в разделе луа, но все таки то раздел луа, а тут проблема в коде написанном на СИ, потому шансов получить помощь у меня больше здесь, я полагаю.
Прошу отнестись ко мне снисходительно, я никогда не изучал СИ и дай Бог если это мой единственный раз, когда я столкнусь с этим языком. Рассчитываю на вашу поддержку.
 
Последнее редактирование:

Imbecil

Новичок
15
0
Как сделать так, чтобы по определенной команде в чат писало '/me ' и строку из test.ini файла
 

san0

Известный
Друг
412
275
Рассчитываю на вашу поддержку.
Вы попались на то, что многие функции WinAPI реализованы в двух вариантах - для строк Unicode (по правильному конечно это wide characters) и ASCII. Для простоты выбора конкретной из них используют директивы препроцессора, одна из которых на этапе компиляции сама подбирает вариацию функции на основе настроек проекта. Т.е. все функции по типу MessageBox на самом деле бывают двух вариантов - MessageBoxA и MessageBoxW, сам MessageBox - это только макрос.
Это, конечно, весьма не детальное описание, о поддержке широких символов можно почитать тут https://docs.microsoft.com/en-us/windows/desktop/LearnWin32/working-with-strings
В lua Вы, естественно, вручную беспокоитесь о декларировании функций, а это значит, что макроса SendMessage здесь нет, в то время как внешний символ SendMessageA присутствует в составе библиотеки user32.dll.
Lua:
function main()
    local ffi = require('ffi')
    ffi.cdef('int SendMessageA(int, int, int, int);')
    ffi.C.SendMessageA(9576, 0x1002, 0xFF, 0xFFF)
end
 
  • Нравится
Реакции: Belo4ka_belka