How to save a CWGraph into a bitmap (.bmp) file in Visual C++?

I plot (chart) data into a graph control on a MFC dialog in Visual C++ and I need to save the image into a bmp file. I found the ControlImage method, but did not find any way to use it in Visual C++.
I would also like to retrieve the chart data (the point charted on the graph for each plot) and to use them to build data files. How to do it?

Dealing with images in VC++ is far from easy. You would need to create the following objects: CBitmap, CArchive, CPictureHolder and a CDC.
Then call the SelectObject function on the CDC and pass in the CBitmap object. Then you can put the image of the graph in the CPictureHolder with:
ph.SetPictureDispatch((LPPICTUREDISP)m_CWGraph.Con​trolImage().m_lpDispatch);
where ph is the CPictureHolder and m_CWGraph is the CWGraph.
Then you can render the image to the bitmap CDC by calling the CPictureHolder::Render function. It will ask for the bounds of the picture in CRect form as well.
Then you can call the CBitmap.Serialize function with the CArchive object which should be pointing to the appropriate BMP file. Don't you just love MFC?
As for you second qu
estion, you can't retrieve the data that has been plotted to the graph. We don't maintain the data that is sent in because it would be very inefficient memory usage since data is usually decimated for display. I would recommend that you just send your data to a global buffer at the same time as plotting.
Best Regards,
Chris Matthews
Measurement Studio Support Manager

