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. problem when run the application using cntrl+F5. Wintech OPC DLL

problem when run the application using cntrl+F5. Wintech OPC DLL

Scheduled Pinned Locked Moved C / C++ / MFC
csharphelpc++dotnetwpf
6 Posts 5 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.
  • M Offline
    M Offline
    Member_14676706
    wrote on last edited by
    #1

    Hi all, I have an MFC application for which I have integrated OPC function using Wintech OPC DLL. This application is an OPC Client which connects to a OPC Server and gets values from it using OPC communication. I call the OPC functions in my application. I used WPF(dll created by C#) in this application for some graphics and turned on the project setting "Common Language Runtime Support (/clr)" When I run my application in VS2008 using F5, it runs without any issues it shows correct values. But when I run the same application using Cntrl+F5 or directly run the EXE, it runs but it shows junk values. Notes Suppose i change project setting from "Common Language Runtime Support (/clr)" to "No Common Language Runtime support" it is not supported WPF dll. Please help ;) ;) ;) بلیط هواپیما ثبت دامنه طراحی سایت طراحی سایت فروشگاهی طراحی سایت شرکتی تبلیغات گوگل هاست لینوکس

    L L 2 Replies Last reply
    0
    • M Member_14676706

      Hi all, I have an MFC application for which I have integrated OPC function using Wintech OPC DLL. This application is an OPC Client which connects to a OPC Server and gets values from it using OPC communication. I call the OPC functions in my application. I used WPF(dll created by C#) in this application for some graphics and turned on the project setting "Common Language Runtime Support (/clr)" When I run my application in VS2008 using F5, it runs without any issues it shows correct values. But when I run the same application using Cntrl+F5 or directly run the EXE, it runs but it shows junk values. Notes Suppose i change project setting from "Common Language Runtime Support (/clr)" to "No Common Language Runtime support" it is not supported WPF dll. Please help ;) ;) ;) بلیط هواپیما ثبت دامنه طراحی سایت طراحی سایت فروشگاهی طراحی سایت شرکتی تبلیغات گوگل هاست لینوکس

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

      You will need to provide much more information before anyone can help you with this. You say that it shows junk values; what are those values and why are they junk? What is the code that produces them, and what input data is used to create the values in the first place?

      F 1 Reply Last reply
      0
      • M Member_14676706

        Hi all, I have an MFC application for which I have integrated OPC function using Wintech OPC DLL. This application is an OPC Client which connects to a OPC Server and gets values from it using OPC communication. I call the OPC functions in my application. I used WPF(dll created by C#) in this application for some graphics and turned on the project setting "Common Language Runtime Support (/clr)" When I run my application in VS2008 using F5, it runs without any issues it shows correct values. But when I run the same application using Cntrl+F5 or directly run the EXE, it runs but it shows junk values. Notes Suppose i change project setting from "Common Language Runtime Support (/clr)" to "No Common Language Runtime support" it is not supported WPF dll. Please help ;) ;) ;) بلیط هواپیما ثبت دامنه طراحی سایت طراحی سایت فروشگاهی طراحی سایت شرکتی تبلیغات گوگل هاست لینوکس

        L Offline
        L Offline
        leon de boer
        wrote on last edited by
        #3

        Most likely your code relies on a variable being zero or a BOOL false which you haven't specifically set to zero/false. Look at all your variables which require a preset zero value and make sure you set them. When you run in debug mode because it is going to display things it first zeros all variables, that does not happen when you run in normal mode. This for example will print 0 in debug F5 mode but could print anything in normal ctrl-F5 mode because i is not set

        int i;
        printf("i = %i\n", i);

        In vino veritas

        S 1 Reply Last reply
        0
        • L Lost User

          You will need to provide much more information before anyone can help you with this. You say that it shows junk values; what are those values and why are they junk? What is the code that produces them, and what input data is used to create the values in the first place?

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

          Richard Here is the statement

          HANDLE hBmp = (HBITMAP)	LoadImage(AfxGetInstanceHandle(), \_TEXT("C:\\\\DriveRichEdit\\\\DriveRichEdit\\\\DriveRichEdit\\\\res\\\\bullet\_red.png"), IMAGE\_BITMAP, 0, 0, LR\_LOADFROMFILE);
          

          As leon mentioned LoadImage may not work with .png files I am trying to emulate Visual Studio Debugger Breakpoint, when I used the RichEdit OLE interface and look at the SetSel parameters I see the first value (The x value as 1) however is stands away from right edge of the Parent Dialog frame (maybe by 1/8 of inch). Looking at the image in file explorer it looks just fine but when I am open the image in paintbrush I can see a rectangular white border around it and maybe that is part of the problem. If that is a problem would you have any suggestion for me how to get an image ie. red bullet, I picked this one up by doing a google search thanks

          1 Reply Last reply
          0
          • L leon de boer

            Most likely your code relies on a variable being zero or a BOOL false which you haven't specifically set to zero/false. Look at all your variables which require a preset zero value and make sure you set them. When you run in debug mode because it is going to display things it first zeros all variables, that does not happen when you run in normal mode. This for example will print 0 in debug F5 mode but could print anything in normal ctrl-F5 mode because i is not set

            int i;
            printf("i = %i\n", i);

            In vino veritas

            S Offline
            S Offline
            Stefan_Lang
            wrote on last edited by
            #5

            Are you sure variables are not initialized for a debug build when run with ctrl-F5? ctrl-F5 only implies that the code will be run without attaching the VisualStudio debugger. It does not mean the code will be run in release mode - there may not even be a release mode executable to run. I do know that you can run a release build with F5, and when you inspect an uninitialized variable, it will most likely not show a null value, just as you described - but that does not depend on whether or not you attach a debugger.

            GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)

            L 1 Reply Last reply
            0
            • S Stefan_Lang

              Are you sure variables are not initialized for a debug build when run with ctrl-F5? ctrl-F5 only implies that the code will be run without attaching the VisualStudio debugger. It does not mean the code will be run in release mode - there may not even be a release mode executable to run. I do know that you can run a release build with F5, and when you inspect an uninitialized variable, it will most likely not show a null value, just as you described - but that does not depend on whether or not you attach a debugger.

              GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)

              L Offline
              L Offline
              leon de boer
              wrote on last edited by
              #6

              You are getting build configuration mode as in "debug" and "release" mode come in that isn't relevant. The act of connecting a debugger does it's thing which is connect to the memory space, function and variables it doesn't give a rats about build mode. From a memory point the key thing it does is drop it's own heap manager which has been forever but started to be improved in VS2014 and now it connects to that whole memory display gadget that seems to get slower and slower each release. C++ Debugging Improvements in Visual Studio "14" | C++ Team Blog[^] That means whenever you run the debugger the heap is different to normal unless you go thru the hijinx to turn it off which used to be as simple as _NO_DEBUG_HEAP = 1 but like everything it has gotten successively harder.

              In vino veritas

              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