Click here to Skip to main content
15,884,933 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow get path of shortcut of internet explorer Pin
ashish8patil23-Apr-09 23:28
ashish8patil23-Apr-09 23:28 
AnswerRe: How get path of shortcut of internet explorer Pin
Sarath C24-Apr-09 2:37
Sarath C24-Apr-09 2:37 
GeneralRe: How get path of shortcut of internet explorer Pin
ashish8patil24-Apr-09 2:43
ashish8patil24-Apr-09 2:43 
Questionproblem with relese mode Pin
kir_MFC23-Apr-09 23:25
kir_MFC23-Apr-09 23:25 
AnswerRe: problem with relese mode Pin
Cedric Moonen23-Apr-09 23:30
Cedric Moonen23-Apr-09 23:30 
AnswerRe: problem with relese mode Pin
Hamid_RT24-Apr-09 0:08
Hamid_RT24-Apr-09 0:08 
QuestionRe: problem with relese mode Pin
David Crow24-Apr-09 4:13
David Crow24-Apr-09 4:13 
QuestionCan you please explain me why this code is not working ? Pin
kapardhi23-Apr-09 23:19
kapardhi23-Apr-09 23:19 
Hai!

I am taking a image from a location, converting into byte array and displaying it back on my dialog by converting into bitmap image!

HBITMAP hBitMap;
hBitMap = (HBITMAP) LoadImage (NULL, \
"c:\\Documents and Settings\\Desktop\\Image\\bitmap1.bmp", \
IMAGE_BITMAP, SM_CXICON, SM_CYICON, LR_LOADFROMFILE);

CBitmap bmp;
bmp.Attach((HBITMAP)hBitMap); // handle I got from LoadBitmap
BITMAP bitmap;
bmp.GetBitmap(&bitmap);
int size = bitmap.bmHeight*bitmap.bmWidth*bitmap.bmBitsPixel/8;
BYTE *lpBits = new BYTE [ size ];

// Here i convert the image to byte array
::GetBitmapBits((HBITMAP)hBitMap,size,lpBits );

// Here i get the handle to the picture control on my dialog
HWND hImage = this->GetDlgItem(IDC_STATIC_IMAGE)->GetSafeHwnd();

// I Call the following function to paint the converted byte array
SetRawBitsToImage (hImage,bitmap.bmWidth,bitmap.bmHeight,lpBits ,32);


//The defination of the above function is
// hwnd = handle to the image control
// W = width of the raw bits Image
// H = height of the raw bits Image
// lpBits = pointer to the raw bits image
// BitCount = 32,24 etc ( depend on the bit count ) defualt =32
void CMyTryImageDlg:: SetRawBitsToImage (HWND hwnd,int W,int H,BYTE *lpBits, int BitCount)
{
HDC hDC = ::GetDC(hwnd);
::SetWindowPos(hwnd,0,0,0,W,H,SWP_NOMOVE);

BITMAPINFO bi;
memset(&bi,0,sizeof(BITMAPINFO));
bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bi.bmiHeader.biWidth = W;
bi.bmiHeader.biHeight = H;
bi.bmiHeader.biPlanes = 1;
bi.bmiHeader.biBitCount = BitCount;
bi.bmiHeader.biCompression = BI_RGB;
bi.bmiHeader.biSizeImage = bi.bmiHeader.biWidth*bi.bmiHeader.biHeight*BitCount/8;


::SetDIBitsToDevice(hDC,
0,0,
W,
H,
0,
0,
0,bi.bmiHeader.biHeight,
&lpBits,&bi,DIB_RGB_COLORS);

::ReleaseDC(hwnd,hDC);

}

// But nothing is getting displayed? why? Is there any mistake in code?
// I donot have knowledge in images

Thanks!
AnswerRe: Can you please explain me why this code is not working ? Pin
Code-o-mat23-Apr-09 23:46
Code-o-mat23-Apr-09 23:46 
GeneralRe: Can you please explain me why this code is not working ? Pin
kapardhi24-Apr-09 0:01
kapardhi24-Apr-09 0:01 
GeneralRe: Can you please explain me why this code is not working ? Pin
Code-o-mat24-Apr-09 1:00
Code-o-mat24-Apr-09 1:00 
AnswerRe: Can you please explain me why this code is not working ? Pin
Stuart Dootson23-Apr-09 23:46
professionalStuart Dootson23-Apr-09 23:46 
GeneralRe: Can you please explain me why this code is not working ? Pin
kapardhi23-Apr-09 23:57
kapardhi23-Apr-09 23:57 
GeneralRe: Can you please explain me why this code is not working ?r Pin
CPallini24-Apr-09 0:12
mveCPallini24-Apr-09 0:12 
GeneralRe: Can you please explain me why this code is not working ? Pin
Chris Losinger24-Apr-09 2:58
professionalChris Losinger24-Apr-09 2:58 
QuestionError : Debug assertion failed ................ Pin
tasmin iqbal23-Apr-09 22:05
tasmin iqbal23-Apr-09 22:05 
QuestionRe: Error : Debug assertion failed ................ Pin
CPallini23-Apr-09 22:06
mveCPallini23-Apr-09 22:06 
AnswerRe: Error : Debug assertion failed ................ Pin
_AnsHUMAN_ 23-Apr-09 22:08
_AnsHUMAN_ 23-Apr-09 22:08 
GeneralRe: Error : Debug assertion failed ................ Pin
tasmin iqbal23-Apr-09 22:19
tasmin iqbal23-Apr-09 22:19 
AnswerRe: Error : Debug assertion failed ................ Pin
Stuart Dootson23-Apr-09 22:45
professionalStuart Dootson23-Apr-09 22:45 
GeneralRe: Error : Debug assertion failed ................ Pin
tasmin iqbal23-Apr-09 22:48
tasmin iqbal23-Apr-09 22:48 
GeneralRe: Error : Debug assertion failed ................ Pin
Stuart Dootson23-Apr-09 23:43
professionalStuart Dootson23-Apr-09 23:43 
QuestionRe: Error : Debug assertion failed ................ Pin
David Crow24-Apr-09 4:15
David Crow24-Apr-09 4:15 
QuestionHow to get the selectedColumn in a CListCtrl. Pin
FISH78623-Apr-09 21:41
FISH78623-Apr-09 21:41 
AnswerRe: How to get the selectedColumn in a CListCtrl. Pin
_AnsHUMAN_ 23-Apr-09 21:46
_AnsHUMAN_ 23-Apr-09 21:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.