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. VC++ .Net

VC++ .Net

Scheduled Pinned Locked Moved C / C++ / MFC
csharpc++helpquestion
3 Posts 3 Posters 0 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.
  • R Offline
    R Offline
    Ruca
    wrote on last edited by
    #1

    Hi, I was playing around a little with .Net, just for fun and created a dialog based project. I added a button to my dialog and created an OnBnClickedButton1() function. But I tried to make this function return a BOOL rather than being void. I then get the following error message: error C2440: static_cast: cannot convert from BOOL(__thiscall CSampleDlg::*)(void) to AFX_PMSG. Anyone can explain to me how does one make this function return something. Or is it not allowed in .Net? Thanks Regards Rui

    T A 2 Replies Last reply
    0
    • R Ruca

      Hi, I was playing around a little with .Net, just for fun and created a dialog based project. I added a button to my dialog and created an OnBnClickedButton1() function. But I tried to make this function return a BOOL rather than being void. I then get the following error message: error C2440: static_cast: cannot convert from BOOL(__thiscall CSampleDlg::*)(void) to AFX_PMSG. Anyone can explain to me how does one make this function return something. Or is it not allowed in .Net? Thanks Regards Rui

      T Offline
      T Offline
      Tomasz Sowinski
      wrote on last edited by
      #2

      VC.NET has improved type checking in message maps. The header of your function is simply not compatible with ON_CONTROL event handler. Anyway, it's MFC who calls your handler - so return value is ignored. Tomasz Sowinski -- http://www.shooltz.com

      "Yields falsehood when preceded by its quotation" yields falsehood when preceded by its quotation.

      1 Reply Last reply
      0
      • R Ruca

        Hi, I was playing around a little with .Net, just for fun and created a dialog based project. I added a button to my dialog and created an OnBnClickedButton1() function. But I tried to make this function return a BOOL rather than being void. I then get the following error message: error C2440: static_cast: cannot convert from BOOL(__thiscall CSampleDlg::*)(void) to AFX_PMSG. Anyone can explain to me how does one make this function return something. Or is it not allowed in .Net? Thanks Regards Rui

        A Offline
        A Offline
        Abin
        wrote on last edited by
        #3

        Modifying signature of message handlers were never recommended...

        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