microwindows Win32 API demo
初次使用microwindows,资料有限,我也是费了很多功夫才明白.所以记录下来,好帮助那些爱学习的童鞋,另外请大虾们多多指教.
什么是microwindows,什么作用,等背景介绍我就不多说了,因为你准备写代码之前,一定研究过了.
下面直接进入主题,如何把源文件编译成lib,写自己的代码,make自己代码,运行等.
环境及版本说明:
Ubuntu 11.04
microwindows-0.92
如何编译源文件:
1- 从网站下载源文件
ftp://microwindows.org/pub/microwindows/microwindows-full-0.92.tar.gz
tar zxvf microwindows-full-0.92.tar.gz
cd microwindows-0.92/src
有3个文件
README //打开文件第一句就说明 "To build Nano-X/Microwindows, see src/INSTALL and src/CONTENTS." 说明很重要,想要编译通过,一定要详细读.
doc // 相关文档
src //源文件
cd src
./xconfigure
环境,编译变量配置.
开始编译源文件:
make
如果编译报错,其主要原因一定是缺少lib库,请查看 src/INSTALL文件,其中包含
. Edit the default configuration file "config", if desired.
There are pre-built configuration files for X11, framebuffer,
and a variety of target systems, see Configs/README. The default configuration is for framebuffer (Configs/config.fb2)
Type "cp Configs/config.x11 config" for the X11 configuration. See CONTENTS and Configs/README for more information.
根据提示读src/CONTENTS文件,其中包含
EXTERNAL REQUIRED LIBRARIES (when configured to use them, latest tested version)
freetype-2.3..tar.gz libfreetype.so - freetype font engine
freetype-1.3..tar.gz libttf.so - freetype font engine
jpegsrc.v6b.tar.gz libjpeg.a - JPEG image library
png-1.2..tar.gz libpng.a - PNG image library
zlib-1.2.3.3.tar.gz libz.a - compression lib for loadable pcf.gz fonts/png files
t1lib-5.1..tar.gz libt1.a - T1 font engine (requires T1LIB_CONFIG=microwin/src/fonts/t1lib/config.t1lib)
以上lib库最好都安装,或者选择自己需要的安装,配合上面./xconfigure的配置
编译通过之后,试运行源文件自带的demo
cd bin
./mtest2

如何写自己代码
我一直在看源文件自带的.src/demos/mwin的代码,由于win32函数参数很多,而且事件驱动开发,导致看完也很渺茫,如何写呢.所以建议初学者先翻阅下此书forgers-win32-tutorial_zh_CN.pdf,找了很多这本入门还不错,很清晰.
Demo功能说明:
用户登录窗口,输入用户名,密码.与文件中存储内容校验,如果相等,则提示"登录成功",否则提示"是否需要新建用户",点击"否"退出messageBox,点击"是"新建用户.内容追加写入文件.
开始写代码:
cd demos/mwin/
vi login_main.c
代码就不在这里体现了,可直接访问:
https://github.com/galoishelley/microwindows
userinfo.pwd 文件格式为: userName|userPwd eg: testlogin|abc123
其实microwindows win32API 就是windows 下得API.
如何编译自己代码
开始修改原代码中自带的Makefile
由于程序在/microwindows-0.92/src/demos/mwin目录,所以修改此目录的Makefile文件
修改Makefile文件很简单,不用都看懂,找程序自带的例子mtest2如何写的,你照搬就好.
ifeq ($(ARCH), PSP) DEMOS = $(MW_DIR_BIN)/mdemo\
$(MW_DIR_BIN)/malpha\
$(MW_DIR_BIN)/mtest\
$(MW_DIR_BIN)/mtest2\
$(MW_DIR_BIN)/mine else DEMOS = $(MW_DIR_BIN)/mdemo\
$(MW_DIR_BIN)/malpha\
$(MW_DIR_BIN)/mtest\
$(MW_DIR_BIN)/mtest2\
$(MW_DIR_BIN)/mine\
$(MW_DIR_BIN)/login_main
修改完Makefile可以编译了
cd /microwindows-.92/src
make
如果不成功,也是自己写的程序问题,可以调试.
如何运行自己写的代码
cd /microwindows-.92/src/bin
./login_main
由于microwindows win32API支持的控件特别少,所以MessageBox都是自己实现的.代码中为MessageBoxC

