Skocz do zawartości

Recommended Posts

Napisano

1)
uzywaj CreateDialog a nie Dialogbox
2)
nie bardzo wiem o co chodzi
3)

int i = SendMessage(hListBox, LB_GETCOUNT, 0, 0) ;
if (i == LB_ERR)
  return 0 ;
for (int j = 0 ; j < i ; j++)
{
  SendMessage(hListBox, LB_GETTEXT, (WPARAM) j, (LPARAM) bufor) ;
  ZapiszDoPliku(bufor) ;
}
Napisano

Ja zrobiłem coś takiego i działa bez zarzutu:

program Run;

uses
  Windows,Messages;

{$R RES.RES}
var Okno:Hwnd;

FUNCTION Go2(DlgWin:hWnd;DlgMessage : UINT;
                             DlgWParam  : WPARAM;
                             DlgLParam  : LPARAM  ) : BOOL; STDCALL;
BEGIN
 Result:=False;
 If DlgMessage=WM_COMMAND then Begin
  CASE LOWORD( DlgWParam  ) OF
   2:EndDialog(DlgWin,LOWORD(DlgWParam));
   102:SendMessage(Okno,LB_ADDSTRING,0,LONGINT(pchar('sdss')));
  End;
 End;
End;

FUNCTION Go(DlgWin:hWnd;DlgMessage : UINT;
                             DlgWParam  : WPARAM;
                             DlgLParam  : LPARAM  ) : BOOL; STDCALL;
BEGIN
 Result:=False;
 If DlgMessage=WM_INITDIALOG then Begin
  okno:=GetDlgItem(DlgWin,101);
 end;
 If DlgMessage=WM_COMMAND then Begin
  CASE LOWORD( DlgWParam  ) OF
   2:EndDialog(DlgWin,LOWORD(DlgWParam));
   102:DialogBox(Hinstance,'DIALOG_2',DlgWin,@Go2);
  End;
 End;
End;


begin
 DialogBox(Hinstance,'DIALOG_1',0,@Go);
end.

A zasoby wyglądają tak:

DIALOG_1 DIALOG 6, 15, 334, 189
STYLE WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX
CAPTION "DIALOG_1"
FONT 8, "MS Sans Serif"
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
{
 CONTROL "", 101, "LISTBOX", LBS_STANDARD | WS_CHILD | WS_VISIBLE, 13, 20, 295, 111
 CONTROL "OK", 102, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 12, 132, 60, 14
}

DIALOG_2 DIALOG 6, 15, 161, 127
STYLE WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
CAPTION "DIALOG_2"
FONT 8, "MS Sans Serif"
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
{
 CONTROL "OK", 102, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 62, 48, 60, 14
}

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Gość
Odpowiedz...

×   Wkleiłeś zawartość bez formatowania.   Usuń formatowanie

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Utwórz nowe...