|
Enumerate all the windows and if the WS_VISIBLE style bit is 1, then set it to zero then back to 1 and this toggle will force a repaint. Send an F5 keystroke to the desktop window and it will redraw all the icons etc.
OR since you want to use the entire screen, create a window with no frame or menu and size it to the display then get the DC for that window. When that window is closed/destroyed all the other windows/desktop will redraw on their own. This is how many screen savers work!
|
|
|
|
|
Thank you. I think one of your methods will be perfect...
|
|
|
|
|
Hi
how to Insert BLOB images into Oracle Databse using ADO in vc++. Help me if possible. is there any way to use Stored Procedures in that.
Thanks
|
|
|
|
|
Hi again people. It's the weekend but I'm bustin' my neurons with some MFC. I have a basic MFC exe and when I create a dialogue2 from my main dialogue, dialogue2 isn't shown in the TaskBar. How can I make a secondary window of my application be represented in the TaskBar? I actually hide my main dialogue before displaying dialogue2, but still, dialogue2 ain't shown in that TaskBar... grrr.
-= E C H Y S T T A S =-
The Greater Mind Balance
|
|
|
|
|
You want the WS_EX_APPWINDOW style. You can set this in the dialog properties window with the "Application Window" flag.
|
|
|
|
|
Tell where you see the "Application Window" flag in the MFC designer of the Visual C++ 6 IDE ::- D. I don't. Anyway, I did it with SetWindowLong ::- ). Thanks! This type of setting wasn't very well described in MSDN but I did find it AFTER you told me.
-= E C H Y S T T A S =-
The Greater Mind Balance
|
|
|
|
|
Hi all,
I want have DLG application, which is not compiled with _UNICODE ( means it is not UNICODE ,right?). In that I am having one list control to display certaing strings.
In perticular, I want to display strings in UNICODE (WCHAR) in say 2nd col of list ctrl for all rows,
Is it possible to do this anyhow?
Without compiling application to as unicode!!!
Any suggestion?
Jetli
Constant Thing In World Is Change.
|
|
|
|
|
This is tricky but you can actually mix unicode and ansi windows within an Application. When you define _UNICODE all the macros get mapped their *W functions. So SendMessage becomes SendMessageW, etc. Windows converts between unicode and ansi between windows your behalf so that if you call SetWindowText from an ansi program to a unicode program, the recieving program will get unicode from the ansi that the sender sent.
Windows tells if a window is unicode or not by how it was created. So RegisterClassA would be an window procedure expecting ansi and RegisterClassW excepts unicode. You can change this by calling SetWindowLongPtrW and passing GCLP_WNDPROC with a new WndProc. Make sure to end your new WndProc with CallWindowProcA because the original accepts ansi. This will however make the entire control unicode.
If your really want to save every character you can and only want that column's strings in Unicode you can try a combination of LVS_OWNERDATA and LVS_OWNERDRAWFIXED to manage your own strings and drawing.
|
|
|
|
|
Many thanks for valuable reply.
Mark Petrik Sosa wrote:
If your really want to save every character you can and only want that column's strings in Unicode you can try a combination of LVS_OWNERDATA and LVS_OWNERDRAWFIXED to manage your own strings and drawing.
Can u spread more lights on this.... Any sample how to do this....
And also after doing some look-search i found that if i call directly SendMessageW(). in that we pass Unicode params... i want to know whcih message internally passed when we call
BOOL CListCtrl::SetItemText( int nItem, int nSubItem, LPTSTR lpszText );
Can this be done like this???
Thanks in advance.
Jetli
Constant Thing In World Is Change.
|
|
|
|
|
SetItemText is just a wrapper for LVM_SETITEMTEXT, which will be sent using SendMessageA because _UNICODE is not set. Be aware however that even if you send "unicode" messages to a window, windows will automatically convert them to ansi if the window is not unicode window. There are no samples that I know of, the easiest thing would be just to make the entire application unicode.
|
|
|
|
|
Many thanks.
I will look for that.
Jetli
Constant Thing In World Is Change.
|
|
|
|
|
Hi,
In a MFC dialog Based Application, I want to change the color of the Dialog Box, as soon as it appears on the screen.
Can u suggest how to achieve this.............
Regs
|
|
|
|
|
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.
|
|
|
|