本文介绍了如何打印格式字符串到窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一个窗口句柄 HWND hwnd 已经可用,现在我想打印一个格式字符串
到这个 hwnd 。我不太熟悉Windows API,非常感谢您的帮助。

A window handle HWND hwnd has already been available, now I want to print a format string into a window described by this hwnd. I am not familiar with Windows API, Thanks very much for your help.

例如:

num = 23;
printFunction(hwnd, "number is %d", num);

有没有功能来解决这个问题?谢谢!

Is there a function to solve this problem? Thank you!

UPDATE :在使用IDA Pro SDK时遇到此问题。

UPDATE: I encounter this problem during using IDA Pro SDK.

创建以下示例子窗口:

HWND hwnd = NULL;
TForm *form = create_tform("Sample subwindow", &hwnd);

我使用 SendMessage(hwnd,WM_SETTEXT,NULL,(LPARAM)hello世界); 在子窗口中打印 hello world 字符串,但是如果我想打印格式字符串到这个子窗口, / p>

I use SendMessage(hwnd, WM_SETTEXT, NULL, (LPARAM)"hello world"); to print hello world string in the subwindow, but what should I do if I want to print format string into this subwindow?

推荐答案

sprintf(myString, "number is %d", num);
SendMessage(hwnd, WM_SETTEXT, NULL, (LPARAM)myString);

这篇关于如何打印格式字符串到窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 17:47