Results 1 to 12 of 12

Thread: Which is better to start with?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2001
    Location
    Netherlands
    Posts
    115

    Which is better to start with?

    Which is bettor to start with? MFC or everything with API?

    VisualPenguin
    ICQ :137108715
    MSN Messenger : [email protected]

  2. #2
    Fanatic Member
    Join Date
    Sep 2000
    Location
    UK.
    Posts
    728

    Smile

    I would say API.
    Digital-X-Treme
    Contact me on MSN Messenger: [email protected]

    [VBCODE]Debug.Print Round(((1097) - ((55 ^ 5 + 311 ^ 3 - 11 ^ 3) _
    / (68 ^ 5))) ^ (1 / 7), 13)[/VBCODE]

  3. #3
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Definitely API, and everyone here will agree (well, almost everyone). You can later learn MFC too, if you really understand what's going on. You can make apps far quicker, but if you don't know it well you might get really lost. MFC is an advantage at a prize. (z or c?)
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  4. #4
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    I got flamed once on a non-programming forum for suggesting to someone who wanted to learn Windows programming that the API is better than MFC...
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  5. #5
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    CB - price

    Josh - ack, everyone knows API is better *smirk* Silly fools
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  6. #6
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    API is functional and quite lowlevel, me and parksie decided to make an object oriented layer to it, but I'm too busy writing my own language right now the classes for the layer will then be compiled in BORK to a set of generic C++ classes that will be upwards compatible with BORK modules. By then you can choose to write your win32 application in C++ or BORK using the generated layer, and it will highly efficient compared to MFC
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  7. #7
    Hyperactive Member made_of_asp's Avatar
    Join Date
    Jul 2001
    Location
    123 Fake Street
    Posts
    394
    API = speed, control, runtimeless, you ONLY use what u want to, say you are using API functions

    EnumWindows
    CreateFont
    CreateWindow
    ReturnDlgProc

    ...or whatever

    you WILL be realy using ONLY those API's, nothing more

    MFC = easiness OR a bit of confustion, mess, +size, -control, runtimes DLL files
    VS.NET 2003

    Need to email me?

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Oct 2001
    Location
    Netherlands
    Posts
    115
    can anybody then give me a realy simple program? with just the basic needs like one dialog, so I can find out how to make it myself?

    VisualPenguin
    ICQ :137108715
    MSN Messenger : [email protected]

  9. #9
    Hyperactive Member made_of_asp's Avatar
    Join Date
    Jul 2001
    Location
    123 Fake Street
    Posts
    394
    Visual C++

    Code:
    #include <windows.h>
    
    LRESULT CALLBACK WindowFunc(HWND, UINT, WPARAM, LPARAM); 
    
    char szWinNamw[] = "MyWin"; 
    
     
    
    int WINAPI WinMain(HINSTANCE hThisInst, HINSTANCE hPrevInst, LPSTR kposzArgs, int nWinMode) 
    
    { 
    
    HWND hwnd; 
    
    MSG msg; 
    
    WNDCLASSEX wcl; 
    
    wcl.cbSize = sizeof(WNDCLASSEX); 
    
    wcl.hInstance = hThisInst; 
    
    wcl.lpszClassName = "My Window"; 
    
    wcl.lpfnWndProc = WindowFunc; 
    
    wcl.style = 0; 
    
    wcl.hIcon = LoadIcon(NULL, IDI_APPLICATION); 
    
    wcl.hIconSm = LoadIcon(NULL, IDI_WINLOGO); 
    
    wcl.hCursor = LoadCursor(NULL, IDC_ARROW); 
    
    wcl.lpszMenuName = NULL; 
    
    wcl.cbClsExtra = 0; 
    
    wcl.cbWndExtra = 0; 
    
    wcl.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
    
     
    
    if(!RegisterClassEx(&wcl)) return 0; 
    
     
    
    hwnd = CreateWindow( "My Window", 
    
    "Skeleton Window", 
    
    WS_OVERLAPPEDWINDOW, 
    
    CW_USEDEFAULT, 
    
    CW_USEDEFAULT, 
    
    CW_USEDEFAULT, 
    
    CW_USEDEFAULT, 
    
    HWND_DESKTOP, 
    
    NULL, 
    
    hThisInst, 
    
    NULL ); 
    
    ShowWindow(hwnd, nWinMode); 
    
    UpdateWindow(hwnd); 
    
     
    
    int i; 
    
    while(i = GetMessage(&msg, NULL, 0, 0)) 
    
    { if (i == -1) break; 
    
        TranslateMessage(&msg); 
    
        DispatchMessage(&msg); 
    
    }
    
    return msg.wParam; } 
    
     
    
    LRESULT CALLBACK WindowFunc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) 
    
    { 
    
        switch(message) 
    
        { 
    
            case WM_DESTROY: 
    
            PostQuitMessage(0); 
    
        break; 
    
        default: 
    
            return DefWindowProc(hwnd, message, wParam, lParam); 
    
    } 
    
    return 0;
    
     }
    VS.NET 2003

    Need to email me?

  10. #10
    Zaei
    Guest
    Why did you double space that? It makes it look twice as long =).

    You should also be handling WM_PAINT:
    Code:
    LRESULT CALLBACK WindowFunc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) 
    { 
        switch(message) 
        { 
         case WM_DESTROY: 
            PostQuitMessage(0); 
            break; 
         case WM_PAINT:
            ValidateRect(hwnd, NULL);
            break;
         default: 
            return DefWindowProc(hwnd, message, wParam, lParam); 
         } 
    return 0;
    }
    Otherwise, the window will continue to get WM_PAINT messages.

    Z.

  11. #11
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    I thought DefWindowProc would handle that.

    Glad to see that it's got the check for -1 in there
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  12. #12
    Zaei
    Guest
    You dont have to ValidateRect, but you do have to return 0. GetMessage will leave WM_PAINT in the queue until there arent any more messages (i think that's what the docs said). I found this info under the GetMessage() docs, the WM_PAINT message docs and the "Designing a Window Procedure" topic, in the MSDN.

    Z.

Posting Permissions

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



Click Here to Expand Forum to Full Width