|
pls try with this..if it is confusing pls let me know..
parameter Info...
name--> name of file .bmp file with path.
bmp --> address of Bitmap structure
data--> Pixel data.
void WriteBmp(char* name,BITMAP *bmp,int* data)
{
BITMAPINFO Bmi;
memset(&Bmi,0,sizeof(BITMAPINFO));
Bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
Bmi.bmiHeader.biWidth = (bmp->bmWidth);
Bmi.bmiHeader.biHeight = (bmp->bmHeight);
Bmi.bmiHeader.biPlanes = 1;
Bmi.bmiHeader.biBitCount = bmp->bmBitsPixel;
Bmi.bmiHeader.biCompression = BI_RGB;
Bmi.bmiHeader.biSizeImage = bmp->bmHeight*bmp->bmWidth*(bmp->bmBitsPixel/8);
// TRACE("\nBmi.bmiHeader.biSizeImage= %ld",Bmi.bmiHeader.biSizeImage);
// TRACE("\tBmi.bmiHeader.biHeight= %ld",bmp->bmHeight);
FILE* image = fopen (name,"wb");
if(image==0)
{
AfxMessageBox("Error in creating Image File");
return;
}
int h = abs(Bmi.bmiHeader.biHeight);
int w = abs(Bmi.bmiHeader.biWidth);
Bmi.bmiHeader.biHeight=h;
Bmi.bmiHeader.biWidth=w;
long sz = Bmi.bmiHeader.biSizeImage;
int ii,ch,ss;
// ss = sz/4;
ss = sz/4;
try
{
long s1=ss;
for( ii=0; ii< (ss/2)-1; ii++)
{
ch = data[s1];
data[s1--] = data[ii];
data[ii] = ch;
}
long i,j,pos;
s1 =0;
for(i=1; i<=h; i++)
{
s1 += w;
pos = s1-(w/2);
j=s1-1;
for( ii=s1-w ;ii<pos; ii++)
="" {
="" ch="data[ii];
" data[ii]="data[j];
" data[s1]="data[ii];
" data[j]="ch;
" j--;
=""
="" }
="" catch(...)
="" afxmessagebox("error="" in="" capture="" image");
="" return;
="" }
="" bitmapfileheader="" bfh;
="" bfh.bftype="('M'<<8)+('B');"
="" bfh.bfoffbits="sizeof(BITMAPFILEHEADER)+" sizeof(bitmapinfoheader);="" bfh.bfsize="sz+bfh.bfOffBits;" bfh.bfreserved1="0;" bfh.bfreserved2="0;" bmi.bmiheader.biheight="Bmi.bmiHeader.biHeight-21;
" fwrite(&bfh,sizeof(bfh),1,image);
="" fwrite(&bmi.bmiheader,sizeof(bitmapinfoheader),1,image);
="" fwrite(data,sz,1,image);
="" fclose(image);
=""
}=""
<div="" class="ForumSig">There Is Nothing Right & Wrong
|
|
|
|
|
I forgot but I think in VC 6.0 we have a class like CImage I remember that I used of that class in VC 6.0 and also I remember that it doesnt support on the VS2003.
|
|
|
|
|
I use CPictureEX in order to insert GIF.but the background of this GIF is white,though i intercalate GIF look like transparence (USE PhotoShop )
how can i do?
|
|
|
|
|
hello,
in my programm, i created a run-time control CEdit. It's appears, when user clicks on some place (row in a table). I can read, that user enters in that CEdit control, but.... i don't know - when does it lose a focus? How can i override functions in this control, like a 'OnEnChangeEdit1()' or 'OnEnKillFocusEdit1()', that provided to me by MFC, if i create static (compiling-time) control...
|
|
|
|
|
mr_Tuborg wrote: when does it lose a focus?
When it receives a EN_KILLFOCUS message.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Good solution, but it doesn't override an any MFC control function =)
|
|
|
|
|
Which scenario are you having trouble with - dynamically (runtime)
created controls or static (from resource) created controls?
Either way, to use the MFC message handlers, you derive a class
from CEdit and add your handlers, including entries in the message map.
Then you use objects of your derived class in place of CEdit objects in
the parent window class.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
i'm having trouble with runtime created controls.
Thanks for answer. It completly explains to me how to use an overriding in MFC controls.
|
|
|
|
|
Another option is to handle the EN_KILLFOCUS[^] message in the parent window.
Steve
|
|
|
|
|
Excellent
Thanks,
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hello,
I am wondering if there is a way to detect a right click on the header of each tab of a tab control?
Any help is appreciated.
Thanks..
|
|
|
|
|
Is the NM_RCLICK[^] notification what you're looking for?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Well yes, I am looking for detecting NM_RCLICK .. but I want to handle it only when the right click is performed on the tab header ( i.e. I don't know if tab header is the correct word for it .. but this is what I mean - http://www.geocities.com/swaps4781/tabheader.JPG (the circled area) )
|
|
|
|
|
NM_RCLICK should be the notification you're looking for.
The part you have circled is the actual tab.
Generally, the tabs ares the only visible portion of a tab control -
the rest of the control (if any) is covered with another window so
right-clicks go to those windows.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
Hey Friends
I need to navigate an existing IE window to some other location.
IWebBrowser2::Navigate Method, but it opens another window & navigates to it
where as i am looking to navigate a already opened window to some other location
tried IEHelper in cp but no luck
m_oObject.FindUsingTitle(CString("google.com"));
m_oObject.Navigate("http://www.yahoo.com");
Need help
Regards
|
|
|
|
|
vikrant kpr wrote: m_oObject.Navigate("http://www.yahoo.com");
Have you tried the Navigate2() method?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Yeah thanks it worked but after i uninstalled visual studio 9
|
|
|
|
|
Do you want to open other address?
|
|
|
|
|
please help to create tool tip for Edit Control
sarojsigdel
|
|
|
|
|
see here. Google is your friend.
|
|
|
|
|
Have you first called CWnd::EnableToolTips(TRUE) ? And since your dialog is not derived from CFrameWnd , tool tips for your edit control will not display correctly unless you provide a handler for the TTN_NEEDTEXTW and TTN_NEEDTEXTA notifications.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
m_tooltip.Create(this);
SetToolTip("Hello");
void CAnswerView::SetToolTip(LPTSTR ToolTip)
{
TOOLINFO ti;
ti.cbSize = sizeof(TOOLINFO);
ti.lpszText = ToolTip;
ti.hinst = AfxGetInstanceHandle();
ti.hwnd = m_Button.m_hWnd;
ti.uFlags = TTF_SUBCLASS | TTF_IDISHWND;
ti.uId = (UINT) m_Button.m_hWnd; m_tooltip.SendMessage(TTM_ADDTOOL, 0, (LPARAM) &ti);}
|
|
|
|
|
hi all,
I am creating application that reads data from file and again save the updated data to file. I don't want users to modify the saved file outside the application. If somebody does so, the file shouldnot be opened by the application that I have developed.
can anybody help me.
sarojsigdel
sarojsigdel
|
|
|
|