get an actual message box showing

This commit is contained in:
Emil Lerch 2021-11-17 11:50:34 -08:00
parent 03132d2c67
commit d8d3fa204e
Signed by: lobo
GPG Key ID: A7B62D657EF764F8
2 changed files with 15 additions and 12 deletions

View File

@ -19,8 +19,8 @@ pub fn build(b: *std.build.Builder) void {
exe.setTarget(target);
exe.setBuildMode(mode);
exe.linkLibC();
if (target.getOs().tag == .linux) {
exe.linkLibC();
// LibX11 1.7.2: https://gitlab.freedesktop.org/xorg/lib/libx11/-/archive/libX11-1.7.2/libx11-libX11-1.7.2.tar.gz
// LibXfixes 5.0.3: https://gitlab.freedesktop.org/xorg/lib/libxfixes/-/archive/libXfixes-5.0.3/libxfixes-libXfixes-5.0.3.tar.gz
// XOrg Proto: https://gitlab.freedesktop.org/xorg/proto/xorgproto/-/archive/xorgproto-2021.5/xorgproto-xorgproto-2021.5.tar.gz
@ -43,9 +43,8 @@ pub fn build(b: *std.build.Builder) void {
exe.addObjectFile(obj);
}
if (target.getOs().tag == .windows) {
// exe.linkLibC();
// exe.addIncludeDir("/usr/include/");
// exe.linkSystemLibrary("X11");
// woah...we don't actually need libc!
exe.linkSystemLibrary("user32");
}
exe.install();

View File

@ -1,10 +1,14 @@
const std = @import("std");
const win = @cImport({
@cInclude("windows.h");
});
pub fn clipboardAction(watch: bool) !void {
_ = watch;
const stdout = std.io.getStdOut().writer();
try stdout.print("All your codebase are belong to us", .{});
try stdout.print("{d}", .{win.HINSTANCE});
const w = std.os.windows;
extern "user32" fn MessageBoxA(hWnd: ?w.HANDLE, lpText: ?w.LPCSTR, lpCaption: ?w.LPCSTR, uType: w.UINT) callconv(w.WINAPI) c_int;
pub export fn wWinMain(hInstance: w.HINSTANCE, hPrevInstance: ?w.HINSTANCE, lpCmdLine: w.PWSTR, nCmdShow: w.INT) w.INT {
_ = hInstance;
_ = hPrevInstance;
_ = lpCmdLine;
_ = nCmdShow;
_ = MessageBoxA(null, "all your codebase are belong to us", "title", 0);
return 0;
}