Results 1 to 22 of 22

Thread: Sick and Tired of not knowing it......

  1. #1
    Guest

    Angry

    I want to write a pure runtime-free C++ program, that is small...

    I dont want to use static(compiled as library) or dynamic(dll) MFC,
    I want to learn how to create windows, get there hwnd, set there caption, set there position, etc in PURE C++(well of course it will be using API's )
    and I want to learn how to make all of it, like Edit Boxes, Buttons, Dialogs, and Timers,
    lets say I wanted to keep checked for keypress using GetAsyncKeyState, what would I do?
    would I use a Do...Loop??


    and I dont know how to do this,
    say I just wanted a small app, perhaps a 40kb app in VB, with the MFC compiled static that would be about 2MB, with the dll, well it has a dll, and that sucks.


    BTW how do you subclass in C++?
    is it the same as the VB API way?
    if so than how come it is so much harder to do it in VB than C++??


    thanks for your help... thanks A LOT

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    In VB, subclassing is usually performed to get at messages VB doesn't already catch. In C++, you can catch whatever message you like. I'll send you a small example in a bit (it's a class to encapsulate all the window-creation crap, without using MFC). That is, once I've worked it out...

    Seriously, though, the Platform SDK is incredibly helpful, and I would suggest you download it...it's in small pieces.
    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

  3. #3
    Guest
    The full/complete PSDK is around 500MB.

  4. #4
    Guest
    well I guess I wont be getting the platform SDK until I get $10 to send for the CD or DSL.....

  5. #5
    Guest
    thanks parksie!


    In VB, subclassing is usually performed to get at messages VB doesn't already catch. In C++, you can catch whatever message you like.

    so using the same method(setwindowlong, getwindowlong, etc) you can subclass?
    but anywindow rather than only your own?

  6. #6
    Guest
    C++ (if I'm not mistaken) uses external libraries. If you were to use a DLL you could do it in VB as well.

  7. #7
    Guest
    OK,
    if C++ uses external library's *** language do you write those in????

  8. #8
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    C++. *laughs*

    They're all in C/C++, although a few deep kernel bits are probably in asm.
    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

  9. #9
    Fanatic Member
    Join Date
    Apr 2000
    Location
    Whats a location?
    Posts
    516
    Originally posted by denniswrenn
    I want to write a pure runtime-free C++ program, that is small...

    I dont want to use static(compiled as library) or dynamic(dll) MFC,
    I want to learn how to create windows, get there hwnd, set there caption, set there position, etc in PURE C++(well of course it will be using API's )
    and I want to learn how to make all of it, like Edit Boxes, Buttons, Dialogs, and Timers,
    lets say I wanted to keep checked for keypress using GetAsyncKeyState, what would I do?
    would I use a Do...Loop??


    and I dont know how to do this,
    say I just wanted a small app, perhaps a 40kb app in VB, with the MFC compiled static that would be about 2MB, with the dll, well it has a dll, and that sucks.


    BTW how do you subclass in C++?
    is it the same as the VB API way?
    if so than how come it is so much harder to do it in VB than C++??


    thanks for your help... thanks A LOT
    In VC++ 6, you just go to New Project: Win32 Application: Hello! World.


    That has CreatewidowEx, some 'skeleton' subclassing and s very simple menu.


    (If this is a ridiculous answer, please don't blame me, blame the Big Bang)
    Courgettes.

  10. #10
    Guest
    thats a ridiculous answer and I blame you!


    but I thought even the simple win32 apps used a resource file or something ?

    and I know I can look at code samples, but I need to know how to create it from scratch....
    if I look at code samples there might be some specific thing that I dont want, but dont know how to change..

  11. #11
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    You only use a resource file if you need one. Although most of the time, you do. One thing off-topic: Megatron (or anyone else), do you know how to pass a member function pointer to the CreateDialog function? Mine is refusing...
    Technically, this is on-topic because it's about making Win32 apps
    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
    Lively Member
    Join Date
    Jul 2000
    Posts
    94
    You can only pass a Static member function pointer. Because a non static function pointer has additional invisible arguments (The address of the object).

  13. #13
    Guest
    can somebody help me please?

    I still dont know how to make a win32 application from scratch.......


    thanks!

    Dennis

  14. #14
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    I'll email you my development code...it's not particularly good, but it just about works .
    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

  15. #15
    Guest
    Cool, Thanks a lot!

  16. #16
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    It's a bit buggy...

    I'm still working on it. I thought I'd send it so that you could see some preliminaries
    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

  17. #17
    Lively Member
    Join Date
    Aug 2000
    Location
    quebec
    Posts
    81

    Cool

    Here's the URL for the standard C generic windows
    app code:

    http://msdn.microsoft.com/library/ps...neric_6jjo.htm

    If you really need the features of C++ and want the
    smallest exec size then you'll have to forget MFC and
    code your own classes. The above code is not really that
    difficult to transform into a few classes if you examine it closely.

    If you want simple to write, easy to read and easy to
    maintain code then you'll have to use MFC which is going to
    add a huge overhead and you'll of course 'inherit' all of
    it's bugs and idiosyncrasies (Borland's libs are better).

    You should consider using C++ Builder instead and if you
    want the best of the best in ease, simplicity, light-speed
    compile times, small fast code Vive Delphi!



  18. #18
    Guest
    what do you think would be better to buy?
    Borland C++ builder or Borland Delphi??
    I am gonna have some money available to me soon, and I want to know which is better, I think I am gonna buy C++ but I want some other opinions.


    BTW Thanks for the link,

    Dennis.

  19. #19
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    C++ Builder. If it was a choice of Delphi over C++, I'd choose C++ every time. Everything you can do in Delphi you can do in C++, and then some (inline asm rocks).
    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

  20. #20
    Frenzied Member
    Join Date
    Jun 2000
    Location
    England, Buckingham
    Posts
    1,341
    whats he url fot the platform sdk ?

  21. #21
    Lively Member
    Join Date
    Aug 2000
    Location
    quebec
    Posts
    81

    Talking

    Delphi does inline asm!

    check:

    function GetPortAddress(PortNo: integer): word; assembler; stdcall;
    asm
    push es
    push ebx
    mov ebx, PortNo
    shl ebx,1
    mov ax,40h // Dos segment adress
    mov es,ax
    mov ax,ES:[ebx+6] // get port adress in 16Bit way
    pop ebx
    pop es
    end;


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

    Cool Cool...

    Never saw that one documented .
    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

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