Windows API 第六篇 GetLocalTime
GetLocalTime获取系统时间信息。函数原型:
VOID WINAPI GetLocalTime(
__out LPSYSTEMTIME lpSystemTime
);
先来看SYSTEMTIME结构:
typedef struct _SYSTEMTIME {
WORD wYear;
WORD wMonth;
WORD wDayOfWeek;
WORD wDay;
WORD wHour;
WORD wMinute;
WORD wSecond;
WORD wMilliseconds;
} SYSTEMTIME, *PSYSTEMTIME, *LPSYSTEMTIME;
可知该函数可以很方便的得到当前时间的有关信息。
举一个小例子:
#include <Windows.h>
void main()
{
SYSTEMTIME sysTime;
GetLocalTime(&sysTime);
char szYear[] = {};
char szMonth[] = {};
char szDate[] = {};
char szDayOfWeek[] = {};
char szHour[] = {};
char szMinute[] = {};
char szSecond[] = {};
char szFullTime[] = {};
sprintf_s(szFullTime, "%s年:%s月:%s日:星期%s:%s时:%s分:%s秒", szYear, szMonth, szDate, szDayOfWeek, szHour, szMinute, szSecond); //szFullTime:2015年:10月:18日:星期0:0时:48分:49秒 }
Windows API 第六篇 GetLocalTime的更多相关文章
- windows API 第22篇 WTSGetActiveConsoleSessionId
函数原型:DWORD WTSGetActiveConsoleSessionId (VOID)先看一下原文介绍: The WTSGetActiveConsoleSessionId function re ...
- windows API 第13篇 MoveFileEx
上一篇介绍了MoveFile,这次分析MoveFileEx,它是MoveFile的扩展函数,功能还要更加强大些.先看定义: BOOL WINAPI MoveFileEx( _In_ LPCTS ...
- Windows API 第三篇
1.获得程序自身的路径: DWORD GetModuleFileName( HMODULE hModule, // handle to module LPTSTR lpFilename, // pat ...
- Windows API 第21篇 DeleteVolumeMountPoint 删除挂载点
函数原型:BOOL DeleteVolumeMountPoint( LPCTSTR lpszV ...
- Windows API 第20篇 SetVolumeMountPoint 设置卷挂载点参数错误
函数原型:BOOL SetVolumeMountPoint( IN LPCTSTR lpszVo ...
- Windows API 第20篇 GetVolumeNameForVolumeMountPoint
函数原型: BOOL GetVolumeNameForVolumeMountPoint( ...
- Windows API 第19篇 FindFirstVolumeMountPoint FindNextVolumeMountPoint
相关函数:HANDLE FindFirstVolumeMountPoint( ...
- windows API 第 18篇 FindFirstVolume FindNextVolume
函数定义:Retrieves the name of a volume on a computer. FindFirstVolume is used to begin scanning the vol ...
- Windows API 第17篇 GetLogicalDriveStrings 获取本机所有逻辑驱动器,以根目录的形式表示
函数原型:DWORD GetLogicalDriveStrings( DWORD nBufferLength, // size of buffer ...
随机推荐
- ES5数组扩展
ES5给数组对象添加了一些方法, 常用的5个: 1. Array.prototype.indexOf(value) : 得到值在数组中的第一个下标 2. Array.prototype.lastInd ...
- leetcood学习笔记-55-跳跃游戏
题目描述: 第一次提交: class Solution: def canJump(self, nums: List[int]) -> bool: if len(nums)<=1: retu ...
- php数据结构课程---7、队列实战
php数据结构课程---7.队列实战 一.总结 一句话总结: 注意条件:注意循环的条件(比如while循环打印队列元素时),注意if的条件 把问题想清楚:比如链表操作初次插入元素和后面再插,效果是不一 ...
- range()函数在python3与python2中的区别
range()函数在python3与python2中的区别 - CSDN博客 https://blog.csdn.net/weixin_37579123/article/details/8098038 ...
- Failed to read artifact descriptor for org.springframework.cloud:spring-cloud-starter-config:jar:unk
<dependencyManagement> <dependencies> <dependency> <groupId>org.springframew ...
- 通过java进行电脑屏幕截图
package image; import java.awt.Desktop; import java.awt.Dimension; import java.awt.Rectangle; import ...
- 19.SimLogin_case02
# 模拟登录马蜂窝 import requests from lxml import etree session = requests.Session() phone_number = input(' ...
- 数据类中引用virtual
public class City { [Key] public int CityID { set; get; } [Display(Name = "城市名称")] [Requir ...
- java_日历类
calendar是日历类,该类是抽象类不能被实例化 public class CalendarTest { /* 创建对象和方法的使用 */ public static void main(Strin ...
- spring基于xml的IOC环境搭建和入门
配置pom.xml的依赖 <packaging>jar</packaging> <dependencies> <dependency> <grou ...