摘要: #include "math.h"#include<iostream> using namespace std; class Point { public: Point(double xx, double yy) { x=xx; y=yy; } void Getxy(); friend double Distance(Point &a, Point &b); //类Point的友元函数 friend class Yao; //类Point的友元类private: dou... 阅读全文
posted @ 2012-12-27 15:41 Roarsun 阅读(232) 评论(0) 推荐(0) 编辑
摘要: 制作安装包时,涉及的技术包括安装位置设定、目录创建、相关文件的拷贝、数据库初始化、相关文件的注册、打包成单一文件及其它初始化等,一般我们都喜欢把这些复杂的工作交给专业打包工具如InstallShield等来处理。但只要善于整理,不借助专业打包工具,仅使用VC自己打包也很可行。使用VC打包的难点在于把所有文件打包成单一文件,本文将使用一示例主要解决此问题。在VC工程中,导入其它文件(这里使用exe格式的可执行文件),Resource Type使用EXE,资源名:IDR_EXE1;对话框工程中添加函数如下:BOOL CMyDlg::ReleaseRes(CString strFileName, W 阅读全文
posted @ 2012-12-24 16:25 Roarsun 阅读(1576) 评论(1) 推荐(0) 编辑
摘要: WM_CREATE:创建窗口WM_CHAR:按键消息WM_TIMER:定时器WM_PAINT:窗口重绘WM_WINDOWPOSCHANGING:窗口位置发生变化(超始点坐标变化)WM_SETFOCUS:窗口得到焦点WM_KILLFOCUS:窗口失去焦点WM_CLOSE:关闭窗口WM_DESTROY:关闭程序 阅读全文
posted @ 2012-12-23 13:33 Roarsun 阅读(311) 评论(0) 推荐(0) 编辑
摘要: 1、在项目自动生成的stdafx.h文件中添加下面头文件#include <io.h> //在MFC下可不使用此头文件#include <fcntl.h>#include <stdio.h>2、把下面的函数加到你初始化的地方,然后你就可以使用printf函数了void InitConsoleWindow(){ int nCrt = 0; FILE* fp; AllocConsole(); nCrt = _open_osfhandle((long)GetStdHandle(STD_OUTPUT_HANDLE), _O_TEXT); fp = _fdopen(n 阅读全文
posted @ 2012-12-23 13:04 Roarsun 阅读(835) 评论(2) 推荐(0) 编辑
摘要: #include "math.h"#include<iostream> using namespace std; class Point { public: Point(double xx, double yy) { x=xx; y=yy; } void Getxy(); friend double Distance(Point &a, Point &b); //类Point的友元函数 friend class Yao; //类Point的友元类private: dou... 阅读全文
posted @ 2012-12-22 14:40 Roarsun 阅读(7085) 评论(0) 推荐(0) 编辑
摘要: 直接上代码:1. 界面上添加三个按钮和一个提示框:<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}"> <StackPanel VerticalAlignment="Center" Margin="34,558,-34,137"> <StackPanel Orientation="Horizontal"> <Button Content="一个按钮的消息框" Cl 阅读全文
posted @ 2012-12-21 23:47 Roarsun 阅读(300) 评论(0) 推荐(0) 编辑
摘要: 保存配置参数至系统使用如下:ApplicationDataContainer myContainer = ApplicationData.Current.LocalSettings; myContainer.Values["index"] = "Hello"; 从系统中读取软件配置参数使用:ApplicationDataContainer container = ApplicationData.Current.LocalSettings; String str = (string)container.Values["index"]; 阅读全文
posted @ 2012-12-21 22:56 Roarsun 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 1.页面间数据交互我们使用CoreApplication类,它位于Windows.ApplicationModel.Core命名空间,具体为在一个页面中保存变量如下:Windows.ApplicationModel.Core.CoreApplication.Properties["value1"] = "Hello";并在另一页面中读取此变量:String str = Windows.ApplicationModel.Core.CoreApplication.Properties["value1"] as string;另一种方法是调 阅读全文
posted @ 2012-12-21 21:52 Roarsun 阅读(390) 评论(0) 推荐(0) 编辑
摘要: Win8Metro程序开发时使用的BlankApp与MFC的对话框应用程序框架类似:1.MFC对话框程序包含应用程序类(CXXApp类)和对话框类(CXXDialog类),其分别包含头文件和源文件,头文件用于声明,源文件用于实现。执行顺序依次是:以CXXApp类为入口,其中InitInstance()调用执行对话框;2.WinMetro的BlankApp工程包含App和MainPage两个主要模块,其中包含.xaml文件和.cs文件,前者主要用于界面,后者用于逻辑。App类的构造函数可看作工程的入口函数,函数OnLaunched()在启动界面时被响应,并在此函数中调用执行MainPage页面, 阅读全文
posted @ 2012-12-21 21:01 Roarsun 阅读(669) 评论(0) 推荐(0) 编辑
摘要: ClassApp中OnLaunched(LaunchActiatedEventArgsargs)是在应用程序正常启动时调用,一般包括两种情况:初次启动、挂起后继续,其中参数args指的是上一次的软件上一次运行的状态,可以通过下面的代码来测试: /*------------------------------------------------------------------------------------*/ // 判断前一个状态 ***注意是前一个状态 string State = string.Empty; ... 阅读全文
posted @ 2012-12-20 23:33 Roarsun 阅读(654) 评论(0) 推荐(0) 编辑