|
Override OnEraseBkgnd(CDC* pDC)
E.g.
#define DLG_BACK_COLOR RGB(255,0,0)
BOOL CYourDlg::OnEraseBkgnd(CDC* pDC)
{
CRect rect;
GetClientRect(&rect);
CBrush brush(DLG_BACK_COLOR);
pDC->FillRect(rect,&brush);
return TRUE;
}
HTH
Jetli
Constant Thing In World Is Change.
|
|
|
|
|
also handle WM_CTLCOLORSTATIC to give static text boxes the same background color
--
Look straight into the light!
|
|
|
|
|
Handle WM_CTLCOLOR message in your Dialog to paint dialog with color of your choice
"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,
Thanks to all of you for your reply.Now I got it as per your suggesstion.
|
|
|
|
|
Hi,
Thanks for the reply.
Now the problem is solved as per the suggesstion made by all of you.
|
|
|
|
|
I created an MFC console project, when declared a CString variable and use its SetAt function, Debug Assertion failed, Why? There's no other function nor task yet in my prog. I can't proceed with my program because of this debug assertion failed error during run-time as it reaches the SetAt line.
|
|
|
|
|
You used an index beyond the size of the CString.
You should use SetAt() after knowing the length of the CString using the CString::GetLength() function. The index passed to SetAt() must be lower than its length.
Tip: Always use the debugger when you get Assertion failures. It will take you to the exact line where the ASSERT() statement failed. Hence you will know what caused the assertion failure.
this is this.
|
|
|
|
|
Yup, I inserted beyond the length of the string and I forgot that I should've used the += sign., lol.. thanx anyway
|
|
|
|
|
benjnp wrote:
I created an MFC console project, when declared a CString variable and use its SetAt function, Debug Assertion failed, Why? There's no other function nor task yet in my prog. I can't proceed with my program because of this debug assertion failed error during run-time as it reaches the SetAt line.
I should've used the += sign..... I forgot
here's a sample line of codes
#1
CString strLine;
strLine = "Hello";
cout << strLine << endl;
output
007706BC
#2
CString strLine;
strLine = "Hello";
printf("%s\n", strLine);
output
Hello
Why didn't cout display the "Hello" string, but using printf will display the desired output. What's the difference between cout and printf that made the above discrepancy? Thanx
|
|
|
|
|
Hi
My table in oracle is having 3 fields of empid as number,image as blob and ename as varchar2(15);
I am able to insert integer values into Oracle db using ADO with out any problem but while Inserting varchar value into Oracle DB using ADO it is not inserting the specified value i have given. the code i have written is
//Prepare the Age VARIANT for ADO C++ Command Object Parameter
VARIANT vId;
vId.vt = VT_I2; //Variant type for Integer
vId.intVal = 15;
VARIANT vName;
vName.vt = VT_BSTR; //Variant type for BSTR
CString str;
str = "Coder";
vName.bstrVal =_bstr_t( str);//_bstr_t("Coder");
pCommand->Parameters->Append(pCommand->CreateParameter(_bstr_t ("eid"),adInteger,adParamInput,4,vId));
pCommand->Parameters->Append(pCommand->CreateParameter(_bstr_t("ename"),adVarChar,adParamInput,15,vName));
pCommand->Execute(NULL,NULL,adCmdStoredProc);
but it is inserting "eid" in the value of ename.
and i dont know how to insert images.
Thanks in advance
|
|
|
|
|
I have been using safe string library for a while, but one thing I find missing is I dont see a safe version of strstr which takes a length parameter(preferable for both the parameters). Is it not there or I did not look enough to find it? Thanks!
|
|
|
|
|
The safe versions are intended to avoid buffer overruns. Since strstr doesn't modify any of the strings it receives, there's actually no need for a safe version.
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
I thought safe strings are also to work on non-null-terminating strings.
So how do you do strstr on a non-null-terminating string?
I found strnstr in GNU lib, I am using that for now. I wish it was available in C library itself.
|
|
|
|
|
Hai ,
I created the dialog based dll file.Then i created the SDI application using Mfc wizard and i loaded the dll into this application.When i call the dll file from the sdi application,appcoer.cpp,app3d.cpp,wincore.cpp(line 884,883) debug assertion appear.After that the dialog application loaded when i gave ignore .How i solved this problem.Please Help me.
Thanks,
SUNSEN
|
|
|
|
|
I know this is pathetic, but I really need help.
I have a large CBitmap. I need to create a smaller CBitmap that is a copy of a portion of tha larger one.
I have looked in all my books, looked all over the web, and have not found anything that works.
So given bitmap1 and bitmap2 and a rectanglular area of bitmap1, I want to copy that area of bitmap1 to bitmap2. Why is this hard to do? I figure it must be hard, because none of the code I found that claimed to do this, actually did it!
|
|
|
|
|
Sea the BitBlt() function.
SkyWalker
|
|
|
|
|
int dst_width = <width>
int dst_height = <height>
CBitmap src_bitmap;
CBitmap dst_bitmap;
BITMAP src_info;
src_bitmap.GetBitmap(&src_info);
CDC src_DC,dst_DC,screen_DC;
screen_DC.Attach(::GetDC(NULL));
dst_bitmap.CreateCompatibleBitmap(&screen_DC,dst_width,dst_height);
src_DC.CreateCompatibleDC(NULL);
dst_DC.CreateCompatibleDC(NULL);
dst_DC.SetStretchBltMode(HALFTONE);
CBitmap *src_previous = src_DC.SelectObject(&src_bitmap);
CBitmap *dst_previous = dst_DC.SelectObject(&dst_bitmap);
dst_DC.StretchBlt(0,0,dst_width,dst_height,
&src_DC,0,0,src_info.bmWidth,src_info.bmHeight,
SRCCOPY);
src_DC.SelectObject(src_previous);
dst_DC.SelectObject(dst_previous);
I just typed this in, so it may have minor problems, but this should give you an idea of how to go about it.
Software Zen: delete this;
|
|
|
|
|
Here is the function I settled on. Unfortunately, I copied most of the code from another source on the internet, and lost my link to it. Therefore I cannot properly cite that source. If you recognize the code as yours, then please accept my thanks for it.
void CLabeledBitmap::CopyBitmapSection(CBitmap &bmpSrc, CBitmap &bmpDest, CRect &rectSection, CDC* pDC)
{
int nWidth = rectSection.Width();
int nHeight = rectSection.Height();
CDC destDC, srcDC;
CBitmap *pOldBmp = NULL;
CBitmap *pOldSrcBmp = NULL;
destDC.CreateCompatibleDC(pDC);
srcDC.CreateCompatibleDC(pDC);
bmpDest.DeleteObject();
bmpDest.CreateCompatibleBitmap(pDC, nWidth, nHeight);
pOldSrcBmp = srcDC.SelectObject(&bmpSrc);
pOldBmp = destDC.SelectObject(&bmpDest);
destDC.StretchBlt(0, 0, nWidth, nHeight, &srcDC, rectSection.left, rectSection.top,
rectSection.Width(), rectSection.Height(), SRCCOPY);
bmpDest.SetBitmapDimension(nWidth, nHeight);
destDC.SelectObject(pOldBmp);
srcDC.SelectObject(pOldSrcBmp);
}
-- modified at 1:38 Wednesday 5th October, 2005
|
|
|
|
|
Hi,
Can u suggest some links, related with info on packets sent by the yahoo messenger for its activities like OM, comference, File Transfer etc.
|
|
|
|
|
|
Hi,
I gone through this site, and is a nice one.But this site represent a packet sniffer tool.
I think I did not mention much in my query posted earlier.
what I needed is that after catching the packet, I want some info about the contents in those packet.As I am getting prob. in file transfer(for latest version 7) only, as some of field are not clear.
Can u suggest some more links.
Regs
-- modified at 1:34 Monday 3rd October, 2005
|
|
|
|
|
Hi
Can anybody help me. i am using ADO for the first time. i got examples on that. but they are using other than Oracle databse. i have to connect to Oracle using ADO and use stored procedures. I dont know how to use ConnectionString to connect to Oracle. Plz help me in this regard.
bye
|
|
|
|
|
snprani wrote:
I dont know how to use ConnectionString to connect to Oracle. Plz help me in this regard.
here is the list :-
http://www.codeproject.com/database/connectionstrings.asp[^]
"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 used <new> in my dll and when loasing it i encountered some problems.
am i able to allocate memory in a dll??
|
|
|
|
|
Can you briefly explain how you are allocating the memory in the dll?
-prakash
|
|
|
|