帮帮忙,这个函数应该怎么写?
我想在C++中写一个回调函数,在Delphi中的代码是这样的:
{$IFDEF USEMDI}
hld := FindWindowEx(0, 0, nil, PChar(njtwcaption));
if hld <> 0 then
EnumChildWindows(hld, @EnumChildWindowsProc, 3004);
{$ELSE}
hld:=FindWindow(nil,Pchar(njtwcaption));
PostMessage(hld,3004,0,0);
{$ENDIF}
function EnumChildWindowsProc(hwnd: Integer; lparam: Longint): Boolean; stdcall;
const
ClassName = 'TNJTWMAINFM40';
var
buffer: array[0..255] of Char;
ResultCh: Integer;
begin
Result := True;
GetClassName(hwnd, buffer, 256);
if buffer = ClassName then
begin
PostMessage(hwnd,lparam,0,0);
end;
end;
现在要转到C++里面,EnumChildWindowsProc这个函数应该怎么定义,怎么写?
#ifdef MDI_USED
HWND h1=::FindWindowEx(0, 0, NULL, njtwcaption);
::EnumChildWindows(h1, EnumChildWindowsProc, WM_RELOADBMPLISTMSG);
#else
HWND h1=::FindWindow(NULL, njtwcaption);
::PostMessage(h1,WM_RELOADBMPLISTMSG,0,0);
#endif