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.setTarget(target);
exe.setBuildMode(mode); exe.setBuildMode(mode);
exe.linkLibC();
if (target.getOs().tag == .linux) { 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 // 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 // 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 // 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); exe.addObjectFile(obj);
} }
if (target.getOs().tag == .windows) { if (target.getOs().tag == .windows) {
// exe.linkLibC(); // woah...we don't actually need libc!
// exe.addIncludeDir("/usr/include/"); exe.linkSystemLibrary("user32");
// exe.linkSystemLibrary("X11");
} }
exe.install(); exe.install();

View File

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