MessageBox

参考资料:
http://microwindows.org/
read-only access to git repository:
git clone https://github.com/galoishelley/microwindows
microwindows Win32 API demo的更多相关文章
- 【Win32 API】利用SendMessage实现winform与wpf之间的消息传递
原文:[Win32 API]利用SendMessage实现winform与wpf之间的消息传递 引言 有一次心血来潮,突然想研究一下进程间的通信,能够实现消息传递的方法有几种,其中win32ap ...
- 初次认识 C# win32 api
第一次接触win32api,刚开始的时候有点迷迷糊糊的. Windows API 就是windows应用程序接口. win api向上就是windows应用程序,向下就是windows操作系统核心. ...
- Serial Port Programming using Win32 API(转载)
In this tutorial we will learn How to communicate with an external device like a microcontroller boa ...
- 从.NET平台调用Win32 API
MSDN文章<Microsoft Win32 to Microsoft .NET Framework API Map> 介绍了.net 类库对win32的封装 从.NET平台调用Win32 ...
- 【温故Delphi】GAEA用到Win32 API目录
Delphi是Windows平台下著名的快速应用程序开发工具,它在VCL中封装并使用了大量的Win32 API. GAEA基于VCL开发的工具类产品,在程序中使用了大量的Win32 API,将经常用到 ...
- 【C#】分享基于Win32 API的服务操作类(解决ManagedInstallerClass.InstallHelper不能带参数安装的问题)
注:这里的服务是指Windows 服务. ------------------201508250915更新------------------ 刚刚得知TransactedInstaller类是支持带 ...
- C#中导入Win32 API函数
C#中导入Win32 API的方法: 1.引用命名空间 using System.Net.Security; using System.Runtime.InteropServices; 2. [Dll ...
- MSIL 教程(二):数组、分支、循环、使用不安全代码和如何调用Win32 API(转)
转自:http://www.cnblogs.com/Yahong111/archive/2007/08/16/857574.html 续上文[翻译]MSIL 教程(一) ,本文继续讲解数组.分支.循环 ...
- C#调用Win32 api学习总结
从.NET平台调用Win32 API Win32 API可以直接控制Microsoft Windows的核心,因为API(Application Programming Interface)本来就是微 ...
随机推荐
- Linux安装系统注意事项及系统初始化
Linux安装系统注意事项 1.分区 学习用途: /boot:200M /swap :内存的1到2倍 /:根据需要分配大小,比如虚拟机下总空间是15G,那么可以分配8——10G跟/分区,如果是生产 ...
- slave延迟原因及优化方法
转载叶总:http://imysql.com/2015/04/12/mysql-optimization-case-howto-resolve-slave-delay.shtml 一般而言,slave ...
- HDU 3501 Calculation 2(欧拉函数)
Calculation 2 Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submi ...
- UESTC_最少花费 2015 UESTC Training for Dynamic Programming<Problem D>
D - 最少花费 Time Limit: 30000/10000MS (Java/Others) Memory Limit: 65535/65535KB (Java/Others) Submi ...
- Unique Paths II 解答
Question Follow up for "Unique Paths": Now consider if some obstacles are added to the gri ...
- Ajax跨域访问解决办法
方法1. jsonp实现ajax跨域访问示例 jsp代码: <body> <input type="button" onclick="testJsonp ...
- c# 高斯模糊
using System; using System.Collections.Generic; using System.Text; using System.Drawing; using Syste ...
- Struts2使用Interceptor实现权限控制的应用实例详解
Struts2使用Interceptor实现权限控制的应用实例详解 拦截器:是Struts2框架的核心,重点之重.因此,对于我们要向彻底学好Struts2.0.读源码和使用拦截器是必不可少的.少说了. ...
- Javascript中正则表达式的全局匹配模式
先看一道JavaScript题目,据说是国内某知名互联网企业的JavaScript笔试题,如果对正则的全局匹配模式不了解的话可能会对下面的输出结果感到疑惑. var str = "123#a ...
- 多线程:pthread_exit,pthread_join,pthread_self
/*exit_join_id.c*/ #include<pthread.h> #include<stdio.h> void* eji(void* agr) { printf(& ...