FileNotFound returned by Bitmap::Save() when saving to stream

I have a little chunk of code which is supposed to take a bitmap image and 
save its PNG encoding into a block of memory. The problem is, I keep getting 
a FileNotFound error back from Save(). If anyone has any ideas, I'd love to 
hear them.

Here's the code (more or less) in question; there really shouldn't be much 
to it, I would have thought:

/*
Allocate an IStream object to write the data into a global
memory block. We indicate that the handle to the underlying data
will be freed when the stream object is released.
*/
VERIFY(S_OK == ::CreateStreamOnHGlobal(nil, True, 
static_cast<LPSTREAM*>(&pStream)));
		 
/*
Copy the old bitmap into a new preview bitmap, which we will
then use to encode the image data.
*/
Bitmap* preview = new Bitmap(pvBounds.Width, pvBounds.Height, 
PixelFormat32bppARGB);
ASSERT(nil != preview);

result = Graphics(preview).DrawImage(offWorld, pvBounds);
ASSERT_OK(result);

/*
Specify the codec to be used to encode the image data, along with
any required codec parameters, and save the image to the stream.
*/
codecID = ImageFormatPNG;
codecParams.Count = 0;

result = preview->Save(pStream, &codecID, &codecParams);
ASSERT_OK(result);

0
Nomad (31)
7/23/2007 11:12:02 AM
vc.mfc 33608 articles. 0 followers. Follow

1 Replies
1307 Views

Similar Articles

[PageSpeed] 21

Okay, never mind. I just realised that 'ImageFormatPNG' is not the codec ID. 
Problem solved.
0
Nomad (31)
7/23/2007 12:16:02 PM
Reply:

Similar Artilces:

returns management #4
I am looking to install returns management and depot management (V9). Ans therefore looking for some honest advice as to whether it is really worth implementing, rather than survive with the returns function in sales management. any comments good or bad would be appreciated. Thanks. We're struggling with the standard sales returns functionality as well. We've looked into returns management and would love to have it but can't justify the cost for our environment. It would be a great add though to be able to have real RMA functionality and an actual receipt process on retu...

Hash Table not being returned properly
Hi, I have an issue where I am trying to return the contents of a hash table from a function into my script. I am using two functions: The main function which scans the ips and then calls the second function which queries the registry and builds a hash table which then is supposed to be used in the original function to generate a report. When I run the QueryRegistry function, it returns the hash table as normally expected. But when I run the ScanIPs function, the hashtable is not returned properly. See examples below: PS C:\users\PROXB\Downloads> scanips -ip 143.250.161.232...

Limiting Returns
I think it should be automatic to prevent a customer from returning an item more than once. Yet I can't seem to find a configuration that prevents returning items on a given receipt over and over again. Is this a configuration issue or a weakness in RMS? If configuration, please help me find the key. While on the subject of returns, selecting Recall\recall a transaction for return shows a date range pop-up as the next step. Can I control the date range to be something other than the default of "today to today?" Thanks! -- Greg Staples Automated Options, Inc. Spoka...

Look & return values, in cells with numbers & words
Hello I have a problem in a table that has words and numbers: ex.-> Puxador 3584.251 Jkf I want that it reads only the 3 last numbers and returns to onother cell the designation: ex.-> Puxador 3584.251 Jkf &( Designation i read and recognize as 251) How can i do this? Thanks in advance Hi If the three numbers you are wanting are always preceeded by the only full stop (period) in the cell you could use: =MID(B10,FIND(".",B10)+1,3) to return them. It really depends on if your cells are uniform in content. -- Andy. "Micos3" <Micos3@discussions.microsoft.co...

return Subform Name on Tab control
all, a little background i was using Screen.ActiveForm![Firm_ID], in a function to use as a query criteria, now all my [Firm_ID]s, are on tabbed subforms. my quick fix was have a txt1= [subformname].Form![Firm_ID], but the subform name could be one of 7, so i am tring to figure out how to capture the name of the current subform based on the tab page the user is on or the current records Firm_ID. i looked around and have been playing with: Dim ctl As control s = Screen.ActiveForm.Name For Each ctl In Forms(s).Controls If ctl.ControlType = acSubform Then ...

Error: WhoAmI () return 'Access Denied'
Hi, I am using VPN to connect to the CRM server. How can I set the correct credentials when my development machine is completely separated from the CRM server? When using an example code I get "The request failed with HTTP status 401: Access Denied." strDir ="http://192.168.16.430/MSCRMServices/" // BizUser proxy object Microsoft.CRM.Proxy.BizUser objUser = new Microsoft.CRM.Proxy.BizUser(); objUser.Url = strDir + "BizUser.srf"; objUser.Credentials = System.Net.CredentialCache.DefaultCredentials; //************************* objQuery.Credentials = System.Net.Crede...

