Форум: "WinAPI";
Текущий архив: 2008.04.13;
Скачать: [xml.tar.bz2];
ВнизListbox Найти похожие ветки
← →
Игорь_1 (2007-08-11 11:09) [0]Уважаемые мастера.
Почему Listbox не добавляет записи.
program Con_net;
uses Windows,Messages;
const
Lab = "Идет попытка подключения к серверу ...";
Lab_ = 1000;
Width = 367;
Height = 85;
procedure Connect(Wnd:HWND);
begin
SendMessage(lab_, LB_ADDSTRING, 0, LongInt(PChar("example")));
end;
function WndProc(Wnd : HWND; message : UINT; wParam : Integer; lParam: Integer) : Integer; stdcall;
begin
Result:=0;
case message of
WM_CREATE:
begin
CreateWindowEx (0, "LISTBOX", Lab, ws_Child or ws_Visible or LBS_STANDARD,
56, 5, 300, 40, Wnd, Lab_, hInstance, nil);
end;
WM_DESTROY:
begin
PostQuitMessage(0);
result := 0;
end;
else
result := DefWindowProc(Wnd, message, wParam, lParam);
end;
end;
procedure load;
var
Msg : TMsg;
wndClass : TWndClass;
ax:array[0..1] of word;
dwh:THandle;
wRect:TRect;
hWnd2:THandle;
begin
DWH := GetDesktopWindow;
GetWindowRect(DWH, wRect);
ax[0]:=abs(wRect.Right-wRect.Left);
ax[1]:=abs(wRect.Bottom-wRect.Top);
wndClass.style := CS_HREDRAW or CS_VREDRAW;
wndClass.lpfnWndProc := @WndProc;
wndClass.cbClsExtra := 0;
wndClass.cbWndExtra := 0;
wndClass.hInstance := hInstance;
wndClass.hIcon := LoadIcon(0, IDI_APPLICATION);
wndClass.hCursor := LoadCursor(0, IDC_ARROW);
wndClass.hbrBackground := COLOR_BTNFACE+1;
wndClass.lpszMenuName := nil;
wndClass.lpszClassName := "NetConnect";
RegisterClass(wndClass);
hWnd2 := CreateWindow(
"NetConnect",
lab,
WS_overlapped or ws_sysmenu,//WS_SYSMENU or WS_Caption or WS_Border, // window style
(ax[0] - Width) div 2, (ax[1]-Height) div 2, WIDTH, HEIGHT,
0, // parent window handle
0, // window menu handle
hInstance, // program instance handle
nil); // creation parameters
if hWnd2 = 0 then
MessageBox (0, "Window not created",
"lab", MB_OK)
else
begin
ShowWindow (hWnd2, sw_ShowNormal);
Connect(hWnd2);
end;
while(GetMessage(msg, 0, 0, 0)) do
begin
TranslateMessage(msg);
DispatchMessage(msg);
end;
end;
begin
load;
end.
← →
Lacmus © (2007-08-11 11:16) [1]
lab_ := CreateWindowEx (0, "LISTBOX", Lab, ws_Child or ws_Visible or LBS_STANDARD,
56, 5, 300, 40, Wnd, Lab_, hInstance, nil);
Страницы: 1 вся ветка
Форум: "WinAPI";
Текущий архив: 2008.04.13;
Скачать: [xml.tar.bz2];
Память: 0.45 MB
Время: 0.006 c