下面是两个简单的例子,说明在 windows 控制台应用程序中定时器的用法
1、直接声明回调函数,然后在回调函数中处理消息。
// programe for timer
#include "stdio.h"
#include "conio.h"
#include
int count = 0;
void CALLBACK TimerProc (HWND hwnd, UINT mess...
分类:
编程语言 时间:
2014-12-08 17:49:16
阅读次数:
256
::SetWindowPos(AfxGetMainWnd()->m_hWnd,HWND_TOPMOST,-1,-1,-1,-1,SWP_NOMOVE|SWP_NOSIZE);
分类:
编程语言 时间:
2014-12-08 17:40:00
阅读次数:
211
1. 画线
方法I:使用HDC
HDC hdc;
hdc=::GetDC(m_hWnd);
MoveToEx(hdc,point1.x,point1.y,NULL); //移动到起点
LineTo(hdc,point2.x,point2.y); //画线
::ReleaseDC(m_hWnd,hdc);
方法II:使用CDC
CDC *pdc=GetDC()...
分类:
其他好文 时间:
2014-12-04 20:08:23
阅读次数:
148
//实现拖动1.在窗体类里面加入,下面两个,按提示加入命名空间[DllImport("user32.dll", CharSet = CharSet.Unicode)] public static extern IntPtr SendMessage(IntPtr hwnd, int wM...
场景:
在文本框中打印日志,或向ListCtrl中插入数据时,怎么样可以把滚动条时时滚动到最后一行,这样便可看到添加的新数据内容。
1. 文本框
方法I:
CWnd *pWnd = GetDlgItem(IDC_EDIT1);
HWND g_hLog = pWnd->GetSafeHwnd();
::SendMessage(g_hLog, WM_VSCROLL, MAKEWPA...
分类:
其他好文 时间:
2014-12-02 16:42:26
阅读次数:
199
1.SetWindowLong和GetWindowLong 函数原型: LONG SetWindowLong( __in HWND hWnd, __in int nIndex, __in LONG dwNewLong
); LONG GetWindowLong( __in HWND hWnd, __...
SendMessage函数向窗口发送消息
LRESULT SendMessage(
HWND hWnd, // handle to destination window
UINT Msg, // message
WPARAM wParam, // first message parameter
LPARAM lParam // s...
分类:
Windows程序 时间:
2014-11-26 22:43:44
阅读次数:
1044
procedure TForm1.Button1Click(Sender: TObject);var hEdit: HWND; str: string;begin str := '准备要添加到记事本的字符串'; WinExec('Notepad.exe', SW_SHOWNORMAL); ...
分类:
其他好文 时间:
2014-11-26 06:35:46
阅读次数:
148
'-Api Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) A....
CColorDialog dlg;
dlg.DoModal();
COLORREF m_crCurColor;
m_crCurColor = dlg.GetColor();
CPen m_pen(PS_SOLID,1,m_crCurColor);
HDC hdc = ::GetDC(m_hWnd);
SelectObject(hdc, m_pen);
::MoveToEx(hdc,...
分类:
其他好文 时间:
2014-11-24 15:26:56
阅读次数:
182