Purchase Returns
We were able to use Purchase Returns, specially the screens, RETURNS TRx ENTRY, and also RETURNS BATCHES but recently when we try to access the Purchase Returns Screen/forms, we get the following error >Microsoft Great Plains Dynamics >------------------------------- > >Unhandled form exception: >Dictionary not loaded > > > >EXCEPTION_CLASS_FORM_MISSING >SCRIPT_CMD_FORMDICT we are using GreatPlains v7, with Pervasive SQL 2000. I actually dont know why this is ahppening, anyone knows how to rectify this error. I was just wondering is it necessary to have Ret...

YTD Return Calculation
I cannot get the YTD return to calculate. For example, if I take Citibank and let's say I have one share and yesterday closing price is $46.34 and the price on Decemeber 31 was $48.54. So my thought process is: (($46.34 * 1 share) - ($48.54*1 share)) = - $2.20 Divided by ( $48.54) = 48.54 Answer -4.53% return but for file says -3.13% Any clues ...

FileNotFound returned by Bitmap::Save() when saving to stream
I have a little chunk of code which is supposed to take a bitmap image and save its PNG encoding into a block of memory. The problem is, I keep getting a FileNotFound error back from Save(). If anyone has any ideas, I'd love to hear them. Here's the code (more or less) in question; there really shouldn't be much to it, I would have thought: /* Allocate an IStream object to write the data into a global memory block. We indicate that the handle to the underlying data will be freed when the stream object is released. */ VERIFY(S_OK == ::CreateStreamOnHGlobal(nil, True, static_c...

Handling of savings accounts and 401k accounts in the budget
I noticed that Money treats money that I contribute to a 401k account or transfer to a savings account as an expense. Basically, the more I contribute, the worse my budget looks. Is there a way to prevent this from happening? Right now, I exclude transfers to my savings account from the budget and it solves the problem, however, I shouldn't have to manually do this each time. For 401k contributions, I cannot find a way to do this. Why does it show up as "an expense" (what Category???) instead of something like Transfer Out of Budget Accounts? The 401k cash account sh...

