Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Converting from MFC to Native Windows C

Converting from MFC to Native Windows C

Scheduled Pinned Locked Moved C / C++ / MFC
c++
6 Posts 2 Posters 8 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    ForNow
    wrote on last edited by
    #1

    I have a number of ownerdraw controls and wanted to put the DrawItem function code in one function. Richard MacCutchan gave me the idea of moving code to my C DLL and have the Drawitem call it. I had to remove a lot of MFC stuff to get the main body of code to my DLL most of it was straight forward except for Cwnd::GetStyle is the windows Call for that GetWindowLong(HWND,GWL_STYLE) so for the CStatic Ownerdraw code which I have

    DWORD dwStyle = phwnd->GetStyle();
    // Don't process '&' prefix sequences
    if (dwStyle & SS_NOPREFIX)
    nFormat |= DT_NOPREFIX;

    LPDRAWITEMSTRUCT lpdi; I could subsitute DWORD dwStyle = GetWindowLong(lpdi->hwndItem,GWL_STYLE);

    L 1 Reply Last reply
    0
    • F ForNow

      I have a number of ownerdraw controls and wanted to put the DrawItem function code in one function. Richard MacCutchan gave me the idea of moving code to my C DLL and have the Drawitem call it. I had to remove a lot of MFC stuff to get the main body of code to my DLL most of it was straight forward except for Cwnd::GetStyle is the windows Call for that GetWindowLong(HWND,GWL_STYLE) so for the CStatic Ownerdraw code which I have

      DWORD dwStyle = phwnd->GetStyle();
      // Don't process '&' prefix sequences
      if (dwStyle & SS_NOPREFIX)
      nFormat |= DT_NOPREFIX;

      LPDRAWITEMSTRUCT lpdi; I could subsitute DWORD dwStyle = GetWindowLong(lpdi->hwndItem,GWL_STYLE);

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Is there a question here?

      F 1 Reply Last reply
      0
      • L Lost User

        Is there a question here?

        F Offline
        F Offline
        ForNow
        wrote on last edited by
        #3

        Just wanted to know if getwindowlong GWL_STYLE is analogous CWnd::GetStyle Thanks

        L 1 Reply Last reply
        0
        • F ForNow

          Just wanted to know if getwindowlong GWL_STYLE is analogous CWnd::GetStyle Thanks

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Yes it is. As with most MFC stuff, the code is just a wrapper for the Win32 SDK. In fact you could use the Win32 code in your MFC application to confirm that it returns exactly the same value.

          F 1 Reply Last reply
          0
          • L Lost User

            Yes it is. As with most MFC stuff, the code is just a wrapper for the Win32 SDK. In fact you could use the Win32 code in your MFC application to confirm that it returns exactly the same value.

            F Offline
            F Offline
            ForNow
            wrote on last edited by
            #5

            Richard When I first started on this endeavor I was a IBM Mainframe assembler programmer I worked for software vendors and had job instability. I was told to expand my horizons. I choose windows then moved on to C\C++ albeit MFC Along the way I got a job with federal government IRS. This helped alleviate My job insecurity. Now I would rather use Windows C Win32 Sdk I have or purchased thru Zpdt offering a personal z/os mainframe on my PC The version I have allows me to sell software I write. Most my data is from z/os i.e. big endian. I display the results on windows via tcp sockets Couldn’t of done this without your help Thanks

            L 1 Reply Last reply
            0
            • F ForNow

              Richard When I first started on this endeavor I was a IBM Mainframe assembler programmer I worked for software vendors and had job instability. I was told to expand my horizons. I choose windows then moved on to C\C++ albeit MFC Along the way I got a job with federal government IRS. This helped alleviate My job insecurity. Now I would rather use Windows C Win32 Sdk I have or purchased thru Zpdt offering a personal z/os mainframe on my PC The version I have allows me to sell software I write. Most my data is from z/os i.e. big endian. I display the results on windows via tcp sockets Couldn’t of done this without your help Thanks

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              My background was also in mainframes (Univac 1100/2200 series), using Assembler and their proprietary high level (C-like) language. I was recruited to my last position specifically because of that background experience. I then transitioned into C, C++ and Java on Unix and Windows systems. Since retiring I have stuck at it and tried to learn new languages/frameworks (Android, C#, .NET, Python, SQL ...) for my own amusement. Much of my knowledge has been gained from articles here on CodeProject and elsewhere, and the help of other experts. So I could not have helped you without the help I received. After all, that is why most of us stick around here. Thanks for your kind comments. And, as always, happy to help where I can.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups