各位高手,我用textout编写了一个函数 如下:#include <stdio.h>
#include <windows.h>
void main()
{
int ret,err;
HWND handle;
HDC hdc;
char *text = "abcdefg"; handle = GetForegroundWindow();
hdc = GetDC(handle); ret = TextOut(hdc, 50, 50, text, strlen(text));
printf("ret=%d\n", ret);
} handle是一个文本文档的窗口句柄。函数返回值为1,说明执行成功了,可是为什么在文本文档中显示不出来text的内容呢?
盼高手指点,急等!!!!
#include <windows.h>
void main()
{
int ret,err;
HWND handle;
HDC hdc;
char *text = "abcdefg"; handle = GetForegroundWindow();
hdc = GetDC(handle); ret = TextOut(hdc, 50, 50, text, strlen(text));
printf("ret=%d\n", ret);
} handle是一个文本文档的窗口句柄。函数返回值为1,说明执行成功了,可是为什么在文本文档中显示不出来text的内容呢?
盼高手指点,急等!!!!
可能你的内容被覆盖了吧
你画的窗口被显示窗口覆盖了,所以看不到。你可以用spy++看一下文本编辑器的句柄
以及 你获得的句柄 打印出来 应该是不一样了。
HINSTANCE hInstance, // handle to current instance
HINSTANCE hPrevInstance, // handle to previous instance
LPSTR lpCmdLine, // command line
int nCmdShow // show state
);