pobieranie textu z editboxa - GetWindowText

0

Witam próbóje pobrać wpisany text z editboxa funkcją GetWindowText jednak, nie zwraca mi ona żadnych danych.

zrobiłem to tak:

//deklaracja
HWND EDIT_IP = CreateWindowEx (WS_EX_CLIENTEDGE, "EDIT", NULL, WS_CHILD | WS_VISIBLE | WS_BORDER , 5, 40, 170, 30, ConnIpWin, NULL, hInstance, NULL);
HWND EDIT_PORT = CreateWindowEx (WS_EX_CLIENTEDGE, "EDIT", NULL, WS_CHILD | WS_VISIBLE | WS_BORDER , 180, 40, 100, 30, ConnIpWin, NULL, hInstance, NULL);

// niżej pobieranie z editboxów

char IP[500];
char PORT[500];

DWORD dlugoscip = GetWindowTextLength (EDIT_IP);
DWORD dlugoscp = GetWindowTextLength (EDIT_PORT);
//LPSTR Bufor = (LPSTR) GlobalAlloc (GPTR, dlugosc + 1);
GetWindowText (EDIT_IP, IP, dlugoscip + 1);
GetWindowText (EDIT_PORT, PORT, dlugoscp + 1);
 

Nie zwraca mi ani danych z boxa, ani długości Textu wpisanego, co zrobiłem źle? albo czy jest inny sposób?

0
MSDN, GetWindowText napisał(a)

. If the window has no title bar or text, if the title bar is empty, or if the window or control handle is invalid, the return value is zero. To get extended error information, call GetLastError.
This function cannot retrieve the text of an edit control in another application.

GetWindowText function
GetLastError function
System Error Codes

1 użytkowników online, w tym zalogowanych: 0, gości: 1