|
Thanks, I'll give it a try, but the Field I'm filtering is a long. We'll see what happens when I query it with a string. As you can see, I'm real new at this, and can use all the help I can get.
Richard
|
|
|
|
|
I am looking to change the background color of a static text box. Howz it done..?
Thanks,
John
|
|
|
|
|
Have a look at the message WM_CTLCOLOR.
Create a subclass of CStatic and override the WM_CTLCOLOR message. You should get a function afx_msg HBRUSH OnCtlColor( CDC* pDC, CWnd* pWnd, UINT nCtlColor );
Simply set the text colour when nCtlColor = CTLCOLOR_STATIC
|
|
|
|
|
Hello,
Is there a way to implement the OnChange() function for a int member vairable that is defined through a class? I have a int that changes every second like in a count down timer. I need to updateData(TRUE) every second for this int so it reflects the correct value, the only way I know how to do this is through the OnChange() function like you would use with a edit box control.
Thanks,
Rob Jones
|
|
|
|
|
If it happens every second, what's wrong with OnTimer ?
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
I initialize the int's through a OnStartButton funtion.. In OnTimer I am comparing the values of the 2 int's and displaying the count down time. Once I press the start button it initializes the correct int value and the OnTimer displays the correct count down value but when I do a TRACE on the count down int it shows that the int stays the same value as when I first initialized it and it only updates the one time(in trace). I need for the value to be updated every time it changes so when the OnTimer is comparing the two values and they reach a defined value my program executes a event. I was using a edit box to define the inital value of the int but now I'm pulling the value from a CString.
Rob
|
|
|
|
|
Forget all of that stuff I just wrote.. I see what I was doing wrong..
Thanks for the help!
Rob
|
|
|
|
|
What stuff ?
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
I'm dumb, I was not tracing under OnTimer..
|
|
|
|
|
I have two MFC projects- each with any number of resources. The first project is an EXE module and the second is an MFC extension dll. The extension dll is linked into EXE (explicitly) at runtime. How do I get the EXE project to know resources in the DLL project?
I tried using the View->Resource Include options (readonly symbols), but it doesn't seem to work.. .
|
|
|
|
|
I think the simplest method would be to export a function that returns the DLL's resource handle -- see AfxGetResourceHandle(). Then when you’re loading your resources from that DLL, all you would need to do is call AfxSetResourceHandle() and pass it that DLL's handle...
HINSTANCE hInstOld = AfxGetResourceHandle ();<br />
ASSERT ( NULL != hInstOld );<br />
ASSERT ( NULL != hMyDLLResourceHandle );<br />
AfxSetResourceHandle ( hMyDLLResourceHandle );<br />
<br />
<br />
AfxSetResourceHandle ( hInstOld );
-Ben
---------
On the topic of code with no error handling -- It's not poor coding, it's "optimistic"
|
|
|
|
|
I try to change the value of a subitem of a item.
I do this :
-------------
int Index;
LVITEM ItemData;
CString strItem;
CString FileName;
Index = m_FindItemListCtrl(FileName);
ItemData.iItem = Index;
ItemData.mask = LVIF_TEXT | LVIF_STATE;
ItemData.iSubItem = 0;
ItemData.stateMask = 0xFFFF; // get all state flags
TransControlList.GetItem(&ItemData);
//Change subitem 3
strItem.Format(Progress);
ItemData.iSubItem = 3;
ItemData.pszText = (LPTSTR)(LPCTSTR)(strItem);
TransControlList.SetItem(&ItemData);
TransControlList.Update(Index);
This doesn't work! what's wrong?
Thanks a lot
|
|
|
|
|
|
I've implemented a SDI program which spawns a bunch of modeless child windows (dialogs) and I need a way for a dialog to enumerate all it's siblings in MFC. I tried the following code in my dialog code:
CWnd *wnd = GetWindow( GW_HWNDFIRST );
while ( wnd != NULL )
{
process( wnd );
wnd = wnd->GetWindow( GW_HWNDNEXT );
}
But it enumerates all kinds of unexpected things such as child buttons on itself as well as siblings. All I want are the sibling dialogs.
Any ideas?
|
|
|
|
|
I don't believe you can get only siblings using GetWindow. The easiest way to solve your problem would be filtering the output GW_HWNDFIRST/GW_HWNDNEXT loop. If your dialogs have DECLARE_DYNAMIC/DYNCREATE/SERIAL, just test wnd->GetRuntimeClass()->m_lpszClassName.
Another solution: keep the list of open dialogs. Update the list in CYourDialog::OnInitDialog/DestroyWindow.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
In my propertyPages I need to use member variable of their propertySheet object But it is unidentified .
How can I call this variable ???
I tried this:
-------------------------------------
CMyPropSheet* pSheet;
pSheet= (CMyPropSheet*)GetParent();
pSheet->myVariable.....
---------------------------------------
But in run-time when the program make the line :
pSheet= (CDefinitions*)GetParent();
it thrown out with the MessgeBox:
--------------------------------
Debug Assertion Failed
File:afxwin2.inl
Line:265
__________________________________
What can I doing ???
|
|
|
|
|
look on the prev question please.
|
|
|
|
|
In what event do you have the code?
Because I think that the problem is that the propertySheet is not initialized.
cheers!!!
Carlos Antollini.
|
|
|
|
|
Is it possible for message map functions to be inherited? I'm trying to catch the ON_WM_ERASEBKGND message, and code the handler for all subclasses. I basically just put "virtual" in the message map:
virtual afx_msg BOOL OnEraseBkgnd(CDC* pDC);
But the subclasses aren't executing the code. Am I trying to do something that I was never meant to do?
thanks,
Jake
|
|
|
|
|
You can achieve the 'inheritance' using second param of BEGIN_MESSAGE_MAP macro...
BEGIN_MESSAGE_MAP(CSubclassedWnd, CBaseWnd)
... where CBaseWnd is a class where OnEraseBkgnd does its job. No need to make it virtual.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hello,
I think this is not the best place to ask, but I have used it a long time with extremely good results, and I don't know where to search for an answer...
Does anybody know how to do it?
Thank you in advance...
|
|
|
|
|
Hi,
Is there any catch to using the ON_CONTROL_RANGE handler? The debug version of my executable works fine but the release bombs when I use it. And if I replace ON_CONTROL_RANGE with individual handlers for all controls, the release version works fine!
Any pointers will be appreciated!
Thanks!
|
|
|
|
|
Be very sure you have used the correct num of parameters and return type in your handler. Most of these macros exhibit this 'crash in release' prob if you get this wrong.
|
|
|
|
|
Hi,
I have created a fantastic NT service which does some cool stuff. However, I need a method to Administer this fabulous app. Ideally I'd like to be able to popup a GUI in the service with a windows message or something.
Is it possible for a Service to have a GUI? I've looked into it a little and saw the article here about the NT Service with a shell tray icon, but I need a full dialog based GUI.
Possible?
Cheers
James
|
|
|
|
|
this is straight forward. Invoke your dialog in the normal fashion with CDialog. (just like its done from the CApp implementation in a MFC framework based dialog appwizard project).
You're service needs to be able to "Interact with the desktop" though.
|
|
|
|