|
What does GetBitmapAsText(); do, are you sure it is returning the correct data?
|
|
|
|
|
Please don't bother about GetBitmapAsText(); because it only exists in the demo project in order to replace the complex algorithm and database infrastructure in the real project and make the problem portable. The correct loading of picture data from DB can be assumed because the problem is not that the picture can't be seen at all but that it can only be seen in certain circumstances.
|
|
|
|
|
APSAccounts wrote: complex algorithm and database infrastructure To load an icon?
APSAccounts wrote: is not that the picture can't be seen at all but that it can only be seen in certain circumstances. Well apart from the fact that it happens on some systems but not on some others, we have no real information to go on.
|
|
|
|
|
The demo project gives you the function GetBitmapAsText(); which constantly and reliably delivers the same picture because it always returns a hardcoded string of base64-encoded picture data. Despite of this fact and despite of the constant algorithm for the presentation the presentation of the picture differs depending on the system. Therefore, for me the reason for the problem is situated somewhere in the interaction of the presentation algorithm with the specific system.
The only bridge I could build for you in order to make the picture data more transparent, would be to get rid of the base64 encoding and hardcode the picture data directly into picInBytes (BYTE*) as it is consumed by the API function CreateBitmap. But would it really help?
The only reason for checking the picutre data once again would be for me the knowledge of a limitation saying that CreateBitmap needs the data on different systems in different forms...
|
|
|
|
|
APSAccounts wrote: the knowledge of a limitation saying that CreateBitmap needs the data on different systems in different forms... That is most unlikely, as it would affect half the systems across the world. You could always check that by looking at the documentation.
|
|
|
|
|
Well, we have to distinguish between published knowledge, unpublished/internal one and achieved by experience one. Writing here we primarly hope to find the third kind... but the first two kinds are welcome, too, of course.
|
|
|
|
|
I know the functions you use to get the current working directory in the control, but how do you get a list of selected files from it?
I can't find any examples of this.
|
|
|
|
|
You've been given a good answer to this immediately below. Why did you post it again?
EDIT:
Never mind, I see that you reposted this before Richard MacCutchan's response. It was probably a mistake.
The difficult we do right away...
...the impossible takes slightly longer.
modified 22-Jul-14 14:56pm.
|
|
|
|
|
|
I have found the functions that you use to obtain the current working directory in the control, but how do you get a list of selected files (or other objects) from it.
I have not been able to find an example any where thus far.
Can you point me in the direction of such a code example?
|
|
|
|
|
You need to look up the inheritance chain to see what features are made available through its parent classes. The ClistCtrl[^] class provides what you are looking for.
|
|
|
|
|
Error 1 error C2504:
In the source file I have included the MyDialog.h above the header file containing the class definition for CEasyWebStoreUploaderDlg but I can't pi$$ this compiler error off and I don't understand why.
Can any one help me?
#include "stdafx.h";
#include "INI.h"
#include <afxinet.h>
#include <afxcmn.h>
#include "MyDialog.h"
//#include "ServerDialog.h"
//#include "ImageDialog.h"
#include "EasyWebStoreUploaderDlg.h"
#include "EasyWebStoreUploader.h"
Header file
/ EasyWebStoreUploaderDlg.h : header file
#pragma once
class CEasyWebStoreUploaderDlg : public CMyDialog
{
public:
CEasyWebStoreUploaderDlg(CWnd* pParent = NULL);
~CEasyWebStoreUploaderDlg();
enum { IDD = IDD_EASYWEBSTOREUPLOADER_DIALOG };
protected:
virtual void DoDataExchange(CDataExchange* pDX);
protected:
HICON m_hIcon;
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnClickConnect();
afx_msg void OnClickUploadAll();
afx_msg void OnChangeTab(NMHDR *pNMHDR, LRESULT *pResult);
CTabCtrl m_tabCtrl;
};
Source file
#include "stdafx.h"
#include "INI.h"
#include <afxinet.h>
#include "afxcmn.h"
#include "MyDialog.h"
#include "EasyWebStoreUploaderDlg.h"
#include "EasyWebStoreUploader.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
class CAboutDlg : public CDialogEx
{
public:
CAboutDlg();
enum { IDD = IDD_ABOUTBOX };
protected:
virtual void DoDataExchange(CDataExchange* pDX);
protected:
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialogEx(CAboutDlg::IDD)
{
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEx)
END_MESSAGE_MAP()
CEasyWebStoreUploaderDlg::CEasyWebStoreUploaderDlg(CWnd* pParent )
: CMyDialog(CEasyWebStoreUploaderDlg::IDD, pParent)
{
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
|
|
|
|
|
You should include MyDialog.h in EasyWebStoreUploaderDlg.h and not in the source file. If you than still get the error, check the definition of CMyDialog in MyDialog.h.
|
|
|
|
|
It turned out that I was looking in the wrong file. The problem as the App definition file not the dialog defionition file.
|
|
|
|
|
It turned out that I was looking in the wrong file. The problem as the App definition file not the dialog definition file.
|
|
|
|
|
Hi all,
I Sreenivasa, new to embedded and I am writing a application that needs to re size an image(Jpeg format) and these are my requirements:
* C
* Keil as ide.
* Image format is JPEG to JPEG.
So for I tried with the open source code in the below link
http://code.google.com/p/picojpeg/
It works fine but it needs more than 32K of memory allocation, but my MCU is having only 32k of RAM.
Any help is appreciated.
thanks
Srini
|
|
|
|
|
From the very picojpeg page[^]:
Optimized for minimal memory consumption: Uses only ~2.3KB of work memory.
THESE PEOPLE REALLY BOTHER ME!! How can they know what you should do without knowing what you want done?!?!
-- C++ FQA Lite
|
|
|
|
|
Pallini,
They said the code memory consumption 2.3kb, not the code uses.
actually while resizing an image of 1MB file, it reduces the size by taking the first pixel of each 8x8 block, so for that they will allocate the size of >32 kb of memory.
thanks
srini
|
|
|
|
|
As far as I can understand you haven't to keep the whole image in RAM, have you?
THESE PEOPLE REALLY BOTHER ME!! How can they know what you should do without knowing what you want done?!?!
-- C++ FQA Lite
|
|
|
|
|
hi CPallini,
Actually for using malloc we need to allocate heap space in startup.s file, here its allowing only 1000k of memory and if I enter 2000k it will throw error as "there is no space in execution region", so when it try to access the memory at 35k it will show error, below is the code where it is getting stuck.
pImage = (uint8 *)malloc(row_pitch * decoded_height);// here the size of allocation is >32kb.
if (!pImage)
{
fclose(g_pInFile);
return NULL;
}
row_blocks_per_mcu = image_info.m_MCUWidth >> 3;
col_blocks_per_mcu = image_info.m_MCUHeight >> 3;
for ( ; ; )
{
int y, x;
uint8 *pDst_row;
status = pjpeg_decode_mcu();
if (status)
{
if (status != PJPG_NO_MORE_BLOCKS)
{
printf("pjpeg_decode_mcu() failed with status %u\n", status);
free(pImage);
fclose(g_pInFile);
return NULL;
}
break;
}
if (mcu_y >= image_info.m_MCUSPerCol)
{
free(pImage);
fclose(g_pInFile);
return NULL;
}
if (reduce)
{
// In reduce mode, only the first pixel of each 8x8 block is valid.
pDst_row = pImage + mcu_y * col_blocks_per_mcu * row_pitch + mcu_x * row_blocks_per_mcu * image_info.m_comps;
if (image_info.m_scanType == PJPG_GRAYSCALE)
{
*pDst_row = image_info.m_pMCUBufR[0];
}
else
{
uint y, x;
for (y = 0; y < col_blocks_per_mcu; y++)
{
uint src_ofs = (y * 128);
for (x = 0; x < row_blocks_per_mcu; x++)
{
pDst_row[0] = image_info.m_pMCUBufR[src_ofs]; // Here the error occurs.
pDst_row[1] = image_info.m_pMCUBufG[src_ofs];
pDst_row[2] = image_info.m_pMCUBufB[src_ofs];
pDst_row += 3;
src_ofs += 64;
}
pDst_row += row_pitch - 3 * row_blocks_per_mcu;
}
}
}
mcu_x++;
if (mcu_x == image_info.m_MCUSPerRow)
{
mcu_x = 0;
mcu_y++;
}
}
fclose(g_pInFile);
*x = decoded_width;
*y = decoded_height;
*comps = image_info.m_comps;
return pImage;
thanks
srini
|
|
|
|
|
Am I missing something?
The library author claims: "Written entirely in C, no reliance at all on the C run-time library (it includes no headers other than picojpeg.h), and does not use any dynamic memory allocation."
THESE PEOPLE REALLY BOTHER ME!! How can they know what you should do without knowing what you want done?!?!
-- C++ FQA Lite
|
|
|
|
|
Hi pallini,
I have used visual C++ 2008 express edition to execute the code and works fine, Since we are using Kiel as our IDE I did some minor changes.
Yes only one header file(picojpeg.h) and they have used malloc in jpg2tga.c file
|
|
|
|
|
Member 10833501 wrote: they have used malloc in jpg2tga.c file They? jpg2tga?
Quoting again 'them': picojpeg is a public domain JPEG decompressor written in plain C in a single source file picojpeg.c and a single header picojpeg.h"
and actually there is no malloc in picojpeg.c file.
THESE PEOPLE REALLY BOTHER ME!! How can they know what you should do without knowing what you want done?!?!
-- C++ FQA Lite
|
|
|
|
|
hi pallini,
Source package is having 2 source files
1) picojpeg.c and jpg2tga.c
For your reerence I am attaching the link again here
">http://code.google.com/p/picojpeg/"
thanks
srini
|
|
|
|
|
jpg2tga.cpp is not actually part of the library. It is an example program.
However, if you really need such a functionality you could try to modify the code (if possible) to fit your needs.
Another option could be using an external (serial) RAM.
THESE PEOPLE REALLY BOTHER ME!! How can they know what you should do without knowing what you want done?!?!
-- C++ FQA Lite
|
|
|
|