|
Hi
Handle the WM_CTLCOLORDLG and place your painting code inside the handler.
<br />
<br />
HBRUSH CBkColorDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)<br />
{<br />
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);<br />
<br />
<br />
<br />
<br />
if(nCtlColor == CTLCOLOR_DLG)<br />
{<br />
hbr = CreateSolidBrush(RGB(2,22,222));<br />
}<br />
else if(nCtlColor == CTLCOLOR_STATIC)<br />
{<br />
pDC->SetBkMode(TRANSPARENT);<br />
hbr = CreateSolidBrush(RGB(2,22,222));<br />
}<br />
<br />
return hbr;<br />
}<br />
<br />
that's it
Regargs
Nitheesh
|
|
|
|
|
Serious resource leak there
Those brushes should be created and destroyed
outside of the WM_CTLCOLOR handler!
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi!
I am working with a class, derived from CRecordView. It is a basic customer-maintenance type module where you can either select the record by typing in the key number or scroll back and forth, uisng the standard RecordView buttons. Problem is that quick lookups and scrolling appears to me mutually exclusive.
The person who originally wrote the class solved this by coding the lookup like this:
MoveFirst();
while(!IsEOF())
{
if(m_Nummer==nr)
return TRUE;
MoveNext();
}
This works if the number of records are reasonable (say up to 5000). If I code the lookup with a normal filter and Requery then it is lightinly fast, but Moves fail, presumably because it tries to move within that result set of one record.
Can anyone suggest a solution where I can:
a) Just type in a number and have it pull up the record and
b) be able to use previous/next navigation?
|
|
|
|
|
Anders Gustafsson wrote: ...Moves fail, presumably because it tries to move within that result set of one record.
Have you tried checking IsBOF() also?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Yes. If I set m_strFilter and do a requery, I find my record. I then clear m_strFilter. If I then hit previous/next the framework will kick off an extended fetch that will error with 100 (SQL No DATA).
What does work, but is kind of ugly is this:
Open the table, scroll through all records, for each do a:
m_pSet->GetStatus(rStatus);
m_Index[m_pSet->m_Nummer] = rStatus.m_lCurrentRecord + 1;
This builds an index of all records and their absolute numbers. Then in my lookup routine:
m_pSet->m_strFilter = "Nummer=?";
m_pSet->m_Nummerfilter = m_persGrund.m_persnrEdit.m_set.m_Nummer;
m_pSet->Requery();
m_pSet->m_strFilter = "";
m_pSet->Requery();
m_pSet->SetAbsolutePosition(m_Index[m_persGrund.m_persnrEdit.m_set.m_Nummer]);
But this seems like a tremenous kludge for such a simple task?
modified on Monday, May 12, 2008 3:16 PM
|
|
|
|
|
Anders Gustafsson wrote: I then clear m_strFilter. If I then hit previous/next...
Since the record has been found, why?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
"Since the record has been found, why?"
You mean "Why hit previous/next" possibly after I have edited and saved? To go to th enext record. Anyway, that is what users do, don't they?
|
|
|
|
|
I have a class allowing us to display a balloon but it requires an exact position or a handle of a ctr. But when I create an icon on system tray, I don't know how to get the position of the icon on system tray & with the handle of the icon I can't display the balloon exactly. So plz help me
|
|
|
|
|
|
You don't need to know the position of the icon - let the system do the work for you.
You can use ShellNotifyIcon to show a popup balloon for you. Lookup the docs for the structure NOTIFYICONDATA, and look at NIF_INFO.
I'm pretty sure there's an article or two here on the subject.
Iain.
Plz sir... CPallini CPallini abuz drugz, plz plz help urgent.
|
|
|
|
|
I've seen NOTIFYICONDATA & NIF_INFO but that balloon just appears when we start our application. I'd like to make it appear whenever we want (click on a button for example)... Help me again plz
|
|
|
|
|
Oh I found a solution, create another NOTIFYICONDATA & add it when we need Thanks alot
|
|
|
|
|
Stored the NOTIFYICONDATA struct for later use (not essential, but makes life easy), tweak the NIF_INFO bits, and use Shell_NotifyIcon(NIM_MODIFY, ...) to do this later on...
Iain.
Plz sir... CPallini CPallini abuz drugz, plz plz help urgent.
|
|
|
|
|
I'm trying to create an MFC extension dll in Visual C++ 6.0. I'm attempting to output the dll with different names to help distinquish the debug files by changing the output file name for the debug configuration...
Project/Settings/Link Tab/Output File Name
I'm getting the following error when I link if I change the output file name from "Test42.dll" to "Test42_DEBUG.dll" in my debug configuration settings.
Linking...
Creating library Debug/Test42_DEBUG.lib and object Debug/Test42_DEBUG.exp
Test42_DEBUG.exp : warning LNK4070: /OUT:Test42.dll directive in .EXP differs from output filename "Debug/Test42_DEBUG.dll"; ignoring directive
Is there another place in the configuration I need to change to get this to work?
|
|
|
|
|
That is because the library file name in the DEF file is not changed,
you can find a file named "Test42.Def" in the project, open the file and edit the LIBRARY section to reflect the change
LIBRARY "Test42_DEBUG"
if that is the case you need two different def files for release and debug and set the def file names in the project options Project/Settings/Link Tab/Project Options then edit the /def:".\Test42_DEBUG.def" for debug configuration.
And also, you can actually safely ignore the warning or donot use def files and go for [__declspec(dllimport) and __declspec(dllexport)
declarators.^]
|
|
|
|
|
That got me past my problem.
Thanks for the help.
|
|
|
|
|
I have a browser which is developed into win32 using IWebBrowser2 interface.
I created one html login page in html which contain username and password text boxes and submit button.
When i click on submit button i need to verify the username and password from windows registry.
So i created one function which is get called after submit button click.
The funtion which retrive the username and password from windows registry.
But i am unable to get the HTML text box contain.
Can anybody tell me how to take and pass the html text box contain into the function which is
get callled after submit button click.
Sorry for the bad english.
Thanks in advance.
|
|
|
|
|
|
Thanks, how to get the html button event into the browser code so that i can execute my method.
|
|
|
|
|
your previous question was to how to get the text from html text box, and if you voted down my previous answer, then it is because that you don't know how to ask question and i don't want to help you any more.
these are the quote from your post,
Member 4620216 wrote: So i created one function which is get called after submit button click.
...
Can anybody tell me how to take and pass the html text box contain into the function which is
get callled after submit button click.
this seems you already handled the submit event, you want to know how to get the text from the html text box.
modified on Tuesday, May 13, 2008 5:43 AM
|
|
|
|
|
This[^] is downvoted for no reason.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
done
|
|
|
|
|
Thanks man.
I was going to ask you for your email ID (The cp "Email" option is not working for me, for some reason). I have a few things to discuss with you and CPallini.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Hi,
I'm looking for a solution to pass a data struct between threads without using a global struct variable.
When i use a local struct variable in THREAD1 and send it with postThreadMessage to THREAD2,
The variable is out of scope and in the debugger get a null pointer (in THREAD2 scope).
If you have a better solution please share.
Thanks.
|
|
|
|
|
talevi wrote: I'm looking for a solution to pass a data struct between threads without using a global struct variable.
You can either do that, or use heap-based memory.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|