|
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.
|
|
|
|
|
I have never done this, but the last 2 weeks I have been developing a service that loads a dll and installs a WH_KEYBOARD_LL hook in the system, and I have need some help and a lot of information.
There are a lot of good articles in the MSJ and in the MSDN about your question, but I'm sure about it's possible, the only thing you have to control is if the GUI is ready: if nobody has logged in and the desktop is not ready your gui will crash.
MSJ article:
Why Do Certain Win32 Technologies Misbehave in Windows NT Services?
There you will find info. about another article of Jeff Richter that clarifies more services.
Well, at last let me beg your pardon, my english it's very bad. (I'm novice with it...)
|
|
|
|
|
Messages are easy enough - just call MessageBox with the MB_SERVICE_NOTIFICATION flag set. No need to be logged in.
Administration really is best done by a separate desktop app communicating with the service - for example, you could set up a loopback TCP connection on an unused port with which to communicate from your admin dialog to the service.
If _monitoring_ the service is the primary goal, maybe UDP would be easier.
|
|
|
|
|
A good book on Services is Programming Server-Side Applications for Windows 2000.
It covers NT in general, and points out the pitfalls in advance, along with integration/administration/performance, scalability, security and stability issues which you should be aware of if writing services.
Its kind of a service bible.
Giles
|
|
|
|
|
Hi!
Possible decision - create the regular GUI application (may be - CPL), that stores the config info into the Registry, and in the service use RegNotifyChangeKeyValue to be informed, when the change occured, to be able to retrieve the new values.
Regards,
Gennady
|
|
|
|