|
Hi.
I was wondering if anyone knows if the OnClose will be called when a connection is abnormally disconnected on the other side (power off or ethernet cable disconnected)? It does not seem to get called.
Is there another way or message etc that can tell me if the ethernet is gone during this abnormal condition? I can see that if the ethernet connection is gone, the icon on the task bar seem to know right away but my application does not. Is there an API that can check this?
Thanks in advance.
Stan the man
|
|
|
|
|
I'm developing a game that relies on hitting a Shift key several times.
During testing the Sticky Keys featured popped up and I read somewhere it could be disabled by setting
the 'flags' value of the registry key HKEY_CURRENT_USER\Control Panel\Accessibility\StickyKeys to zero.
So I set it to zero, but like a dummy, I did not SAVE the original value (possibly it was 26).
I now want to reset it to its original value - I did a very recent Win2000 reinstall, and assumed all default accessibility values.
Would some kind Win2000 user kindly let me know what his/her setting is for this flag - especially if its an install default value - please?
Thanks for the help!
/nick
|
|
|
|
|
the value would be 510.
|
|
|
|
|
Maxim Zarus wrote: the value would be 510.
Thank you Maxim - you just saved me a whole lot of experimenting!!
/nick
|
|
|
|
|
In C++ - What is the keyword "null" (used in C#) or its equivalent
example:
String^ hi="";
hi=null????;
Its is not for String type, it is just an example.
|
|
|
|
|
From MSDN
"NULL is the null-pointer value used with many pointer operations and functions. It is equivalent to 0. NULL is defined in the following header files: CRTDBG.H, LOCALE.H, STDDEF.H, STDIO.H, STDLIB.H, STRING.H, TCHAR.H, TIME.H and WCHAR.H".
|
|
|
|
|
what about when I use the "ref" like this in c#
void Hello(ref Variable^Name){
}
what am I suppose to put instead of that 'ref'?
thank you.
|
|
|
|
|
void Hello(Variable& Name){
}
In C++ you also have pointers so this could also be used:
void Hello(Variable* pName){
}
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
You have this code on the C#
public static void Main()
{
int a=3;
Check();
//Now a is 4
}
public static void Check(ref int i)
{
i++;
}
//and on the c++ you have this code
void CddDlg::OnBnClickedRadio1()
{
int b=1;
test(b);
// now b=2;
}
void test (int &a)
{
a++;
}
|
|
|
|
|
I'm using Visual C++ 6.0 in an SDI application.
After the user selects a menu item and enters some data and the menu is closed, I would like to draw a box in my program client area based on the data the user entered. Visual C++ setup an OnDraw function that gets called when WM_PAINT is sent. So the box I want gets drawn if I change window size and do things like that. However, it doesn't get drawn initially when I close this menu item. The OnDraw function never gets called. So in the code that handles the menu item, somehow I need to do something that makes this OnDraw Get called, but I don't know how to do this.
|
|
|
|
|
What about Invalidate and UpdateWindow?
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
I don't understand how to call Invalidate and UpdateWindow.
When I put Invalidate(); into my code I get a compiler error stating that this is an undeclared identifier. I don't understand how to get rid of that error.
Thanks
|
|
|
|
|
Are you using MFC or Win32 APIs? Can you put a code snippet and the error?
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
|
Here's the more general question I have, which will answer my WM_PAINT post.
I'm using Visual C++ 6.0 MFC in an SDI application.
From another class (defined in separate .h & .cpp files) I would like to call a function called "OnViewShowTest" that is defined in the main program - MainFrm.cpp In my MainFrm.cpp, this OnViewShowTest is called when a Menu Item is clicked. I don't know how to call this same function from a function in another class to do the same thing that happens win the menu item is clicked because I don't understand what object it is associated with. Here's the code snippets
In a header file called MainFrm.h the following snippet is defined:
// MainFrm.h
class CMainFrame : public CFrameWnd
{
protected: // create from serialization only
CMainFrame();
DECLARE_DYNCREATE(CMainFrame)
// Implementation
public:
virtual ~CMainFrame();
afx_msg void OnViewShowwall();
protected: // control bar embedded members
CStatusBar m_wndStatusBar;
CToolBar m_wndToolBar;
// Generated message map functions
protected:
//{{AFX_MSG(CMainFrame)
afx_msg void OnViewShowTest();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
// Now the code for OnViewShowTest is in MainFrm.cpp shown as:
void CMainFrame::OnViewShowTest()
{
// TODO: Add your command handler code here
}
Now I have a function that gets called in another class (actually its in the doc class of my program). That function snippet is:
void CTestProgramDoc::OnNewjobmenu()
{
// I would like to call the OnViewShowTest() from here but I
//don't know how to set things up to do that
}
|
|
|
|
|
I think you are missunderstanding how it works. The MainFrm actually is not the best place to draw things on the "screen", this is better to be done in the CView-derived class. In Grosso Modo the main frame is the class that controls the blue title bar and the menu, not the white surface where the things come
As you are using MFC and Doc-View architechture with SDI application I would make it in other way. You should have a class called CTestProgramView as well. There is the place to handle the things that you are seeing in your application. There is where you should have to code your OnDraw code and the update can be managed with CDocument::UpdateAllViews (NULL), that will call the OnDraw on all views from the document, but as you are in a SDI programm only one view will be drawn. Or, another possibility, inside the CTestProgrammView itself, then you can use Invalidate () and UpdateWindow () as I told you in my first answer, that will "erase" the contents of the view and force it to redraw calling the OnDraw ().
BTW, if you want to make it with your structure, then you can make more or less like that:
extern CTestProgramApp theApp;
CMainFrame *pFrame = (CMainFrame*)AfxGetApp()->m_pMainWnd;
pFrame->OnViewShowTest ();
But as I told you... I would use the Doc-View performance, it will make things easier for you.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
Thanks for the very useful and informative reply. I don't understand
where to learn about things like:
CDocument::UpdateAllViews (NULL)
other than posting a question on sites like these.
Is there some book I should have, or do I need a programming class, or what is the best way to learn about things like this and the other 1000 things I may have questions about with Visual C++ MFC
|
|
|
|
|
You are wellcome
I found some quite good pdfs on the net when I started. One was developing the same example at every chapter, just increasing the code with the new topics. It was quite good. Just take some unused time of your day and do a patient search in google with "Learn MFC", "VC++" and so on, but checking more pages than just the 3 first ones. Pay attention into the description and the end of the link, if it is a pdf you can check it out.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
I am trying to use CObject *pHint in CView OnUpdate.
Here is my instantiation of CObject derived class:
....
m_C_Parameters = new C_Parameters(); // CObject base class
VERIFY(m_C_Parameters);
m_C_Parameters->hello = 10; // set test variable
m_CCCC_ParserDoc->UpdateAllViews(NULL,RED,m_C_Parameters);
....
Variable int hello is declared in C_Parameters();
Here is my OnUpdate override in CView dereived class:
void C_List_View_::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
{
int test = pHint->hello;
.......
However,
the compiler gets me an error:
error C2039: 'hello' : is not a member of 'CObject'
f:\program files\microsoft visual studio\vc98\mfc\include\afx.h(666) : see declaration of 'CObject'
What did I missed?
Thanks for yor help.
Vaclav
<div class="ForumMod">modified on Friday, May 16, 2008 1:01 PM</div>
|
|
|
|
|
You need to cast pHint to C_Parameters* before you can call hello on it.
Henry David Thoreau wrote: Beware of all enterprises that require new clothes.
|
|
|
|
|
Dang, Michael, you beat me to the answer by a minute.
Kelly Herald
Software Developer
|
|
|
|
|
You forgot to cast pHint to your derived class.
C_Parameters *pParameters = (C_Parameters*)pHint;
int test = pParameters->hello;
Kelly Herald
Software Developer
|
|
|
|
|
Thanks a milion! I hope I did not start any feud between both of you!
Vaclav
|
|
|
|
|
I want to know the encoding format of .rc file in VS 2005.
It is neither in UTF-8 encoding not unicode?
So what is the encoding format?
|
|
|
|
|
It's ANSI in my environment.
Henry David Thoreau wrote: Beware of all enterprises that require new clothes.
|
|
|
|