谁能帮我翻译这样一段程序(c++ to delphi) (75分)

  • 主题发起人 主题发起人 base3
  • 开始时间 开始时间
B

base3

Unregistered / Unconfirmed
GUEST, unregistred user!
应该很容易的,可惜我不会:(
是用来使桌面图标的文字透明化的
#include <windows.h>
#include <commctrl.h>
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
HWND hwnd = FindWindow("Progman", "Program Manager");
if ( hwnd != NULL )
{
hwnd = FindWindowEx(hwnd, NULL, "SHELLDLL_DefView", "");
if ( hwnd != NULL )
{
hwnd = FindWindowEx(hwnd, NULL, "SysListView32", "");
if ( hwnd != NULL )
{
if ( ListView_GetTextBkColor(hwnd) != CLR_NONE )
{
ListView_SetTextBkColor(hwnd, CLR_NONE);
}
else
{
ListView_SetTextBkColor(hwnd, GetSysColor(COLOR_DESKTOP));
}
InvalidateRect(hwnd, NULL, TRUE);
UpdateWindow(hwnd);
}
}
}
return 0;
}
 
procedure ToggleIconTransparency;
var
wnd:HWND;
begin
Wnd := GetDesktopWindow;
Wnd := FindWindowEx(Wnd, 0, 'Progman', nil);
Wnd := FindWindowEx(Wnd, 0, 'SHELLDLL_DefView', nil);
Wnd := FindWindowEx(Wnd, 0, 'SysListView32', nil);
if ( ListView_GetTextBkColor(wnd) <> CLR_NONE ) then
ListView_SetTextBkColor(wnd, CLR_NONE)
else
ListView_SetTextBkColor(wnd, GetSysColor(COLOR_DESKTOP));
InvalidateRect(Wnd, nil, TRUE);
UpdateWindow(wnd);
end;
 
忘记写了: use commctrl;
 
接受答案了.
 
后退
顶部