linux c语言显示器api,API级别的Unicode GUI用于Windows / Linux / Mac的C语言本机应用程序...

API级Unicode GUI用于Windows / Linux / Mac OS X的C中的本机应用程序 .

我正在寻找一个简单的 Unicode , GUI , Native 应用程序,它可以在不需要任何非标准库的情况下运行,用C编译用GNU-GCC(g)编写 .

不是

我不是指一个代码源运行任何地方,而是3(Win / Linux / Mac)代码源! run-without-library(本机应用程序) .

*原生申请

应用程序可以运行而无需任何非标准库,只需要操作系统C运行时(如Windows上的MSVCRT) .

* Unicode应用程序

从右到左的窗口布局(支持从右到左阅读语言),两个按钮[Message]在消息框中显示UTF-8 stings(“اهلابالعالم”),[Exit]到... i想退出! :p

===================================

Windows解决方案(Windows 7)

编译器:MinGW g 4.5.0

命令行:

g++ -Wl,--enable-auto-import -O2 -fno-strict-aliasing -DWIN32_LEAN_AND_MEAN -D_UNICODE -DUNICODE -mwindows -Wall test.cpp -o test.exe

#include (windows.h)

#include (tchar.h)

#include (string)

typedef std::basic_string ustring;

LONG StandardExtendedStyle;

TCHAR buffer_1[1024];

TCHAR buffer_2[1024];

static HWND button_1;

static HWND button_2;

inline int ErrMsg(const ustring& s)

{

return MessageBox(0,s.c_str(),_T("ERROR"),MB_OK|MB_ICONEXCLAMATION);

}

LRESULT CALLBACK WndProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam)

{

switch (uMsg)

{

case WM_CREATE:

button_1=CreateWindow(L"button",L"UTF-8 Message",WS_CHILD|WS_VISIBLE,10,10,120,25,hwnd,(HMENU)1,NULL,NULL);

button_2=CreateWindow(L"button",L"Exit",WS_CHILD|WS_VISIBLE,10,50,120,25,hwnd,(HMENU)2,NULL,NULL);

break;

case WM_COMMAND:

switch(LOWORD(wParam))

{

case 1:

_stprintf(buffer_1,L"اهلا بالعالم");

_stprintf(buffer_2,L"Hello World in Arabic !");

MessageBoxW(hwnd,buffer_1,buffer_2,MB_ICONINFORMATION|MB_OK|MB_RTLREADING|MB_RIGHT);

break;

case 2:

PostQuitMessage(0);

break;

}break;

case WM_CLOSE:

DestroyWindow(hwnd);

break;

case WM_DESTROY:

PostQuitMessage(0);

break;

default:

return DefWindowProc(hwnd,uMsg,wParam,lParam);

}

return 0;

}

int WINAPI WinMain(HINSTANCE hInst,HINSTANCE,LPSTR pStr,int nCmd)

{

ustring classname=_T("window");

WNDCLASSEX window={0};

window.cbSize = sizeof(WNDCLASSEX);

window.lpfnWndProc = WndProc;

window.hInstance = hInst;

window.hIcon = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(100), IMAGE_ICON, 16, 16, 0);

window.hCursor = reinterpret_cast(LoadImage(0,IDC_ARROW,IMAGE_CURSOR,0,0,LR_SHARED));

window.hbrBackground = reinterpret_cast(COLOR_BTNFACE+1);

window.lpszClassName = classname.c_str();

if (!RegisterClassEx(&window))

{

ErrMsg(_T("Failed to register wnd class"));return -1;

}

int desktopwidth=GetSystemMetrics(SM_CXSCREEN);

int desktopheight=GetSystemMetrics(SM_CYSCREEN);

HWND hwnd=CreateWindowEx(0,classname.c_str(),_T("The solution for Windows"),WS_OVERLAPPEDWINDOW,desktopwidth/4,desktopheight/4,270,150,0,0,

hInst,0);

if (!hwnd)

{

ErrMsg(_T("Failed to create wnd"));

return -1;

}

StandardExtendedStyle=GetWindowLong(hwnd,GWL_EXSTYLE);

SetWindowLong(hwnd,GWL_EXSTYLE,StandardExtendedStyle|WS_EX_LAYOUTRTL);

ShowWindow(hwnd,nCmd);

UpdateWindow(hwnd);

MSG msg;

while (GetMessage(&msg,0,0,0)>0)

{

TranslateMessage(&msg);

DispatchMessage(&msg);

}

return static_cast(msg.wParam);

}

===================================

Linux的解决方案

请帮帮忙!

如何在Linux上运行应用程序而不告诉用户安装这个和本机Linux应用程序!

文件格式最多的是什么? ELF,宾..?

X11是原生的Linux GUI库?或WxWidgets,QT,GTK,gtkmm .. ??? !!!

可以在Gnome和KDE上运行吗?或需要不同的代码源?

谁知道Linux的解决方案?

===================================

适用于Mac OS X的解决方案

请帮帮忙!

我认为Mac OS X的解决方案是C with C中的Cocoa!但我必须确定!

G可以用Cocoa构建原生Mac OS应用程序吗?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值