API or MFC in Managed C++ (.NET)

This is a discussion on API or MFC in Managed C++ (.NET) within the Windows Programming forums, part of the Platform Specific Boards category; A part of one of my projects will require me to override the wndproc() function to catch a user-determined hot-key ...

  1. #1
    Registered User
    Join Date
    May 2008
    Posts
    22

    API or MFC in Managed C++ (.NET)

    A part of one of my projects will require me to override the wndproc() function to catch a user-determined hot-key and right-click from an external application. I've been going through a couple Win32 API tutorials when it mentioned that Win32 was the old non-OO way of doing things and the MFC was OO. From what I can tell, MFC seems to be a more thought-out OO wrapper for Win32 API but which should I concentrate on as far as basic understanding for this limited purpose? Or does .NET have a different preferred way of overriding wndproc()?

  2. #2
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    22,828
    You should not be using either Win32 API or WindowProc from Managed C++.
    There should be preferred ways to do the same thing from within the managed framework.
    But you are correct in that the Win32 is C and that MFC is an OO wrapper for the API.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #3
    Registered User
    Join Date
    May 2008
    Posts
    22
    The only thing I've found in scope of the .NET environment is that the KeyPreview property can be turned on to check keypresses before they are delivered to the focused control which limits this to within the application only. According to http://www.codeproject.com/KB/vb/mclhotkeynet.aspx a system-wide hot key requires resorting to Win32 API. So far, in order to prepare myself for this challenge, it looks like I should continue to study the API using a combo of online tutorials and my Charles Petzold book.

    From what I can tell this is not possible using managed code. And I would need to grab whatever the current text selection is on the external application and copy it to the clipboard for use in my own app. I guess I could emulate keypresses to invoke copying to clipboard globally.

  4. #4
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    Either use C# or C++ .NET. I highly recommend C# and do not recommend C++ .NET.

  5. #5
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Yeah that fancy newfangled C pound sign-a-majig is purty nifty for these sorts of thingies.

  6. #6
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189
    I don't see any legitimate reason to override the wndproc() of another application.
    Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.

  7. #7
    Registered User
    Join Date
    Oct 2007
    Posts
    242
    Quote Originally Posted by abachler View Post
    I don't see any legitimate reason to override the wndproc() of another application.
    Well hooking is probably the issue. BTW, you cannot actually override the Window Procedure of another process, but you could set a hook with SetWindowsHookEx()

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A question about windows programming
    By Hussain Hani in forum Windows Programming
    Replies: 16
    Last Post: 05-23-2007, 07:38 AM
  2. Windows, MFC, .NET, C++ ???
    By alpha in forum Windows Programming
    Replies: 8
    Last Post: 08-07-2006, 02:31 PM
  3. OLE Clipboard :: Win32 API vs. MFC
    By kuphryn in forum Windows Programming
    Replies: 3
    Last Post: 08-11-2002, 05:57 PM
  4. Thread Synchronization :: Win32 API vs. MFC
    By kuphryn in forum Windows Programming
    Replies: 2
    Last Post: 08-09-2002, 09:09 AM
  5. WIndows programming?
    By hostensteffa in forum Windows Programming
    Replies: 7
    Last Post: 06-07-2002, 08:52 PM

Tags for this Thread


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