以下是为您整理出来关于【windows程序设计】合集内容,如果觉得还不错,请帮忙转发推荐。
获取系统文件路径,打印到txt文件中。#include <windows.h>int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow) {//文件句柄 HANDLE hFile;DWORD dwWritten;//字符数组,用于存储系统目录 CHAR szSystemDir[MAX_PATH];//获取系统目录 GetSystemDirectoryA(szSystemDir, MAX_PATH);//创建文件systemroot.txthFile = CreateFileA("systemroot.txt",GENERIC_WRITE,0, NULL, CREA...
在看雪论坛上看到的一个帖子,很喜欢,转载一下。原文地址:http://bbs.pediy.com/showthread.php?t=138630哆啦A梦是画出来的,不知道作者算这些坐标位置算了多久,真的很犀利。记得原来看《Windows程序设计》的时候,每次看到GDI都不是很理解,也没有仔细去研究。现在编程也很少与GDI打交道,还是等以后有空了在深入了解一下吧。把这个代码转载一份到博客,以后再回头研究一下。顺便贴一下程序运行后的截图:(很酷吧~~~)字数补丁...
看Windows程序有段时间了,终于动手写东西。贪吃蛇算是一个开始吧,下面的贪吃蛇很简单,也有很多地方需要修改,还有情况没有考虑QAQ 但这不是我的目的了。。。思路很简单:建个链表储存蛇身节点即可。#include <windows.h> #include <time.h>#define ID_TIMER 1 #define TIMERSET 600 char score,temp=0; int flag,tempx,tempy,foodx,foody,key;//运动方向,食物坐标,标记bool havebody[50][50]; bool ...
代码如下:program Project2;{$APPTYPE CONSOLE}{$R *.res}usesSystem.SysUtils,windows,Winapi.Messages,Vcl.Dialogs;typePoint = recordx: Integer;y: Integer;end;varswndClass: tagWNDCLASS;message: MSG;mHwnd: hwnd;cxClient, cyClient: Integer;function WindowProc(hwnd: hwnd; uMsg: UINT; wParam: wParam; lParam: lParam): LRESULT; stdcall; vari: integer;uhdc: HDC;ps: PAINTSTRUCT; begincase uMsg ofWM_CREATE:beg...
代码如下:program Project2;{$APPTYPE CONSOLE}{$R *.res}usesSystem.SysUtils,windows,Winapi.Messages,Vcl.Dialogs;typePoint = recordx: Integer;y: Integer;end;varswndClass: tagWNDCLASS;message: MSG;mHwnd: hwnd;cxClient, cyClient: Integer;function WindowProc(hwnd: hwnd; uMsg: UINT; wParam: wParam; lParam: lParam): LRESULT; stdcall; vari: integer;uhdc: HDC;ps: PAINTSTRUCT; begincase uMsg ofWM_CREATE:beg...
代码如下:program Project2;{$APPTYPE CONSOLE}{$R *.res}usesSystem.SysUtils,windows,Winapi.Messages,Vcl.Dialogs;typePoint = recordx: Integer;y: Integer;end;varswndClass: tagWNDCLASS;message: MSG;mHwnd: hwnd;cxClient, cyClient: Integer;function WindowProc(hwnd: hwnd; uMsg: UINT; wParam: wParam; lParam: lParam): LRESULT; stdcall; vari: integer;uhdc: HDC;ps: PAINTSTRUCT;begincase uMsg ofWM_CREATE:begi...
更改搞效的滚动条 program Project2;{$APPTYPE CONSOLE}{$R *.res}usesSystem.SysUtils,windows,Winapi.Messages,Vcl.Dialogs;varswndClass: tagWNDCLASS;message: MSG;mHwnd: hwnd;cxChar, cyChar: Integer;cxClient, cyClient: Integer;ScrollPos: Integer = 0;function WindowProc(hwnd: hwnd; uMsg: UINT; wParam: wParam; lParam: lParam): LRESULT; stdcall; vari: integer;uHdc: HDC;ps: tagPAINTSTRUCT;tm: tagTEXTMETRIC;...
代码如下:program Project2;{$APPTYPE CONSOLE}{$R *.res}usesSystem.SysUtils,windows,Winapi.Messages,Vcl.Dialogs;varswndClass: tagWNDCLASS;message: MSG;mHwnd: hwnd;cxClient, cyClient: Integer;function WindowProc(hwnd: hwnd; uMsg: UINT; wParam: wParam; lParam: lParam): LRESULT; stdcall; varuHdc: HDC;ps: tagPAINTSTRUCT;str: string; begincase uMsg ofWM_CREATE:begin{获取窗口尺寸}cxclient := GetSystemMet...
代码如下:program Project2;{$APPTYPE CONSOLE}{$R *.res}usesSystem.SysUtils,windows,Winapi.Messages,Vcl.Dialogs;varswndClass: tagWNDCLASS;message: MSG;mHwnd: hwnd;cxChar, cyChar: Integer;function WindowProc(hwnd: hwnd; uMsg: UINT; wParam: wParam; lParam: lParam): LRESULT; stdcall; varuHdc: HDC;ps: tagPAINTSTRUCT;tm: tagTEXTMETRIC; begincase uMsg ofWM_CREATE:begin{获取文本尺寸}uHdc := GetDC(hwnd);Ge...
我的显示器分辨率/*---------------------------------------------------------------------------scrsize.c -- 显示屏幕大小----------------------------------------------------------------------------*/#include <windows.h>int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow){TCHAR str[1024];int cxScreen, cyScreen;cxScreen = GetSystemMetrics(SM_CXSCREEN);//获取显...