Converting from MFC to Native Windows C
-
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);
-
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);
-
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.
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
-
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
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.