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#
  4. Bad programming ethics

Bad programming ethics

Scheduled Pinned Locked Moved C#
csharpc++jsonhelpquestion
2 Posts 2 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.
  • E Offline
    E Offline
    eggie5
    wrote on last edited by
    #1

    I made this wrapper around an unmanaged C++ library and am having some troubles with a messagebox. Normally when the c++ library encounters an error or whatever, it would return a 0 or whatnot, but on some functions it just decides to show a message box with an error message, totally inconsistency with the rest of the program. This is even worst since I am wrapping the library and then instead of my error message that would come up the user get's this random messagebox popup with some cryptic error message. Anyways, I was wondering if there is a way to suppress this messagebox from popping up. The messagebox originates from the unmanaged c++ library, so can my C# wrapper class block the messagebox somehow? /\ |_ E X E GG

    J 1 Reply Last reply
    0
    • E eggie5

      I made this wrapper around an unmanaged C++ library and am having some troubles with a messagebox. Normally when the c++ library encounters an error or whatever, it would return a 0 or whatnot, but on some functions it just decides to show a message box with an error message, totally inconsistency with the rest of the program. This is even worst since I am wrapping the library and then instead of my error message that would come up the user get's this random messagebox popup with some cryptic error message. Anyways, I was wondering if there is a way to suppress this messagebox from popping up. The messagebox originates from the unmanaged c++ library, so can my C# wrapper class block the messagebox somehow? /\ |_ E X E GG

      J Offline
      J Offline
      jonny5
      wrote on last edited by
      #2

      You are not going to be able to block it in C# (well, maybe - but it would be a serious hack) If you can recompile the C++ library, there is a way to do away with that messagebox. If I remember correctly it is coming from the C libary, so do a search for the messagebox api in the C headers for the #define - then just copy/paste into your header to override, the recompile. I've done that before and it works nicely. However, on that note, the message you are getting is probably "pure virtual function call" - which indicates that the C++ code needs to be fixed anyway, as there is a bug. Search for "pure virtual function call" on MSDN and there is a full explanation of why you see that messagebox.

      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