See comments below:
On May 27, 2008, at 8:30 PM, bruno duarte wrote:
hi! i'm from brasil. my english is veeery bad!
Better than my Portuguese, I'm sure.
i have a code which list all windows opened:
#include <windows.h>
#include <stdio.h>
int main ()
{
char vetor[50][256];
You don't have to be so complicated in Java. Use an ArrayList, and
add each string to it as you get it, or just use an array of String to
store the results.
int i = 0;
HWND janela = NULL;
janela = GetDesktopWindow();
janela = GetWindow(janela, GW_CHILD);
while(janela != NULL){
if(IsWindowVisible(janela) && !IsIconic(janela)){
SendMessage(janela,WM_GETTEXT,256,(LPARAM)vetor[i]);
You can use byte[256]/char[256] (depending on whether you're calling
the ascii or unicode version) or com.sun.jna.Memory here as the
argument. You will need to use Native.toString() or
Memory.getString(0) after the call to SendMessage to extract the string.
printf("%s\n", vetor[i]);
i++;
}
janela = GetWindow(janela, GW_HWNDNEXT);
}
return 0;
}
how i do for this code return a array of string for my applycation
in java with JNA?
please post examples of code in java and c.
Return one buffer at a time, convert to String, then save the String
to an array of String.