제가 델파이와 카일릭스로는 다 테스트해봤는데 잘되네요..
빌더에서는 저도 똑같은 에러가 발생하네요...
빌더 clx 에 대한 자료가 있나 찾아봐도 도저히 자료를 찾을 수가 없네요..
질문을 한번 빌더 Q&A로 함 올려보시기 바랍니다..
카일릭스 사용하신분들은 아직 여기까지 접근해보신분들이 별로없을거에요..
아직 kylix3가 나오기 전이어서...
그럼...
김백일 님이 쓰신 글 :
: Kylix Tip'N Trick 10번에 이갑연님이 올리신 글의
:
http://www.borlandforum.com/impboard/impboard.dll?action=read&db=kylix_tip&no=10
: 링크를 보고
:
http://community.borland.com/article/0,1410,27231,00.html
: C++Builder 6에서 가능할 것 같아 해봤는데,
: 컴파일까지 잘 되지만, 실행시키면 런타임 에러(Stack Overflow)가 나네요.
:
: 원문에 있는 Kylix/Delphi 소스는 다음과 같고요,
:
: Program Project1;
:
: uses
: Qt,
: QForms,
: SysUtils;
:
: var
: App : QApplicationH; // QApplication handle
: MainWnd : QWidgetH; // Main window
: Button : QWidgetH; // Button handle
: MainForm : TForm; // Main application form
: Caption : WideString;
:
: begin
: // initializes application and stores handle in App
: Application.Initialize;
: App := Application.Handle;
:
: // creates main window
: MainForm := TForm.Create(nil);
: Caption := 'Minimum CLX Application';
: MainWnd := MainForm.Handle;
:
: // set window caption and size
: QWidget_setCaption(MainWnd,@Caption);
: QWidget_setGeometry(MainWnd, 100,100,200,100);
:
: // creates the button
: Caption := 'Close App';
: Button := QPushButton_create(@Caption, MainWnd, PChar('Button'));
:
: // sets button size
: QWidget_setGeometry(Button,20,20,160,160);
:
: // sets application main widget
: QApplication_setMainWidget(App,MainWnd);
:
: // shows widget and enters application loop
: QWidget_show(MainWnd);
: QApplication_exec(App);
: end.
:
: 제가 빌더6용으로 변환한 소스는 다음과 같습니다.
: 물론 Console Wizard에서 [Use CLX] 만 선택하고 [Console Application]은 선택하지 않았습니다.
:
: #include <clx.h>
: #include <QForms.hpp>
:
: WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
: {
: // initializes application and stores handle in App
: Application->Initialize();
: QApplicationH *App = Application->Handle;
:
: // creates main window
: TForm *MainForm = new TForm(Application);
: WideString *MainWndCaption = new WideString("Minimum CLX Application");
: QWidgetH *MainWnd = MainForm->Handle;
:
: // set window caption and size
: QWidget_setCaption(MainWnd, MainWndCaption); // 여기서 Stack Overflow가 납니다.
: QWidget_setGeometry(MainWnd, 100, 100, 200, 100);
:
: // creates the button
: WideString *ButtonCaption = new WideString("Close App");
: QWidgetH *Button =
: QPushButton_create(ButtonCaption, MainWnd, "Button");
:
: // sets button size
: QWidget_setGeometry(Button, 20, 20, 160, 160);
:
: // sets application main widget
: QApplication_setMainWidget(App, MainWnd);
:
: // shows widget and enters application loop
: QWidget_show(MainWnd);
: QApplication_exec(App);
:
: delete MainForm;
: delete MainWndCaption; delete ButtonCaption;
:
: return 0;
: }
:
: 도데체 어디에 문제가 있는걸까요?