我假设,我问的实际上应该是默认值,但我遇到了一些我不理解的行为.
#include "stdafx.h"
using namespace std;
BOOL CALLBACK enumWindowsProc(
__in HWND hWnd,
__in LPARAM lParam
) {
if( !::IsIconic( hWnd ) ) {
return TRUE;
}
int length = ::GetWindowTextLength( hWnd );
if( 0 == length ) return TRUE;
TCHAR* buffer;
buffer = new TCHAR[ length + 1 ];
memset( buffer, 0, ( length + 1 ) * sizeof( TCHAR ) );
GetWindowText( hWnd, buffer, length + 1 );
tstring windowTitle = tstring( buffer );
delete[] buffer;
wcout << hWnd …Run Code Online (Sandbox Code Playgroud) 如果我不首先使用 WM_SETICON 来设置图标,那么 WM_GETICON 总是返回 0。这很奇怪。请帮忙。
这是我的代码,可以复制粘贴到暂存器并运行。
当执行SendMessage(targetWindow_handle, WM_GETICON , ICON_SMALL, ctypes.voidptr_t(0)), hIconSmall_origandhIconBig_orig时总是返回 0 我不知道为什么。如果您首先在窗口上使用 WM_SETICON,那么它会正确获取 HICON,但整个目的是获取默认图标。
Cu.import('resource://gre/modules/ctypes.jsm');
var user32 = ctypes.open('user32.dll');
/* http://msdn.microsoft.com/en-us/library/windows/desktop/ms644950%28v=vs.85%29.aspx
* LRESULT WINAPI SendMessage(
* __in HWND hWnd,
* __in UINT Msg,
* __in WPARAM wParam,
* __in LPARAM lParam
* );
*/
var SendMessage = user32.declare('SendMessageW', ctypes.winapi_abi, ctypes.uintptr_t,
ctypes.voidptr_t,
ctypes.unsigned_int,
ctypes.int32_t,
ctypes.voidptr_t
);
var WM_GETICON = 0x007F;
var WM_SETICON = 0x0080;
var ICON_SMALL = 0;
var ICON_BIG = 1;
var …Run Code Online (Sandbox Code Playgroud)