Menu

Win32 API Guide?

nvellios
2007-10-28
2012-09-26
  • nvellios

    nvellios - 2007-10-28

    I am looking for an online guide to all the Win32 API functions.

    When looking at microsoft's website all I found were Visual C++ examples which aren't compatible with Dev C++.

    Any help would be appreciated.

     
    • Osito

      Osito - 2007-10-28

      I always use MSDN as my Win32 API reference. From what I've seen their example code is generally compatible with Dev since they both use the same function names. Which examples are giving you problems?

       
    • Anonymous

      Anonymous - 2007-10-28

      There are very few compatibility issues between VC++ and Dev-C++ with respect to the Win32 API. After all the Win32 API is just that - it is standardised. What is it in particular you have found does not work.

       
    • nvellios

      nvellios - 2007-10-28

      Well I am using a few examples that are calling up code that seems it is generated by the visual studio interface code generator and isn't working.

      I found some really good examples here http://www.winprog.org/tutorial/
      But one thing I ran into was in the resource files.

      For example:

      IDD_MAIN DIALOG DISCARDABLE 0, 0, 207, 156
      STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
      CAPTION "Controls One"
      FONT 8, "MS Sans Serif"
      BEGIN
      LTEXT "Add",IDC_STATIC,7,10,14,8
      EDITTEXT IDC_TEXT,25,7,120,14,ES_AUTOHSCROLL
      EDITTEXT IDC_NUMBER,150,7,21,14,ES_NUMBER
      LTEXT "times.",IDC_STATIC,177,10,23,8
      LISTBOX IDC_LIST,7,25,138,106,LBS_NOINTEGRALHEIGHT |
      LBS_EXTENDEDSEL | WS_VSCROLL | WS_TABSTOP
      PUSHBUTTON "&Add",IDC_ADD,150,30,50,14
      PUSHBUTTON "&Remove",IDC_REMOVE,150,47,50,14
      PUSHBUTTON "&Clear",IDC_CLEAR,150,63,50,14
      LTEXT "This item was added",IDC_STATIC,7,141,66,8
      CTEXT "-",IDC_SHOWCOUNT,77,141,32,8
      LTEXT "times",IDC_STATIC,114,141,17,8
      END

      I can't figure out how to get it to work. It is written in BASIC, so I did my best attempt to convert it over to C but that still didn't work. the "DIALOG DISCARDABLE" wasn't found among other things.

       
      • Osito

        Osito - 2007-10-28

        That is just so confusing. First you said that the VC++ examples weren't compatible with Dev-C++. Now it turns out you're trying to convert BASIC code to C and it doesn't work??? Don't badmouth the MSDN documentation for Win32 API functions when that has nothing to do with your problem.

         
    • nvellios

      nvellios - 2007-10-28

      Actually, I just realized that BASIC code is acceptable in resource files.

      But it still comes up with an error for syntax at this part:

      STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU

       
    • nvellios

      nvellios - 2007-10-28

      And if I delete that one line, it starts giving errors for each part of that resource file down the line as I start deleting parts when trying to pinpoint my problem.

       
    • nvellios

      nvellios - 2007-10-28

      Andybuovin, there is similar resource code written in basic that works with the included examples in Dev C++. But that exact code doesn't work for whatever reason.

       
    • nvellios

      nvellios - 2007-10-28

      And I am not badmouthing the MSDN documentation, I was jutt saying that it seems tailored for VC++ only. That is all I was saying. I think it's great the MS gives that kind of detailed documentation to people for free.

      I will look into that MSDN Documentation further and see what I can learn from it.

      Thanks

      -Nick
      Bear with me. I'm relearning how to program after a several year break and on a completely different operating system. :)

       
      • Osito

        Osito - 2007-10-28

        The VC++ stuff works for Dev-C++ generally. And rc files aren't really BASIC or C++, they're just RC format whatever the heck that is. :)

        I pasted your code into my project and compiled. I had to add defines for the IDD and IDC names and include afxres.h which I normally don't use, but then it did work. I didn't actually try to use the dialog box, but I did get it to compile without errors or warnings:

        include <afxres.h>

        define IDD_MAIN 9090

        define IDC_TEXT 9091

        define IDC_NUMBER 9092

        define IDC_LIST 9093

        define IDC_ADD 9094

        define IDC_REMOVE 9095

        define IDC_CLEAR 9096

        define IDC_SHOWCOUNT 9097

        IDD_MAIN DIALOG DISCARDABLE 0, 0, 207, 156
        STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
        CAPTION "Controls One"
        FONT 8, "MS Sans Serif"
        BEGIN
        LTEXT "Add",IDC_STATIC,7,10,14,8
        EDITTEXT IDC_TEXT,25,7,120,14,ES_AUTOHSCROLL
        EDITTEXT IDC_NUMBER,150,7,21,14,ES_NUMBER
        LTEXT "times.",IDC_STATIC,177,10,23,8
        LISTBOX IDC_LIST,7,25,138,106,LBS_NOINTEGRALHEIGHT |
        LBS_EXTENDEDSEL | WS_VSCROLL | WS_TABSTOP
        PUSHBUTTON "&Add",IDC_ADD,150,30,50,14
        PUSHBUTTON "&Remove",IDC_REMOVE,150,47,50,14
        PUSHBUTTON "&Clear",IDC_CLEAR,150,63,50,14
        LTEXT "This item was added",IDC_STATIC,7,141,66,8
        CTEXT "-",IDC_SHOWCOUNT,77,141,32,8
        LTEXT "times",IDC_STATIC,114,141,17,8
        END

         
    • nvellios

      nvellios - 2007-10-28

      Oh sweet, those were defined already.

      The problem was I didn't add #include <afxres.h>

      You guys are awesome. A huge help to me!

       
    • Anonymous

      Anonymous - 2007-10-29

      Resource scripts are not BASIC.
      Resource scripts are not Win32
      There are subtle differences between MinGW's resource compiler (windres) and Microsoft's (rc).

      You made the mistake of deciding your solution was a Dev-C++ specific Win32 reference reference (when there is no such thing) and asking how to implement that solution. It would have been much faster just to describe the problem you were trying to solve rather than the (incorrect) solution you had decided upon!

       
    • nvellios

      nvellios - 2007-10-29

      Well actually slocombe, I originally wanted some Win32 API tutorials and documentation, but the topic shifted into my problem with resources.

      Thanks again guys for you help. I'm picking this stuff up again at a very fast pace. It feels good. :)

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.