Форум: "WinAPI";
Текущий архив: 2002.04.04;
Скачать: [xml.tar.bz2];
ВнизРешил изучить API, надеюсь на Вашу помощь! Найти похожие ветки
← →
АПИ (2002-02-03 15:41) [0]Дайте примерчик, как написать свою форму, для начала! Хочу сделать форму, а не использовать имеющиюся!
Заранее спасибо!
← →
Иван Шихалев (2002-02-03 15:43) [1]
RegisterClassEx,
CreateWindowEx
← →
Ghost. (2002-02-03 17:05) [2]program editctrl;
uses windows, messages;
const editID = 10;
var wc : TWndClassEx;
MainWnd : HWND;
Mesg : TMsg;
Edit : HWND;
function WindowProc(wnd:HWND; Msg : Integer; Wparam:Wparam; Lparam:Lparam):Lresult; stdcall;
var p : PChar;
n : integer;
Begin
case msg of
wm_destroy :
Begin
postquitmessage(0); exit;
Result:=0;
End;
wm_setfocus : SetFocus(edit);
wm_command :
Begin
case loWord(wParam) of
editID :
case hiWord(wParam) of
en_change : begin
n:=GetWindowTextLength(lParam);
GetMem(p,n+1);
GetWindowText(lParam,p,n+1);
SetWindowText(wnd,p);
FreeMem(p,n+1);
end;
end;
end;
End;
else Result:=DefWindowProc(wnd,msg,wparam,lparam);
end;
End;
var xPos,yPos,nWidth,nHeight : Integer;
begin
wc.cbSize:=sizeof(wc);
wc.style:=cs_hredraw or cs_vredraw;
wc.lpfnWndProc:=@WindowProc;
wc.cbClsExtra:=0;
wc.cbWndExtra:=0;
wc.hInstance:=HInstance;
wc.hIcon:=LoadIcon(0,idi_application);
wc.hCursor:=LoadCursor(0,idc_arrow);
wc.hbrBackground:=COLOR_BTNFACE+1;
wc.lpszMenuName:=nil;
wc.lpszClassName:="edit window";
RegisterClassEx(wc);
xPos:=100;
yPos:=150;
nWidth:=400;
nHeight:=250;
MainWnd:=CreateWindowEx(0,"edit window",
"Пример поля ввода. Введенный текст немедленно отображается в заголовке окна",
ws_overlappedwindow,
xPos,yPos,nWidth,nHeight,0,0,
Hinstance,nil);
Edit:=CreateWindowEx(ws_ex_clientedge,"edit","",es_autohscroll or ws_child or ws_visible,10,10,320,20,mainWnd,editID,hInstance,nil);
SendMessage(Edit,wm_setfont,GetStockObject(ansi_var_font),0);
ShowWindow(MainWnd,CmdShow);
While GetMessage(Mesg,0,0,0) do
begin
TranslateMessage(Mesg);
DispatchMessage(Mesg);
end;
end.
← →
АПИ (2002-02-04 09:35) [3]>Ghost. ©
Большое Спасибо!
← →
VuDZ (2002-02-05 03:30) [4]HWND hwnd = CreateWindow("EDIT", "Hello,\r\nWorld!",
WS_POPUPWINDOW|ES_MULTILINE|WS_VISIBLE,
0, 0, 200, 200, NULL, NULL, GetModuleHandle(NULL), NULL);
ShowWindow(hwnd, SW_SHOW);
UpdateWindow(hwnd);
MSG msg;
while(IsWindow(hwnd) && GetMessage(&msg, NULL, 0, 0) == TRUE)
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
и всё... :shuffle:
Страницы: 1 вся ветка
Форум: "WinAPI";
Текущий архив: 2002.04.04;
Скачать: [xml.tar.bz2];
Память: 0.45 MB
Время: 0.005 c