Return Value from Match and Double Lookup
Hello, I have 3 rows of information in one tab (temp): Question_ID, Respondent_ID, Answer_Value. I have a second tab (Detailed Report): Respondent ID (row) and Question ID (column). I would like to match the Respondent ID and Question ID in the Detailed Report tab with the Respondent_ID and Question_ID in the temp tab, returning the value of Answer_Value from the temp tab to the corresponding empty cell in the Detailed Report tab. Not all combinations in the Detailed Report tab will match in the temp tab (there are more combinations possible in the Detailed Report Tab than in the temp t...

Save? prompt when closing Excel
Over the last couple of days, I've lost changes to some excel files because it is no longer asking me if I want to save the changesI think it used to) when I close the workbook. This isn't the same as AutoSave. What might I have inadvertentely changed. I've never seen excel not ask when it thought the workbook was changed. (A developer could hide this question with a small macro--could that have happened?) My first guess is you really saved your data--but you saved it to a different location. Any chance???? lh wrote: > > Over the last couple of days, I've lost c...

Weekly Returns
i'm doing a project in my finance class and i need to do the weekly return of the closing price of the companies stock for 15 weeks. Is there a function for this, and if not does anybody know how i can calculate the weekly return If you bought something for $100, and one week later sold it for $110, what's your return on investment? Hopefully, you were able to answer instantly that it's 10%. If not, maybe finance is not for you. It's the same with returns on a stock price. The return on investment is always: =(EndingValue - BeginningValue) / BeginningValue Ho...

Returning to Windows 7
Hello, I recenlty purchased two laptops for a client installed with Windows 7 in XP mode. Can these be switched to Windows 7 and how. Thank you and God Bless, Mark A. Sam Mark A. Sam wrote: > I recenlty purchased two laptops for a client installed with Windows 7 in > XP mode. Can these be switched to Windows 7 and how. You are actually some guru for this "client" and yet you think Windows 7 itself is running under XP mode? Do some research. I pity your clients. Those laptops already have Windows 7 whether or not XP mode was installed. Hi Ma...

Save Changes question?
I have a form with 2 subforms. Our construction managers will be able to edit or add new projects. I have allowed for edits and additions in properties. Will that information automatically be saved? If not, what do I do to make that happen? Thanks so much!!! "Golfinray" <Golfinray@discussions.microsoft.com> wrote in message news:65D974EA-C044-4118-8AB4-E1031DEA272A@microsoft.com... >I have a form with 2 subforms. Our construction managers will be able to >edit > or add new projects. I have allowed for edits and additions in properties. > Will that information ...

Returning the last value in a row
Hi What formula do I need to return the last known value in a row? ie. ROW 1 contains 5 values in COL a,b,c,d and e ROW 2 contains 2 values in COL a, b is empty,c,d is empty, e is empty How can I return the last value in each respective ROW (COL e and COL c)? I think I need something to jump from one colum to the next and stopping when it finds a value but still continues to the end of the specific amount of columns just in case there is another value Hope I explained this well Hi if you have no blank columns in between use something like =OFFSET($A$1,0,COUNTA(1:1)-1) for row 1 ...

Saved *.csv file gives SYLK file type warning upon Excel 2003 open
I've created a *.csv file "MyOutput.csv" that has about 2000 rows and 15 columns of text data from an application. When browsing via Windows Explorer to the file off the root of C:\ and double-clicking, I get a message that says: "Excel has detected that the 'MyOutput.csv' is a SYLK file, but cannot load it. Either the file has errorsa or it is not a SYLK file. Click OK to try to openn the file in a different format." Upon clicking on OK, the MyOutput.csv file loads finei into Excel 2003. I just need to re-adjust the column widths. What's causing t...

aol emails returned undelivered
Hi, When I send an email to an AOL address within my outlook address book it is returned undelivered with this message : Diagnostic-Code: smtp;554-: (HTM:B1) AOL has received many member complaints regarding the?? sender of this email and/or the email content itself.?? AOL will no longer accept email from this sender. 554 TRANSACTION FAILED I have been assured that my emails have not been barred fromt he reciprients and I have run my anti virus just to make sure there is nothing on my pc. Iam running norton firewall too and a spychecker programme. the problems only started this week...

timer to save query results to file
Hi, I'm trying to run timer every morning to save query results to a file. How can I run the query so that I can automatically save the query results and save it with format <query_name>date? Results will be saved to excel. Br, Miikka Modify the query before you run it, Private Sub test() Dim qry As QueryDef Dim db As Database Dim strSQL As String Set db = CurrentDb Set qry = db.QueryDefs("query1") strSQL = "SELECT tblLevels.Level, tblLevels.LevelDesc, tblLevels.LeveNotes, tblLevels.Passed INTO query1" & DatePart("m", Date) & _ DatePart...

Cannot Do Return
GP 10.0 with Returns Mgmt. Here is the scenario: Material was ordered on PO, a receipt was done on for the material. The material was transferred to another site for inspection at which point it was determined that it needed to be returned. The problem is that I cannot do a return on that receipt because instead of transferring the items in GP the user did an adjustment deducting the inventory from one site and a separate adjustment adding the inventory to the other site. SO now when we go to do a return we enter the PO number, the item on the PO and it won't let us enter the ...

Terminating Application using ShellExecute return value
I use MFC Visual C++ 4.2. I have a Main application that runs Child application using ShellExecute. When the Main application terminated, the Child application will also be terminated. I have tried to use the TerminateProcess but I think that's rather rough so I thought of if I can use the ShellExecute return value to terminate the process it ran. Is this possible? If it is not, what application terminate method that is safe? Thank you very much. On Dec 22, 12:08=A0pm, Landon <Lan...@discussions.microsoft.com> wrote: > I use MFC Visual C++ 4.2. > > I have a Main a...

Return-Path Header
Can this be shown in the Internet Headers of Exch 5.5 Server clients ? If so how can it be enabled ? When you say Exch 5.5 server clients, you mean Outlook? View > Options will display this header. -tom ---- "RichieRich" <anonymous@discussions.microsoft.com> wrote in message news:D6BB585F-805C-456C-BB64-68D5F3B1ECA4@microsoft.com... > Can this be shown in the Internet Headers of Exch 5.5 Server clients ? If so how can it be enabled ? That information is inserted by sending side (it's mail client), Exchange does not control that. RichieRich wrote: > Yes it...

Return range from row number
Hi I have a table from which I need to find specific values based on the rows they reside in. I need to search the (n)th row to return the column number where a specific number (x) is located. Top row of table is G29:CZ29 A1=value to match (x) from another worksheet A2=row to search (n) from another calculation Is there any way to achieve this by converting the known row and its endpoints into a "range" to be inserted in the MATCH function? MATCH(A1,"range",0) e.g. if A2=93, the "range" I need to search is G122:CZ122 Thanks in advance Andy One way: ...

Messaging Interface has returned an unknown error
I am getting the following message when clicking on Sent Items in Office 2007: The Messaging Interface has returned an unknown error. If the problem persists , restart outlook. I have restarted outlook hundreds of times but it is still the same. Email still appears to work OK, it's just the sent items. Has anyone got any ideas. Try resetting you view on the folder; View-> Arrange By-> Custom...-> Reset Current View -- Robert Sparnaaij [MVP-Outlook] Coauthor, Configuring Microsoft Outlook 2003 http://www.howto-outlook.com/ Outlook FAQ, HowTo, Downloads, Add-Ins and...

saving module
It seems that MS Access run all queries in the database when developer saves VBA file. Please let me know if I am wrong. It takes more than 5 minutes to save my module even only one line of code changed. If I do not save the module then I will lost my code if the code failed. I just wonder even I use unbound controls that MS Access still running all queries when developer save module or form design. Are there any workaround for this issue? Your help is great appreciated, > It seems that MS Access run all queries in the database when developer > saves VBA file. ...