Am I in the right place?

This is a discussion on Am I in the right place? within the C Programming forums, part of the General Programming Boards category; I'm new here, obviously. I have some experience with Fortran back in the punched card days, considerably more with QuickBASIC ...

  1. #1
    RVC
    RVC is offline
    Registered User
    Join Date
    Mar 2011
    Location
    Central Florida
    Posts
    8

    Am I in the right place?

    I'm new here, obviously. I have some experience with Fortran back in the punched card days, considerably more with QuickBASIC and a smidgen with assembly. Now in Windows I want to pursue C with the intent of generating output to the screen or printer, operating within the Windows environment. Initially I will write some of the simple structual analysis programs I already have in QB.

    Is C the language for me? How about C++? I am currently working through the C tutorial here, but a shove in the right direction before I get too much more involved would be appreciated.

    Thank you.

    RVC

  2. #2
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    If you need maximum speed, then C or C++ is excellent. Otherwise, I'd use Python. You'll enjoy it's higher level language features, it's relative ease of learning, and it has a large user base and library.

    Free ebook "Dive into Python", available on the web, and several active forums. Home base is Python.org IIRC, and look for the links.

    Your programming will take less time to write with Python, than with either C or C++. Run times will be slightly longer, but computers are way fast nowadays. Should be a good trade off.

  3. #3
    RVC
    RVC is offline
    Registered User
    Join Date
    Mar 2011
    Location
    Central Florida
    Posts
    8
    Thank you very much. I will probably stick with C as it is a language I would like to learn more about. As you did not address my concerns about output to printers and writing programs that will be used in windows I assume those are not issues and will forge ahead.

    Your help and advice is appreciated.

    RVC

  4. #4
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by RVC View Post
    Thank you very much. I will probably stick with C as it is a language I would like to learn more about. As you did not address my concerns about output to printers and writing programs that will be used in windows I assume those are not issues and will forge ahead.

    Your help and advice is appreciated.

    RVC
    The answers depend on whether you're looking to write Console (CMD Shell) or Windows GUI programs...

    Lots and lots of windows GUI programs are writen in C, I do it fairly often. But it's not simple programming, Windows GUI requires a whole different approach than you may be used to.

    For the moment, concentrate on getting the basics of C down... Read the books, do the exercises... take the time to do this right.

  5. #5
    RVC
    RVC is offline
    Registered User
    Join Date
    Mar 2011
    Location
    Central Florida
    Posts
    8
    Yes indeed, taking my time and doing it right will be primary. Windows GUI is what I am looking for and I can imagine that it will be involved. But I like "involved" as a rule and look forward to getting there. For now I'm having a great time wading through the basics.

    Thank you.

    RVC

  6. #6
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by RVC View Post
    Yes indeed, taking my time and doing it right will be primary. Windows GUI is what I am looking for and I can imagine that it will be involved. But I like "involved" as a rule and look forward to getting there. For now I'm having a great time wading through the basics.

    Thank you.

    RVC
    The first consideration is which Compiler you are using... Microsoft has VC++ which you can download and use for free but I've always preferred PellesC (also free) because of the full windows resource file support, icon editor and image editors built into the IDE... It's kind of an "all in one" solution, very well done.

    Once you get a few console proggys working and feel confident in taking the high dive into the shallow end of the pool, check out...

    theForger's Win32 API Tutorial

    Also since the Windows API consists of 30,000+ function calls you're going to want the Windows Software Development Kit (Win SDK) for local reference.

    Download details: Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP1

    Be warned though... the SDK's downloader is ~490k but when you run it, it's going to download between 1 and 3gb of information onto your system (depending on the options you choose).

  7. #7
    RVC
    RVC is offline
    Registered User
    Join Date
    Mar 2011
    Location
    Central Florida
    Posts
    8
    Currently I'm using Code::Blocks and MINGW. For the little I have done so far they seem to be fine. Is there a reason I would consider switching to your PellesC? Thanks also for the rest of the info. Wonder how long it will take before I get to the point where I can use it.

    At any rate, thanks again.

    RVC

  8. #8
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by RVC View Post
    Currently I'm using Code::Blocks and MINGW. For the little I have done so far they seem to be fine. Is there a reason I would consider switching to your PellesC? Thanks also for the rest of the info. Wonder how long it will take before I get to the point where I can use it.

    At any rate, thanks again.

    RVC
    Both are fully capable compilers... so lets not debate that.

    But, windows GUI apps include resources... menus, dialogs, string tables, message tables, icons, manifests, bitmaps, imagelists, versioninfo, code signing and other things imbedded right into the executable image.

    With Code::Blocks, you will need to find editors for all these things separately and iron out the incompatibilities yourself... and good luck finding a free standing Message Table editor; if it's out there I've never seen it.

    Pelle's IDE has all that built right in from the git go... As I said, it's a real nice "all in one" solution, everything you need to produce a fully marketable Windows application... GUI or Console.

    How long till this matters? Well, it probably matters a little bit right now... GCC has some extensions Pelle decided not to include. Pelles C has some stuff GCC lacks... I believe PellesC is closer to the C-99 standard. So for these issues you probably should make your choice fairly early on and get used to the included libraries etc. before climbing into Windows.

    The transition from console to gui programming is kind of like learning a whole new language... the underbelly is still C but GUI programs are totally different... they even have a different entry point procedure winmain() instead of main()... So you need to be ready to take on a whole new programming scenario, based on the same syntax, when making the transition.

    Just to give you some idea, here is a skeletal windows program... Just enough to put a window on the screen and let you close it.

    Code:
    #include <windows.h>
    #include <commctrl.h>
    
    HINSTANCE gInst;          // global instance handle
    HWND      MainWind;       // global main window handle
    HWND      Win[9];         // windows handle array 
    HACCEL    Accel =NULL;    // keyboard accelerator
    
    //////////////////////////////////////////////////////////////////////////////////////////
    // Message Loop
    //
    LRESULT CALLBACK MsgProc(HWND wnd,UINT msg,WPARAM wp,LPARAM lp)
      { switch (msg)
          { case WM_COMMAND :
              switch (LOWORD(wp))
                { case 100 :
                   Beep(500,100);
                   return 0;
                 default :
                    return DefWindowProc(wnd,msg,wp,lp); }
    
            // NC Exit button
            case WM_CLOSE :
              DestroyWindow(Win[0]);
              return 0;
            case WM_DESTROY :
              PostQuitMessage(0); 
              return 0; 
            default :
              return DefWindowProc(wnd,msg,wp,lp); } }
    
    //////////////////////////////////////////////////////////////////////////////////////////
    // Main UI
    //
    BOOL CreateMainUI(void)    
      { WNDCLASS  wc;     // window class
        
        // register App Class
        memset(&wc,0,sizeof(wc));
        wc.style          = CS_CLASSDC;
        wc.hInstance      = gInst;
        wc.hIcon          = LoadIcon(gInst,"APPICON");
        wc.hCursor        = LoadCursor(NULL,IDC_ARROW);
        wc.hbrBackground  = CreateSolidBrush(GetSysColor(COLOR_3DFACE));
        wc.lpfnWndProc    = &MsgProc;
        wc.lpszClassName  = "PROGNAME_CLASS";
        if (!RegisterClass(&wc))
          return 0; 
    
        // create the main window
        Win[0] = CreateWindowEx( WS_EX_CONTROLPARENT,"PROGNAME_CLASS","Win Gui Wizard",
                        WS_OVERLAPPEDWINDOW,
                        CW_USEDEFAULT,CW_USEDEFAULT,400,200,0,0,gInst,NULL);
        MainWind = Win[0];
    
       UpdateWindow(Win[0]);
        ShowWindow(Win[0], SW_SHOWNORMAL);    
    
        return 1; }
    
    
    //////////////////////////////////////////////////////////////////////////////////////////     
    // Program Entry Procedure
    //
    int WINAPI WinMain(HINSTANCE hinst, HINSTANCE pinst, LPSTR cmdl, int show)
      { gInst = hinst;    
        MSG     msg;
    
        // Test if first copy.  If not first copy
        CreateMutex(NULL,1,"PROGNAME_MUTEX"); 
        if (GetLastError() == ERROR_ALREADY_EXISTS)
          return 0;
    
        // at this point we're pretty sure we're the first copy
        InitCommonControls();
        // save instance handle
    
        CreateMainUI();
    
        // dispatch window messages
        while (GetMessage(&msg,NULL,0,0) > 0)
          if(!TranslateAccelerator(MainWind,Accel,&msg))
            if(!IsDialogMessage(GetForegroundWindow(),&msg))
              { TranslateMessage(&msg);
                DispatchMessage(&msg); }
        
        // cleanup and exit
        return 0; }

  9. #9
    RVC
    RVC is offline
    Registered User
    Join Date
    Mar 2011
    Location
    Central Florida
    Posts
    8
    OK, PellesC has been downloaded and installed and I have managed to get your window routine to run. Thank you very much for all this. I'll continue wading through my beginner stuff now and see how I do. I am using the tutorials on this Cprograming site. Maybe someday soon I will understand much of what you have written here.

    I appreciate all this. Thanks again.

    RVC

  10. #10
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by RVC View Post
    OK, PellesC has been downloaded and installed and I have managed to get your window routine to run.
    I would hope so... that's the output of a custom wizard I made to give myself a 1 click skeleton for my programs.

    Thank you very much for all this. I'll continue wading through my beginner stuff now and see how I do. I am using the tutorials on this Cprograming site. Maybe someday soon I will understand much of what you have written here.

    I appreciate all this. Thanks again.

    RVC
    No problem... The tutorials here aren't bad but there are better and far more comprehensive tutorials to use...

    (Not to mention a whole boatload of books.)

    Teach Yourself C in 21 Days -- Table of Contents

    C Programming

  11. #11
    Banned
    Join Date
    May 2009
    Posts
    37
    Quote Originally Posted by RVC View Post
    I'm new here, obviously. I have some experience with Fortran back in the punched card days, considerably more with QuickBASIC and a smidgen with assembly. Now in Windows I want to pursue C with the intent of generating output to the screen or printer, operating within the Windows environment. Initially I will write some of the simple structual analysis programs I already have in QB.

    Is C the language for me? How about C++? I am currently working through the C tutorial here, but a shove in the right direction before I get too much more involved would be appreciated.

    Thank you.

    RVC


    [looks at the screen, it disbelief, mouth agape... "what??..." shakes head... "whaat??"... "i don't get why he's gonna do this and then this... well, i think i get the GIST of it... yeah.. this means this. yeah. whatever happens he's just a beginner, nothing changes that. doesn't matter that he is in fact an computer science student while i'm just a geek or an IT. yeah... i think this is just what he's trying to do. yeah."

    why are people here stupendously stupid? maybe they just like things that would "just works", even though it's buggy, hard to maintain and grossly inefficient (in all levels)

    python. bit of bash, javascript, html, perl. java. c#. c, c++ (c back in high school, helped me a lot on how to figure out what's going on behind the scenes in c++).
    digital logic. vhdl. assembly.

    Quote Originally Posted by CommonTater View Post

    Code:
    #include <windows.h>
    #include <commctrl.h>
    
    HINSTANCE gInst;          // global instance handle
    HWND      MainWind;       // global main window handle
    HWND      Win[9];         // windows handle array 
    HACCEL    Accel =NULL;    // keyboard accelerator
    
    //////////////////////////////////////////////////////////////////////////////////////////
    // Message Loop
    //
    LRESULT CALLBACK MsgProc(HWND wnd,UINT msg,WPARAM wp,LPARAM lp)
      { switch (msg)
          { case WM_COMMAND :
              switch (LOWORD(wp))
                { case 100 :
                   Beep(500,100);
                   return 0;
                 default :
                    return DefWindowProc(wnd,msg,wp,lp); }
    
            // NC Exit button
            case WM_CLOSE :
              DestroyWindow(Win[0]);
              return 0;
            case WM_DESTROY :
              PostQuitMessage(0); 
              return 0; 
            default :
              return DefWindowProc(wnd,msg,wp,lp); } }
    
    //////////////////////////////////////////////////////////////////////////////////////////
    // Main UI
    //
    BOOL CreateMainUI(void)    
      { WNDCLASS  wc;     // window class
        
        // register App Class
        memset(&wc,0,sizeof(wc));
        wc.style          = CS_CLASSDC;
        wc.hInstance      = gInst;
        wc.hIcon          = LoadIcon(gInst,"APPICON");
        wc.hCursor        = LoadCursor(NULL,IDC_ARROW);
        wc.hbrBackground  = CreateSolidBrush(GetSysColor(COLOR_3DFACE));
        wc.lpfnWndProc    = &MsgProc;
        wc.lpszClassName  = "PROGNAME_CLASS";
        if (!RegisterClass(&wc))
          return 0; 
    
        // create the main window
        Win[0] = CreateWindowEx( WS_EX_CONTROLPARENT,"PROGNAME_CLASS","Win Gui Wizard",
                        WS_OVERLAPPEDWINDOW,
                        CW_USEDEFAULT,CW_USEDEFAULT,400,200,0,0,gInst,NULL);
        MainWind = Win[0];
    
       UpdateWindow(Win[0]);
        ShowWindow(Win[0], SW_SHOWNORMAL);    
    
        return 1; }
    
    
    //////////////////////////////////////////////////////////////////////////////////////////     
    // Program Entry Procedure
    //
    int WINAPI WinMain(HINSTANCE hinst, HINSTANCE pinst, LPSTR cmdl, int show)
      { gInst = hinst;    
        MSG     msg;
    
        // Test if first copy.  If not first copy
        CreateMutex(NULL,1,"PROGNAME_MUTEX"); 
        if (GetLastError() == ERROR_ALREADY_EXISTS)
          return 0;
    
        // at this point we're pretty sure we're the first copy
        InitCommonControls();
        // save instance handle
    
        CreateMainUI();
    
        // dispatch window messages
        while (GetMessage(&msg,NULL,0,0) > 0)
          if(!TranslateAccelerator(MainWind,Accel,&msg))
            if(!IsDialogMessage(GetForegroundWindow(),&msg))
              { TranslateMessage(&msg);
                DispatchMessage(&msg); }
        
        // cleanup and exit
        return 0; }

    did alot of these on college courses that asked us to produce a "app solution". looking back at it, it's funny how i too, believed the "hard technical problems" are how to work with these objects using these APIs. while i haven't really dived in more computational stuff.
    Last edited by renzokuken01; 03-07-2011 at 11:05 PM.

  12. #12
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by renzokuken01 View Post
    why are people here stupendously stupid?
    Off your meds again, I see...

  13. #13
    Banned
    Join Date
    May 2009
    Posts
    37
    Quote Originally Posted by CommonTater View Post
    Off your meds again, I see...
    and what are you??? thinking that "ohhh he's unemployed, sitting around overthinking stuff just like me... he likes to "dabble" with these things and play around with them and INVESTIGATE by doing all these NONSENSICAL, USELESS programs... but in the end of the day, it ok.. he has a good heart... and i RESPECT THAT."


    "he JUST DOESN'T GET IT!!!! [grinds teeth, more agitated, probably even has his hands clenched together staring out far rocking slightly back and forth].. WHAT CAN BE PRODUCED THAT'S IN ANY WAY BETTER THAT EVERYTHING THAT I'VE POSTED HERE SO FAR!!! I'M PRETTY INTELLIGENT MYSELF, AND I THINK I'VE DEMONSTRATED HERE (me: without reviewing any of my work, btw) that ANYBODY CAN DO WHAT HE'S DOING! YEAH!"
    Last edited by renzokuken01; 03-07-2011 at 11:26 PM. Reason: more comments

  14. #14
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by renzokuken01 View Post
    and what are you???
    Glad as all get out that I'm not you.

  15. #15
    RVC
    RVC is offline
    Registered User
    Join Date
    Mar 2011
    Location
    Central Florida
    Posts
    8
    Good morning, Tater.

    Again, thanks for your help, especially for the tutorials.

    This board is a great resource. From reading through some of the more recent threads I find myself clueless about most of what is being said. Time and effort will remedy some of that I trust. It's good to know there is so much available to help one up the learning curve.

    All the best.

    RVC

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to place controls?
    By C_ntua in forum C# Programming
    Replies: 3
    Last Post: 12-19-2008, 02:16 PM
  2. Decimal place range. simple help needed
    By Chris0724 in forum C Programming
    Replies: 8
    Last Post: 09-10-2008, 03:41 AM
  3. A place to start - mac or pc?
    By GCat in forum C++ Programming
    Replies: 12
    Last Post: 11-19-2004, 12:21 PM
  4. Berlin: Searching for a place to stay
    By fabs in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 01-14-2002, 02:18 AM
  5. Where is a good place to start?!
    By bobthefish3 in forum Game Programming
    Replies: 1
    Last Post: 10-09-2001, 12:28 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21