Similar Messages

  • How to save a single page in a pdf file

    how to save a single page in a pdf file?

    I also need to do this so i can send portions of a large fax file.

  • How to call GOS(Generic Object service) attachment ( BMP file ) into SAP

    How to call GOS(Generic Object service) attachment ( BMP file ) into SAP script
    Example: MM02 Service object there attaching the bmp file the same file i need to call script based on the material number
    Please provide the procedure and  coding.
    Thanks in advance
    Raju

    Hi,
    The following link may be useful to u.
    help.sap.com/printdocu/.../BCSRVOBS.pdf

  • How to save an image as a PICT resource file?

    Can someone tell me how to save an image as a PICT resource file? I'd like to make ikons in Photoshop and save them in this format, but I 'm not finding any leads. Thanks!

    If you have Resorcerer from "ancient times" it of course can handle resource forks since that's was it's goal in life.
    There are lots of icon creation apps these days.  Do a search for "icon" on macupdate.com to see what's available.  For example that search finds:
    iconXprit
    Icon Builder X

  • How to save BI report into normal excel sheet in Bex Analyzer

    Hi Experts,
    version of  Bex Analyzer:
    Bi addon 7.x
    support package 7,patch 1
    version 7004.4.0.5
    excel-2003
    when i am trying to save the report into excel in Bex Analyzer as below:
    file-save as->Microsoft excel work.
    when I open excel I am getting pop up windowu201Dthis file contains macros  with an expired or revoked signature.Since your running under  high security level,these macros will be disabled.u201D
    when I click ok I am getting one more pop upwindow as u201Cmacros  are diabled because the security level is set to high and a digitally signed trusted certificate is not attached to macros.to run the macros,change the security level to a lower setting(not recommended),or request the macros signed by the author  using a certificate  issued by a certificate authority.
    what are these macros? why i am getting this pop up windows
    When i opened  the excel report is not looks like general excel report.how can I generate general excel report .I should not want to get excel report as in bex analyzer.I donu2019t want to have author ,status of data,chart,filter,information in excel report.
    what settings I have to made to save the report in general excel format.
    As i am new to Bi please correct me if i am wrong.
    Anything is appreciable.
    regards,
    naresh.

    Macros in general are nothing but piece of code in excel.
    To allow unsigned macros to run, the Trust all installed add-ins and templates check box must be selected on the Trusted Publishers tab of the Security dialog box. This option is selected by default. If it is not selected (recommended), Excel allows you to run only macros that have trusted digital signatures.
    1. On the Tools menu, point to Macro, and then click Security.
    2. On the Trusted Publishers tab, select the Trust all installed add-ins and templates check box.

  • How to save User input into DB using webdynpro abap

    Hi,
    Im trying to create an application using webdynpro abap.
    I want to know how to save the data input by user, into a database table.
    In my UI, I have a table control which is editable and user inputs data into this. I need to know how i can transfer this data to a DB table.

    hello,
    u can do it by reading ur context node.
    we bind our UI elements to context attributes of appropriate type .
    we read their values using the code wizard or by pressing control+F7, click on radio button read node/attribute
    here for ur specific case , u must have binded ur table control with the context attribute , now u need to simply read this attribute
    eg suppose u have created a context node " cn_table"
      reading context node cn_table
       DATA : lo_nd_cn_table TYPE REF TO if_wd_context_node ,
             lo_el_cn_table TYPE REF TO if_wd_context_element ,
             ls_cn_table    TYPE wd_this->element_cn_table.
    *   navigate from <CONTEXT> to <CN_TABLE> via lead selection
      lo_nd_cn_table = wd_context->get_child_node(
                       name = wd_this->wdctx_cn_table ).
    **    get element via lead selection
      lo_el_cn_table = lo_nd_cn_table->get_lead_selection(  ).
      lo_el_cn_table->get_static_attributes( IMPORTING
                 static_attributes = wa_table ).
    here wa_table is the work area of structure type . u need to create a structure first with the same variables as there are the context attributes in ur node cn_table
    in ur
    now ur wa_tablecontains value
    u can nw use appropriate FM to update , delete and modify the DB table using the value
    u cn directly use SQL statements as well in the method of ur view , but direct SQL statements are nt recommende
    rgds,
    amit

  • How to save VISA information into a configuration file

    Hi guys,
    I've got a problem that i can't quite figure out and I'm sure someone else has done this but i have searched the forums and didn't find anything suitable myself.
    I'm trying to save configuration files for my program and then reload them back in so that i can get the same state of the controls.  One of the controls I'd like to save into the configuration file is a VISA control.  has anyone figured out how to save this into configuration files?  I know that OpenG has a write variant to config but Id like to stay away from 3rd party stuff as much as possible.  Does anyone have any suggestions as to how to get around this?
    Thanks
    Brent 
    Solved!
    Go to Solution.

    The alternative to Write Keys, if you don't want a text file, is a BIN file. I do it this way when I don't want users poking around text file trying to change things, and/or for security. And it's fast.
    The attached picture shows, in general, how to do it.
    Richard
    Attachments:
    saveSettings.gif ‏11 KB

  • How to save an icon as a bitmap file in illustrator with transparency?

    Hello I need help,
    I don't normally work with bitmap files however I find myself in need to save out a set of icons in this particular format for a client to use with their own software on a pc. this software can only import/use .bmp files.
    In my export options .bmp is an option but I am unable to save it out with a transparent background which is a big issue. The result is an icon with white background and I need it to be transparent.
    I tried pasting these icons to photoshop but I only is a portable bitmap format in the "save as" menu which I don't think will work as it creates a .PMP file and I don't think it will work with client's software. I am on a mac, with illustrator CC as well as photoshop.
    I would very much appreciate help with this, I have been trying to figure this out for 2 hours now. Thank you in advance.

    When I have created bitmap icons in the past (used to work for a software company) I used to create them with either a icon creator tool (Axialis) or directly in photoshop.
    For color depths 24 BPP or less, the transparency is coded by using a fixed color. Each pixel that have this exact color will be converted as transparent when the image is loaded in the toolbar. Usually, the color used is green RGB(0,255,0) or magenta RGB(255,0,255). The problem of this method is that if you use a pixel of that color in your icon image (not the background), it will be converted as transparent. The other issue is the poor quality of the borders (around the icons) because it does not permit smooth transparency. In other words, a pixel is either 100% transparent or 100% opaque, there is no variable transparency. It results in "aliasing" on borders for icons with rounded shapes.
    This is an old technique so you will struggle to get the desired results but worth you having a look for "creating bmp icons with transparency" online.

  • How to save ALV data into DB after Editing values in WDA

    Hi All,
    I have created a WD application with and able to successfully make columns editable in ALV. But I failed when trying to save the edited data in database.
    I use ON_CELL_ACTION event but its not working as of now. I go through few blocks but ultimately i got confused. Please guide me in correct way.

    Hi Sanjib,
    ON_DATA_CHECK  event is triggered every time when you change the data in table
    For this event, you have to implement an Event Handler method in which the logic is written.
    There is already a thread where this question has been answered:
    ALV Edit how to save changes to DB??
    I would suggest that you search more on scn before starting a discussion
    Regards,
    Ashvin

  • How to Save SQL query template as a text file

    Hi,
    How to save a SQL query template in my server as a Text file?? I tried using Text saver but it is not getting saved in the path specified.
    Sweety

    Hi Sweety,
    In the transaction editor (for business logic), add your query template to a transaction.  Add a Tracer after and link the Query property of the SQL Query action block to the Message property of the transaction.  Run the transaction and you will see your Action Block's sql script as the message from the Tracer.  You can do the same with the Server property, SD and ED, etc.
    Also if you wish to dynamically load the sql script into the query, you can do that at run time by linking a script source to the query property.  Useful to have if you have to use a complex expression to dynamically create your script.  This sometimes occurs when you have multiple filtering inputs from a webpage and you can reduce the number of tables in a complex join when the fields are left empty.  Normally this would be done as a way to improve the performance of the query.
    Hopefully this is clear.  If not I can probably provide some sample expressions.
    Regards,
    Mike

  • How to save multi channel data in a same file?

    hi... i'm a fresh guy of labVIEW programming... what i wish to know is how to save multi channel in a same file? i had try with the AI acquire waveform, but it still can't get what i need. Because AI acquire waveform need user key in those channel with ","... but ehat i want is user can choose the channel from a combo box and then once user click a 'add' button then the value will store in memory, after user click done then the value can send to AI acquire waveform together...
    i had tried hard about this but still can't get what i want.... -_-|
    hope anyone can reply as soon as possible...

    HI, Brett B... thanks for your reply
    I'm using labVIEW 7.1 Express... i know the "Write LabVIEW Measurement File.vi" too, but it cannot support the file tpe that i need... so i just can find other way to do that...
    the file type that i need is call *.log\*.DAT... so... there got any solution to do that? or i can modified the "Write LabVIEW Measurement File.vi"?
    Jaxx

  • How to save the Icon  to database or .ico file?

    hi
    I get Icon instance by using
    Icon myIcon= FileSystemView.getFileSystemView().getSystemIcon(new File("J:/Program Files/XPSTool/XPSTool.exe"))
    but I not know how to save the myIcon to the database or a .ico file ;
    please help me !!!!!!!
    thanks vey much .

    Doublepost: http://forum.java.sun.com/thread.jspa?threadID=790795

  • How to save pl/sql program unit in a file

    Could anyone please let me know how to save a pl/sql program in a program file. As per my knowledge Edit command is used to invoke the editor and save the program. But i am unable to use this command properly. I am using Oracle 10g on Linux

    One can edit SQL scripts and the command buffer (the last command entered) with the EDIT (or ED) command. However, sometimes one needs to select an editor before using this command. Examples:
    Use the Unix/Linux vi-editor:
    DEFINE _EDITOR=vi
    Use the Notepad on Windows:
    DEFINE _EDITOR=notepad
    PS: Add this command in your login.sql or glogin.sql scripts so it executes every time you start sqlplus.
    Does that answers your question?

  • Loading bitmap (.BMP) files

    I am writing a sort of Image Viewers with Flex 2 - loading
    and displaying image files resided in local disk.
    Using mx.controls.Image class, I could load and display the
    JPG / GIF / PNG files at runtime.
    But I could not do the BMP files with the Image class (or
    control); what I get is only broken-image icon.
    Still I don't understand why the BMP format files are not
    included in the "Bitmap object".
    How can I load / display BMP files in Flex 2 MXML
    application?
    Thanks in Advance,
    Joseph

    Hi,
    I have tried the loader.unload(); method and now I get this
    following error:
    TypeError: Error #1009: Cannot access a property or method of
    a null object reference.
    at loadCorrect_fla::MainTimeline/clip1()
    I am obviously missing the point here, but how am I doing
    this wrong?
    Kind Regards,
    Boxing Boom

  • How to save an image into the RTF Viewer

    RTF Viewer.
    The current problem that I have with the RTFViewer is that the RTFEditor allows for images to be inserted but on save the images get lost and no information on the images are saved.

    daregazi wrote:
    I have posted my problem before, nobody replied so I ask again if anybody has any solution??
    I want to save an image, which I created before from a physical file and did some bit-level manipulation, into the same or a new (doesn't matter) physical file (say in png format). But I do not know how to do it. I have tried the FileConnection API and OutputStream and then the method write() to write the byte array, rather this does not solve my problem. I need something like corresponding to J2SE ImageIO.write(image,null) function. Any Idea??
    please.....I don't think it's possible in a midlet. You'll have to save the data as a byte[] to a RecordStore and then convert it back again if you want the midlet to redisplay it.

Maybe you are looking for

  • Hp vista and officejet j4680 all in one problems since windows 8

    i have an hp officejet j4580 all-in-one and have not been able to use it since installing  window 8 and now my entire desk top options has disappeared, i have to go to an email and attach a file to see my documents..help

  • How do i get my iPhone playlist on my imac

    how do i get my iPhone playlist on my imac

  • Link in flash mvoie

    Hi, I'm pretty crap at flash and i have what is probably a simple question. I want to create a link for one layer of a flash animation, for multiple frames. How do i do thi? Thanks a lot. Olly

  • How is it possible to create a subcontracting P.O. without components?

    I have seen in our systema a P.O with item category = L and account assingnement category = P and no component in components button. How is that possible? I´m not able to do it myself. Where are the PO positions´components stored in the database? I w

  • Authentication from SiteStudio Page

    Hi, I'm building a website with sitestudio which has a login piece. When the user hits the login button, he has to be authenticated against the username and password stored in the ucm server. Is there a UCM authentication service that can be used fro