Page 2 of 2 FirstFirst 12
Results 11 to 20 of 20

Thread: school project problems

  1. #11

    school project problems

    There should be at least 2 versions of DrawDialog one for Ansi strings and one for WideStrings. Have a look at which one FPC's DrawDialog is pointing to. It should be either DialogBoxA() or DialogBoxW().
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

  2. #12

    school project problems

    i tried them both and neither of them seem to work. it displays the same error



    edit: i use the compiler set to default.. when i change the compiler to the latest version of FPC i get an error at msg:MSG :?
    one man is smart, humankind is dumb

  3. #13

    school project problems

    i need help pls....


    DialogBox doesn't works... so.. i need help at creating a new window inside my application sa i can input something.... pls help me
    one man is smart, humankind is dumb

  4. #14

    school project problems

    SuperBoy, the posted error's strange indeed.. Not DialogBox's fault though
    Umm.. anyway. I've just hacked a simple app, which creates a modal dialog as its main window. It might give you some ideas about what you could be doing wrong, or you can use it as a starting point . Here it is:
    example.pas:
    [pascal]program example;

    {$APPTYPE GUI}
    {$R '*.res'}

    uses
    Windows,
    Messages;

    const
    MainDlg = 1000;
    IDC_TEXT = 1001;
    IDC_BUTTON = 1002;

    var
    //----- Window vars -----
    hInst,
    hWindow: HWND;

    Buffer: array[0..100] of char;

    function DlgWindowProc(hWnd,Msg: LongWord; wParam,lParam:Longint):LongInt; stdcall;
    begin
    case Msg of
    WM_CLOSE:
    begin
    PostQuitMessage (0);
    end;
    WM_COMMAND:
    begin
    case LoWord(wParam) of
    IDC_BUTTON:
    begin
    Buffer[0] := #0;
    GetDlgItemText(hWnd, IDC_TEXT, Buffer, 100);
    MessageBox(hWindow, Buffer, 'Wazzat', MB_OK or MB_ICONINFORMATION);
    end;
    end;
    end;
    else
    Result := 0;//false
    Exit;
    end;
    Result := 1;//true
    end;

    //----- WinMain --------
    begin

    hInst := GetModuleHandle(nil);

    hWindow := DialogBox (hInst, MAKEINTRESOURCE (MainDlg), 0, @DlgWindowProc);

    end.[/pascal]
    example.rc:
    Code:
    #define MAINDLG 1000
    #define IDC_TEXT 1001
    #define IDC_BUTTON 1002
    
    MAINDLG DIALOG 11, 32, 206, 62
    STYLE WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU |
    WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX
    CAPTION "example"
    FONT 8, "MS Sans Serif"
    BEGIN
      EDITTEXT         IDC_TEXT,   15,17,111,13, ES_AUTOHSCROLL | ES_LEFT 
      DEFPUSHBUTTON    "Do Work", IDC_BUTTON, 141,17,52,13
    END
    Hope this helps
    Fragle

    P.S.: is it me, or do resources not get built automatically by fpc (its default ide - Rhino(?) to be more precise) when compiling an application? Did i forget some option or something? Now it just fails with linker error unless i build the resources myself... Downloaded FPC just an hour ago, so i might be missing something obvious ops:. Thanks in advance for any hints on that!

  5. #15

    school project problems

    you have to build them manually. i use GORC

    you can get it here: http://www.GoDevTool.com.


    i have trouble compiling your code though... it sais: can't find unit MESSAGES :?


    edit: that is the error from Dev-Pascal.. in FPC it works
    edit2: i deleted the call for MESSAGES and works in Dev-Pascal also now
    one man is smart, humankind is dumb

  6. #16

    school project problems

    how can i erase every thing i already drawed?

    edit: i found out :?


    next: how can i input a matrix for a graph


    edit: i figured it out... now i want to know how to use the LISTBOX control pls
    one man is smart, humankind is dumb

  7. #17
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    school project problems

    Superboy, I'm gonna recommend a book for you.

    I got this years ago and it was an excellent reference when I was first making Windows Applications under Delphi.

    'Delphi 3 SuperBible' by Paul Thurrott, Gary Brent, Richard Bagdazian & Steve Tendon -- Waite Group Press (ISBN 1-57169-027-1)

    Now, I'm VERY sure that there is a newer version of this book. Possibly a 'Delphi SuperBible', but in any case this this is packed with the entire VCL as of Delphi 3, including every property, mehtod and onevent handler for every object.

    It sold for $54.99 USD back in 1997... you might be able to get a used copy for less now.

    Another one that might help is 'Mastering Delphi 7' or a whole bunch of others... Besicailly you want a reference to the VCL object model.
    Jason McMillen
    Pascal Game Development
    Co-Founder





  8. #18

    school project problems

    can someone help me pls with a basic application that has a dialog box with a listbox in it pls
    one man is smart, humankind is dumb

  9. #19

    school project problems

    WILL, but.. but... but he's working with win32 api... in freepascal :shock: Umm.. shutting up. You weren't writting to me afterall

    Superboy, a listbox is nothing more than another control, so you just create a resource, pump out the messages and windows does the rest. Here's another example (just posting the differences from an earlier one):

    example.pas
    [pascal]program example;
    ...
    const
    ...
    IDC_LISTBOX = 1003;
    ...

    case Msg of
    WM_CLOSE:
    begin
    EndDialog(hWnd, 0); //Messed up last time. That's the supposed way of closing dialogs
    end;
    WM_COMMAND:
    begin
    case LoWord(wParam) of
    IDC_BUTTON:
    begin
    Buffer[0] := #0;
    GetDlgItemText(hWnd, IDC_TEXT, Buffer, 100);
    SetDlgItemText(hWnd, IDC_TEXT, nil);
    SendMessage(GetDlgItem(hWnd, IDC_LISTBOX), LB_ADDSTRING, 0, LongInt(@Buffer));
    end;
    end;
    end;
    ...[/pascal]
    example.rc
    Code:
    #define IDC_LISTBOX 1003
    ...
    LISTBOX IDC_LISTBOX, 15, 35, 111, 100, WS_VSCROLL
    ...
    Tadaa!

    Btw, SuperBoy, you might wanna check out one site (there). It covers the basics of working with win32 api in delphi, so you might find some questions answered in it already

    Bye,
    fragle

  10. #20

    school project problems

    how can i change the color of the pen?

    i tried setdcpencolor but it is not recognized :?
    one man is smart, humankind is dumb

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •