|
Hello Prakash,
I have declared CBitmap in this,
CMyBitmap mybitmap;
mybitmap.LoadBitmap(IDB_MYBMP);
mybitmap.DrawTransparent(GetDC(),20,50,RGB(255,0,255));
Sorry I was not clear enough in the first place. CMyBitmap is derrived from CBitmap, I have to subclass because i need to make the bitmap transparent. Please help me How I could bring this on top of other controls. Anyway here is the detail of DrawTransparentFunction.(Just research this detail from other articles but it didnt bring the bitmap on top. Its weakness is when there are other control because it is overlapped.)
void CMyBitmap::DrawTransparent(CDC *pDC, int x, int y, COLORREF clrTransparency)
{
BITMAP bm;
GetBitmap (&bm);
CPoint size (bm.bmWidth, bm.bmHeight);
pDC->DPtoLP (&size);
CPoint org (0, 0);
pDC->DPtoLP (&org);
//
// Create a memory DC (dcImage) and select the bitmap into it.
//
CDC dcImage;
dcImage.CreateCompatibleDC (pDC);
CBitmap* pOldBitmapImage = dcImage.SelectObject (this);
//dcImage.SetMapMode (pDC->GetMapMode ());
//
// Create a second memory DC (dcAnd) and in it create an AND mask.
//
CDC dcAnd;
dcAnd.CreateCompatibleDC (pDC);
//dcAnd.SetMapMode (pDC->GetMapMode ());
CBitmap bitmapAnd;
bitmapAnd.CreateBitmap (bm.bmWidth, bm.bmHeight, 1, 1, NULL);
CBitmap* pOldBitmapAnd = dcAnd.SelectObject (&bitmapAnd);
dcImage.SetBkColor (clrTransparency);
dcAnd.BitBlt (org.x, org.y, size.x, size.y, &dcImage, org.x, org.y, SRCCOPY);
//
// Create a third memory DC (dcXor) and in it create an XOR mask.
//
CDC dcXor;
dcXor.CreateCompatibleDC (pDC);
//dcXor.SetMapMode (pDC->GetMapMode ());
CBitmap bitmapXor;
bitmapXor.CreateCompatibleBitmap (&dcImage, bm.bmWidth, bm.bmHeight);
CBitmap* pOldBitmapXor = dcXor.SelectObject (&bitmapXor);
dcXor.BitBlt (org.x, org.y, size.x, size.y, &dcImage, org.x, org.y, SRCCOPY);
dcXor.BitBlt (org.x, org.y, size.x, size.y, &dcAnd, org.x, org.y, 0x220326);
//
// Copy the pixels in the destination rectangle to a temporary
// memory DC (dcTemp).
//
CDC dcTemp;
dcTemp.CreateCompatibleDC (pDC);
//dcTemp.SetMapMode (pDC->GetMapMode ());
CBitmap bitmapTemp;
bitmapTemp.CreateCompatibleBitmap (&dcImage, bm.bmWidth, bm.bmHeight);
CBitmap* pOldBitmapTemp = dcTemp.SelectObject (&bitmapTemp);
dcTemp.BitBlt (org.x, org.y, size.x, size.y, pDC, x, y, SRCCOPY);
//
// Generate the final image by applying the AND and XOR masks to
// the image in the temporary memory DC.
//
dcTemp.BitBlt (org.x, org.y, size.x, size.y, &dcAnd, org.x, org.y, SRCAND);
dcTemp.BitBlt (org.x, org.y, size.x, size.y, &dcXor, org.x, org.y, SRCINVERT);
//
// Blit the resulting image to the screen.
//
pDC->BitBlt (x, y, size.x, size.y, &dcTemp, org.x, org.y, SRCCOPY);
//
// Restore the default bitmaps.
//
dcTemp.SelectObject (pOldBitmapTemp);
dcXor.SelectObject (pOldBitmapXor);
dcAnd.SelectObject (pOldBitmapAnd);
dcImage.SelectObject (pOldBitmapImage);
}
|
|
|
|
|
I dont think it is a problem with your drawing, The problem is probably with the placement of the controls.
If the controls are overlaping that means, you have placed them like that.
or is the bitmap drawing beyond your required place.
or if you want the bitmap to be drawn over other contorls, consider making thouse contorls invisible.
-prakash
|
|
|
|
|
Hello,
Can somebody help me. I have a CBitmapButton and I want to hide parts or area with magenta color RGB(255,0,255). I think I have to create a class that derrives CBitmapButton some functions.. But am not familiar with graphics in EVC. Please help me how to do it.
Thanks and Good day..
|
|
|
|
|
here is an strange problem.
i included a header file <dbt.h>
Now i used some of the structures defined in it.
when i right click on structure name and click goto definition it take me to dbt.h and show the definition.
but when i build the application it gives error saying undefined refrence for the same structure.
Why is this happening. What is the solution.
Thanks
|
|
|
|
|
is dbt.h made by you?
if yes, can you make sure that there is only one file in your project directory.
I used to have similar problem and figured that it was due to duplicate files.
-prakash
|
|
|
|
|
Hi all
I have searched high and low, but cant find a way to disable linker warnings. Sure compiler warnings can be dealt with in various ways, but I cant find a single option for the linker. I tried passing the linker warning numbers to the compilers option too without luck. Any ideas?
xacc-ide 0.0.99-preview3
|
|
|
|
|
a suggestion,
instead of disableing the linker warnings try to resolve them, usally linker warnings when ignored makes the binary kinda unstable, It would crash without any reason and difficult to debug.
-prakash
|
|
|
|
|
leppie wrote: I tried passing the linker warning numbers to the compilers option too without luck. Any ideas?
what about this
#pragma comment(linker, "/include:__mySymbol")
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
|
I want to exit an application programatically i will use
exit(0);
But some how i feel if i do this with MFC application, its not a good thing.
Can anyone tell me is it a safe way to exit an MFC application.
If any other approach is there plz let me know.
Thanks a lot
|
|
|
|
|
|
One can send WM_CLOSE message to the application
|
|
|
|
|
karmendra_js wrote:
Can anyone tell me is it a safe way to exit an MFC application.
PostQuitMessage(...);
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Hi
I am using PostgreSQL as my Database. I have derived one Table using CRecordset. I have to use CByteArray to store Images into that table. I am using this way. is there any wrong in my code plz help me.
CCitizenPhoto rs;
rs.AddNew();
rs.m_sno = sno;
CFile f;
f.Open("Photo.jpg",CFile::modeRead);
rs.m_photo.SetSize(f.GetLength());
f.Read(rs.m_photo.GetData(),f.GetLength());
f.Close();
rs.SetFieldDirty(&rs.m_photo);
rs.SetFieldNull(&rs.m_photo,FALSE);
rs.Update();
rs.Close();
when i am running this code it is giving Error as Data Truncated.
I have Initialized MAXSIZE with 36000.
RFX_Binary(pFX,_T("[photo]",m_photo,MAXSIZE);
When i am storing of 10K image it is storing nicely and i am able to retrieve also. But more than 10k it is giving error as Data truncated. it is unable to store and retrive. both places giving error as Data truncated.
Plz help me
Thans in advance.
|
|
|
|
|
Hi! Does anyone know how can i make my application starts when windows starts up, i mean using code not put the application in the startup folder! . I think i must use the registry but i m not sure! Thanks!
------------------------------
If you can't find the
-- -- -- -- -- -- -- -- -- --
way..let the way find you..
------------------------------
|
|
|
|
|
extus wrote: Hi! Does anyone know how can i make my application starts when windows starts up, i mean using code not put the application in the startup folder!. I think i must use the registry but i m not sure! Thanks!
Try this :
CRegKey key;
LONG status = key.Open(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion\\Run");
if(status==ERROR_SUCCESS)
{
key.SetValue("Path of your program","Name of your program");
}
key.Close();
do not forget to include atlbase.h in your application
"Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill
-- modified at 7:26 Saturday 15th October, 2005
|
|
|
|
|
sure ,you must set Registry
let your application start up after windows starts up
and use API function.
----------------------------
Jerry yu
Chinese
programming fans
|
|
|
|
|
extus wrote: i! Does anyone know how can i make my application starts when windows starts up, i mean using code not put the application in the startup folder!. I think i must use the registry but i m not sure! Thanks!
extus wrote: i! Does anyone know how can i make my application starts when windows starts up, i mean using code not put the application in the startup folder!. I think i must use the registry but i m not sure! Thanks!
In continuation With Giorgi:-
there are two more place from where you can start your application at window startup:-
#1 already told bu Giorgi
#2 HKEY_CURRENT_USER
code:- (just One change to Giorgi code)
CRegKey key;
LONG status = key.Open(HKEY_CURRENT_USER,"Software\\Microsoft\\Windows\\CurrentVersion\\Run");
if(status==ERROR_SUCCESS)
{
key.SetValue("Path of your program","Name of your program");
}
key.Close();
#3 Make entry in %windir%\startup
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Hello everyone!
I want to debug my program, but When start the program need one
parameter, where can I input the parameter in VC7, please help
me!
Thank you very much!
|
|
|
|
|
For debugging purpose you can take variables instedof parameters
Madhu S. Kapoor
|
|
|
|
|
Right click on the project in Solution Explorer, click on Properties. Expand the treeview on the left and go to Configuration Properties->Debugging. Click on it and you'll find a textbox for entering "Command Arguments".
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Thank you for your reply.
But in my program it doesn't work. I donn't know the reason.
if I run my program in command line as this: "XXXD.exe /Debug "
it run normally. But when I debug it in program,
I fill the debugging's Command :XXXD.exe, and fill the "Command Arguments": /Debug, but it run as : "XXXD.exe"
it seems the "Command Arguments" doesn't work , Perhaps there is
something I should to set ?
|
|
|
|
|
what program why not say the detail.
----------------------------
Jerry yu
Chinese
programming fans
|
|
|
|
|
int the function OnDraw(),I want to create a DIB bitmap using the array pData,but I am not successful,Please help me.
//the array containing color information
unsigned char* pData=new unsigned char[768*576];
int y=0, x=0;
for(;y<576;y++)
for(;x<768;x++)
{
pData[x*3+y*768*3]=0;
pData[x*3+1+y*768*3]=0;
pData[x*3+2+y*768*3]=255;
}
//information header
BITMAPINFOHEADER FrameBmi;
FrameBmi.biSize=sizeof(BITMAPINFOHEADER);
FrameBmi.biPlanes=1;
FrameBmi.biCompression=BI_RGB;
FrameBmi.biClrImportant=0;
FrameBmi.biSizeImage=768*576*3;
FrameBmi.biClrUsed=0;
FrameBmi.biBitCount=24;
FrameBmi.biWidth=768;
FrameBmi.biHeight=576;
FrameBmi.biXPelsPerMeter = 0;
FrameBmi.biYPelsPerMeter =0;
//file header
BITMAPFILEHEADER pf;
pf.bfType=0x4d42; //"BM"
pf.bfSize=sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER)+sizeof(char[768*576]);
pf.bfOffBits=sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER);
pf.bfReserved1=0;
pf.bfReserved2=0;
//BITMAPINFOHEADER
LPBITMAPINFO lpbmi=(LPBITMAPINFO)GlobalAlloc(GMEM_FIXED,sizeof(BITMAPINFOHEADER));
ASSERT(lpbmi);
lpbmi->bmiHeader.biSize=FrameBmi.biSize;
lpbmi->bmiHeader.biPlanes=FrameBmi.biPlanes;
lpbmi->bmiHeader.biCompression=FrameBmi.biCompression;
lpbmi->bmiHeader.biClrImportant=FrameBmi.biClrImportant;
lpbmi->bmiHeader.biSizeImage=FrameBmi.biSizeImage;
lpbmi->bmiHeader.biClrUsed=FrameBmi.biClrUsed;
lpbmi->bmiHeader.biBitCount=FrameBmi.biBitCount;
lpbmi->bmiHeader.biWidth=FrameBmi.biWidth;
lpbmi->bmiHeader.biHeight=FrameBmi.biHeight;
lpbmi->bmiHeader.biXPelsPerMeter=FrameBmi.biXPelsPerMeter;
lpbmi->bmiHeader.biYPelsPerMeter=FrameBmi.biYPelsPerMeter;
lpbmi->bmiColors=NULL;
//创建DIB位图
CBitmap *OldBitmap;
HBITMAP bmp =::CreateDIBitmap((HDC)pDC,&FrameBmi,CBM_INIT,pData,lpbmi, DIB_RGB_COLORS);
ASSERT(bmp);
//
CBitmap bitmap;
bitmap.Attach(bmp);
CDC dcComp;
dcComp.CreateCompatibleDC(pDC);
OldBitmap=dcComp.SelectObject(&bitmap);
BITMAP bm;
bitmap.GetObject(sizeof(BITMAP),&bm);
// draw bitmap
pDC->BitBlt(0,0,768,576,&dcComp,0,0,SRCCOPY);
dcComp.SelectObject(OldBitmap);
delete [] pData;
GlobalFree(lpbmi);
help me!
|
|
|
|
|
I just got a lil confussed here.
I want to access a variable using the object of the class.
classXYZ objectname= new classXYZ();<br />
objectname.variablename=100;
so which access specifier is best for variablename.
Thanks.
|
|
|
|
|