Visual C++ :: How To Save Bitmap To File

May 19, 2014

I have this code, where I capture window and make copy to bitmap of it. I am working on rotation of bitmap. But my problem is that when I save the image to file the result is just a black screen. It looks like there could be some problem either in GdipCreateBitmapFromHBITMAP() or GdipGetImageGraphicsContext()

How to fix it and to get the rotated image?

Code:
// CODE 81 and 82 de facto no difference
#defineCODE85 // 81
#defineWINDOW_MIN_HEIGHT200

[Code].....

View 14 Replies


ADVERTISEMENT

Visual C++ :: Unable To Save File Using Cfiledialog Save As In MFC

Nov 5, 2013

I am trying to develop a GUI using MFC, but I am having trouble using CFiledialog to save a file. The problem is, the file is not getting saved to the folder when I use the CFiledialog. Below is the code I am using.

Code:

CString szFilter = "XNRep Files (*.xnrep)|*.xnrep||";
CString s = "xnrep";
CString t = "";
CFileDialog fileDlg(FALSE, s, t, NULL, szFilter);
if(fileDlg.DoModal() == IDOK)
{
std::ofstream file;

[Code]....

After the file dialog opens up, I enter the name of the file and select OK button. But the file does not show up in the directory I am saving to.

View 4 Replies View Related

Visual C++ :: Getting Name Of Current Save File?

Oct 10, 2014

When I have loaded a savefile with Serialize, is there some way of telling the name of the currently loaded savefile?

View 2 Replies View Related

Visual C++ :: How To Determine Cross Platform Type During File Save

Nov 10, 2014

I am overriding OnSaveDocument in my MFC document class to strip out the carriage returns when saving my app's document to a UNIX file system but not when the user is saving a file to a Windows file system.

Is there a way to determine if the lpszPathName in OnSaveDocument(LPCTSTR lpszPathName) is a UNIX or Windows file system?

Note, I want to avoid hard coding server names and I want to avoid overriding the FileSave dialog and forcing the user to select Windows or UNIX.

View 6 Replies View Related

Visual C++ :: Loading Bitmap In Particular Way?

May 25, 2013

I have a function that essentially takes a screen shot and saves a pointer to it as a structure. I would like to use the same structure for bitmaps that I load from files.

Code:
typedef struct _BITMAPCAPTURE {
HBITMAP hbm;
LPDWORD pixels;
INT width;
INT height;
} BITMAPCAPTURE;
BOOL CaptureScreen(BITMAPCAPTURE* bmpCapture) {

[code].....

The handle to the bitmap, as well as the width and height are all easy enough to get but I'm unsure of how to get the pixels.

View 2 Replies View Related

Visual C++ :: Use Bitmap On Button Instead Of Text

Dec 15, 2013

I'm trying to create a dialog where some of the buttons have pictures on them, rather than plain text. I notice that under the button's properties, under the "styles" tab there's a checkbox "bitmap". I can't seem to find any easy way of setting a bitmap.

View 4 Replies View Related

Visual C++ :: Slow Performances Using Bitmap / GDI

Apr 17, 2014

I am trying to do this:

while(1)
{
CaptureScreenshot (as BMP)
Convert screenshot to 24 bit instead of 32 bit
Resize screenshot size
Get the BMP bits array of the resized screenshot
}

I have it working but the best i could get is 18 iteration (screenshots) per second. This is what i do:

Code:
Start() {
ULONG_PTR gdiplusToken=0;
HDC mhCompatibleDC;
HBITMAP mhCompatibleBitmap;
HWND mhDesktopWnd;
HDC mhDesktopDC;
byte*piRGB=new byte[1200*900*3]

[Code] .....

Here i do things with piRGB but these things are not counted it the timer so you can assume here the code ends . As said as the code looks now, i can fill piRGB ~18 times (18loops) in 1 second. I must improve that...

View 14 Replies View Related

Visual C++ :: Drawing Text On A Bitmap?

Oct 5, 2012

I wrote a simple clock that shows the time over bitmap as follows:

Code:
void CMyClock::OnPaint()
{
CRect rect;
GetClientRect(&rect);

[Code]....

Now I got rid off the white border but everytime I draw a text it write on top of the previous text so after few seconds everything is a mess and the time is no longer readable.

View 5 Replies View Related

Visual C++ :: SDI CView Covered With Bitmap Resource?

Feb 10, 2013

I have an SDI / CView app (VS 2010). All works well until I minimize the app using the minimize button or drag it partially off of the screen. In the former instance, any attempt to restore the app results in an appcrash with a tight freeze up of the machine. In the later instance the same happens immediately.

In building the app, I scoured the web for code to accomplish the loading and display of the bitmap. After some experimentation I settled on overriding the OnPaint. Below is the code. Note that m_Map is a CBitmap member and IDB_BITMAP1 is a loaded bitmap resource.

Code:

void CMyDragViewView::OnPaint()
{
// CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
// Do not call CView::OnPaint() for painting messages
// http://msgroups.net/microsoft.public.vc.mfc/loading-bitmaps-into-main-window/563285
int x = m_Map.LoadBitmap(IDB_BITMAP1);
TRACE1(" x = %d
", x);
CPaintDC* dc = new CPaintDC(this);

[code]....

I suspect that the problem is OnPaint trying to repaint the bitmap which requires reloading it, but I don't know how to work around this.

View 3 Replies View Related

Visual C++ :: Draw Grid Over Bitmap In Scrollview

Jul 5, 2013

I have a CScrollView that displays a bitmap and I'm trying to draw a grid that I can turn off and on by check box and when the mouse is over a section of the grid that square highlights... I do all the drawing in the ondraw function... But when I have many grid squares it becomes slow to scroll and to highlight the square the mouse is over... I'm not sure the best way to go about this and where to place code to speed it up... The bitmap is only loaded once... But in ondraw the grid has to redraw every time scrolled and when mouse moved over a square.. In onmousemove I call invalidate so the square under mouse changes...

View 5 Replies View Related

Visual C++ :: Using 2D Array - Displaying Bitmap Image With Scrolling

Mar 11, 2014

My requirement is,

Read *.bmp image and displaying bitmap image with scrollbar in a MFC dialog application.

I was done using this

I was read the *.bmp image as a pixel data and stored by 2D Array,

Now i want to Display this 2D array as bitmap image with scrollbar separately in the same dialog. How can i display bitmap with scrollbar using 2D array?

View 10 Replies View Related

Visual C++ :: Bitmap Display From Buffer Received By TCP Socket

Feb 6, 2013

I want to display my image on window without saving it.

When data is received window size changes but there is no display on window.

My Code is:

Code:

int iBufferLength;
int iEnd;
int iSpaceRemaining;
int i;
iBufferLength = iSpaceRemaining = sizeof(chIncomingDataBuffer);
iEnd = 0;
iSpaceRemaining -= iEnd;

[code].....

where I'm doing wrong?

View 1 Replies View Related

Visual C++ :: Analyze Bitmap - Concept For Saving Data

May 18, 2014

I would like to create program which will analyse bitmap so would need good concept to save data. I am interested about the theory and I realize that i must to think this carefully because bad concept could create insufficient memory or inefficient program. Basically I want my program work with HSV or HSL model so I would need to convert the bitmap to HSL, but I am not sure if I should convert it first and then analyse all pixels or should I start to analyse the bitmap and make the conversion to HSL during it. But my main question is what method to choose to save the data in memory.

Even that I would start with very small, it should work also with bigger image like image having 1200 or even 4200 px on height. So the program should first analyse all columns of pixels in the image so for example 1200x800 px image has 1200 columns. So I would like to know if is it possible to create such object which would have such structure like this

Obj->basicColumnData->black->columns[name]->group

and in the place of columns should be placed data for every column. I would look for groups of pixels in the column, so in the result the column x could bear e.g. 500 groups of information and every group should contain the range of pixels e.g. group 1 should contain y value from 0 to 20, group 2 should contain value from 25-27 and so on. So I would create 1200 columns bear many of groups. This would be contained in "black" or "white" member to contain the data. This is just simplified idea, but the whole object should contain next data not just basicColumnData... So there should be another members bearing information calculated from the selected data.

So my question is what kind of method of saving data use for this? Should I use heap and dynamic allocated memory or should I create custom class, which will define every member, but these members will have to be dynamic memory? With the dynamic memory is there problem that there could be not enough memory to create such big object?

View 5 Replies View Related

C/C++ :: Writing A Code For Bitmap File Format

Mar 9, 2014

I wanna write a piece of code in C++ that extract the width and height of a image with bmp file format...

View 2 Replies View Related

Visual C++ :: Line Graph Using Single Line Values From Bitmap

Feb 3, 2014

I was loaded a bmp file in my mfc window and stored rgb data in a file.My image size is 320x240.

Is possible to pick a single point (location) from that bmp image (Not the whole window)?

i like to plot a line graph using the pointed single line data using the stored file data?

here R is X Axis and G & B is Y Axis.

If i have 2D array of data means how can i plot the line graph?

View 4 Replies View Related

Visual C++ :: Getting Rid Of (Save Changes To Untitled)?

Oct 10, 2013

I have tried everything I can think of to get rid of the 'Save changes to Untitled?' message box that appears every time my SDI split app tries to load a new file. The problem is that the message appears inappropriately, both when no previous document has been loaded or should exist, and even after File / New has been envoked. I have attached a small demo program to demo the problem. Inspecting the SpVwTrDoc.cpp NewDocument and OnOpenDocument, and elsewhere, you will see that using SetModifiedFlag(FALSE); has no effect.

View 10 Replies View Related

Visual C++ :: Save CDocument Programmatically

Feb 21, 2014

How can I save an CDocument programatically, without to bring him to the top, only if I get a pointer to that document ? I mean if I have several document opened into a MDI app, and if I have a pointer to one of them, to save it without to turn them as active childs ?

View 3 Replies View Related

C Sharp :: Data Save But 2nd Record Doesn't Save

Jan 28, 2015

1st when i fill the things on form then saved in database after saving record when i want add another record it shows an error. after saving it saves new record refresh doesn't work

View 1 Replies View Related

C++ :: How To Save File Directory To Text File Using Ofstream

Jul 22, 2013

I'm having a little problem with std:fstream - in my program, the user selects the location of a file which I want to remember. So, I have something like this:

Code: std::string fileLocation;
//Code here creates an 'open file' dialog box which lets the user choose which file to open.
//The string 'fileLocation' now contains the path to the chosen file.
std::ofstream prefs("prefs.txt");
if (prefs.is_open())
{
prefs << fileLocation;
prefs.close();
}

This works fine if the file chosen is in the same directory as the program, however, if they try to choose a directory outside of where the program is kept, it saves the text file into that directory instead of the same one as the program. So, it looks like outputting a directory into an ofstream actually changes the location to which the file is saved.

Is there a way to save the file directory to a text file using ofstream and still have the text file save in the same directory as the program?

View 5 Replies View Related

C++ :: Create Save File For A Game That Is Not A Separate File?

Oct 10, 2014

How do you create a save file for a game, that is not a separate file? Specifically I am using code::blocks and sfml 2.1 to make a game and it saves to a text file at the moment. My problem is that it is very easy to modify the text file, and it is annoying to have to copy and paste several files if you want to use a copy of the game. I have a feeling that it may be to do with resource files, but I'm not exactly sure how to get these to work or whether you can modify them dynamically.

View 6 Replies View Related

C++ :: How To Save Struct To File And Then Read It Back From The File

Aug 5, 2013

How to save the struct to file and then read it back from the file ?

Code:
#include <conio.h>
#include <stdio.h>
struct student {
int person;
int egn;
float AvergeGrade;

[Code] ....

Have average grade: %f", person[i].FirstName, person[i].LastName, person[i].egn, person[i].AvergeGrade);
}
//Save to file
getch ();
}

View 2 Replies View Related

C++ :: How To Save Data To File

Sep 28, 2013

what are the codes that will save the data then it will appear in a file (.txt).

I typed the name "SpongeBob SquarePants"

SpongeBob SquarePants

View 5 Replies View Related

C++ :: Save Class Into A File?

Jan 12, 2013

I am creating a program using the inheritance. The superclass is person and subclass is employee,manager etc. I will prompt the user to choose which subclass he want to save the record to but i dont know how to write and display the record of different subclass to and from a txt file.

View 4 Replies View Related

Visual C++ :: Puzzle Game - Implement A Way To Save Board State Throughout User Inputted Path

Mar 16, 2013

I've been trying to figure out how to implement a way to save this board state throughout a user's inputted path. At the end, I need the output to print out the board states (user's path) of how he or she got the puzzle solved. This puzzle is the 15 Puzzle; but we have it to change by the user's input on what size they want to play (3x3 to 5x5). How to save the board state of each user input, then print those out in order from beginning to solved puzzle state. Subsequently, I would also need transferring the board state to change with using a vector to store the size based on user input. How to proceed, using a first search to solve the puzzle from the current board's state.

calculations.h

Code:
/*Calculations set as a header to keep compiling simple and faster*/

#ifndef calculations
#define calculations
int solved[5][5];
void initialize(int board[][5], int);
void slide(int board[][5],int move,int);
bool isBoardSolved(int board[][5],int);

[Code] .....

View 6 Replies View Related

C :: Fprintf Does Not Save String To File

Jan 3, 2014

Code:

struct sth {
char* str;
} pt;
}
[code]...

fprintf does not save string to file. How can I put structure into list?

View 9 Replies View Related

C++ :: How To Save Two Arrays Into One Text File

May 11, 2013

I have a 4*4 array and a 8*8 arays in my c++ program and i would like to save those arrays in one textfile. How do i do that.

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved