hi all,
I want to be able to call perl from c (eg Win32::GuiTest::FindWindowLike) and get this working.....basically capturing hwnd handles of open windows and printing them.
thanks in advance,
regards,
Jeremy A.
my code is below. -------------------------------------------------------------------------------------------- use Win32::GuiTest qw/FindWindowLike GetWindowText ShowWindow/; use Inline C;
sub FWL { my ($zero,$class,$subclass); return FindWindowLike($zero,$class,$subclass);
}
set_callback("$main::FWL");
this_test();
__DATA__ __C__
#include <stdio.h> #include <windows.h>
static char* callback; int isWindowOpenedHistory; int hwnd; int elements; int ec;
void set_callback(char* name) { callback = name; }
void this_test() { while(1) { isWindowOpenedHistory = malloc(5 * sizeof(&isWindowOpenedHistory)); hwnd = malloc(5 * sizeof(&hwnd)); inline_stack_vars; Inline_Stack_Reset; Inline_Stack_Push(newI32(0)); Inline_Stack_Push(newSVpvf("Internet Explorer")); Inline_Stack_Push(newSVpvf("")); Inline_Stack_Done; perl_call_pv(callback, 0); Inline_Stack_Return(&hwnd); elements = sizeof(*hwnd)/sizeof(int); for(ec = 0;ec < elements;ec++) { printf("handle %d\n",hwnd[ec]); } Sleep(1); printf("test\n"); free(isWindowOpenedHistory); }
}