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)本来就是微 ...
随机推荐
- 学了一个封装的jquery插件,感觉还成
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- mysqlbackup 备份失败的分析
现象: 1.从mysqlbackup 的日志上来看是它一直处于state: Waiting for locks; 2.从mysql 层面show processlist 上看它的处于waiting f ...
- LinqToSql 小例子
namespace LinqToSqlDemo.Test { class Program { // 数据连接文本 private static DataClasses1DataContext data ...
- Bulk-Only传输协议 UFI命令块规范
USB设备分为5大类,即显示器.通信设备.音频设备.人机输入和海量存储.通常所用的U盘.移动硬盘均属于海量存储类.海量存储类的规范中包括4个独立的子规范,即CBI传输.Bulk-Only传输.ATA命 ...
- 分布式文件系统 Mogilefs 安装步骤
我这里的环境都是 RHEL 5 的环境. MySQL 数据库 和 tracker 都放到一台服务器上, 为 192.168.2.85 storage server两台, 分别为 192.168.2.9 ...
- xampp安装时mysql报错
问题描述:以前安装过mysql,后来安装xampp,mysql打不开,出错提示16:04:48 [mysql] MySQL Service detected with wrong path16:0 ...
- C语言中typedef
一.基本概念剖析 ])(int, char*); //#1 ]) (void (*)()); //#2 ]; //#3 .C语言中函数声明和数组声明.函数声明一般是这样: int fun(int, d ...
- POJ 1094 Sorting It All Out (拓扑排序) - from lanshui_Yang
Description An ascending sorted sequence of distinct values is one in which some form of a less-than ...
- 在Activity中响应ListView内部按钮的点击事件的两种方法!!!
在Activity中响应ListView内部按钮的点击事件的两种方法 转载:http://www.cnblogs.com/ivan-xu/p/4124967.html 最近交流群里面有人问到一个问题: ...
- html中隐藏域hidden的作用
基本语法: <input type="hidden" name="field_name" value="value"> 作用: ...