|
How many adapter do u expect? Величие не Бога может быть недооценена.
|
|
|
|
|
I expect to monitor any of the network adapter.
may be 2 ,may be only 1.
|
|
|
|
|
|
EverettJF wrote: when the user disable or enable the adapter, my application could get the notification...Is there any API or methods could work?
Have you looked at the ISensNetwork interface?"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
thanks, may be I should get the COM
|
|
|
|
|
Hi, All!
I am developing an application to show the Text file. Now I derive a class from CScrollView. But I find that the view will flicker at the time I scroll the window when the text is too long to show in one page. So I declare a variable of CBitmap as a member of ScrollView class. Then in the member function of OnUpdate(), I declare a variable of CDC to create a compatibleDC and select the CBitmap into it. After that, I try to draw the view, save the view into CBitmap and Bitblt it into the Device Context of the window in the member funcation OnPaint().
Code:
class CEditorView : public CScrollView
{
......
private:
CBitmap m_bmpMem;
......
}
void CEditorView::OnUpdate(CView* , LPARAM , CObject* )
{
CSize sizeTotal;
GetViewSize(sizeTotal);
SetScrollSizes(MM_TEXT, sizeTotal);
CDC *pDC,memDC;
CBitmap *pOldBmp;
pDC = GetDC();
ASSERT(pDC != NULL);
memDC.CreateCompatibleDC(pDC);
memDC.SetMapMode(m_nMapMode);
m_bmpMem.CreateCompatibleBitmap(pDC,sizeTotal.cx,sizeTotal.cy);
pOldBmp = memDC.SelectObject(&m_bmpMem);
OnDraw(&memDC);
memDC.SelectObject(pOldBmp);
ReleaseDC(pDC);
InvalidateRect(NULL);
UpdateWindow();
}
void CEditorView::OnDraw(CDC* pDC)
{
CEditorDoc* pDoc = GetDocument();
ASSERT(pDoc != NULL);
}
void CEditorView::OnPaint()
{
CPaintDC dc(this);
CDC MemDC;
CBitmap *pOldBitmap;
CSize size;
OnPrepareDC(&dc);
size = GetTotalSize();
MemDC.CreateCompatibleDC(&dc);
MemDC.SetMapMode(m_nMapMode);
pOldBitmap = MemDC.SelectObject(&m_bmpMem);
dc.BitBlt( 0, -size.cy, size.cx, size.cy, &MemDC, 0, -size.cy, SRCCOPY );
MemDC.SelectObject(pOldBitmap);
CScrollView::OnPaint();
}
Question:
1. After I do as above, no text can be shown. I find that it will be shown only when I make the Message Declaration of OnPaint as comment. I don't know how to resolve it. I hope some one could be kind to tell me how to do. Thks!
2. What on earth the relation between OnPaint() and OnDraw()? Why the content can't be seen when I add the function OnPaint()?
Pls help me! Thks a lot!!
whitecloudsThere is some white cloud floating on the blue sky. That's the landscape I like.
modified on Monday, March 8, 2010 4:45 AM
|
|
|
|
|
whiteclouds wrote: What on earth the relation between OnPaint() and OnDraw()? Why the content can't be seen when I add the function OnPaint()?
Read the comments[^]
|
|
|
|
|
Thank Rage!
The message u provide is very useful. And I had make it clear.
By the way, I had resolved this problem. This problem was caused by the wrong parameters when calling dc.BitBlt(...) in the function OnPaint(). There is some white cloud floating on the blue sky. That's the landscape I like.
|
|
|
|
|
Commenting out your handler forces the Doc/View to call its own OnPaint method. In fact, drawing is handled by the OnDraw function in this case.
I presume that the CScrollView::OnPaint(); at the end of your handler erases the result of the code above it.
|
|
|
|
|
I need some hint/help here - I am getting this linker error after I build a DLL using " Regular DLL using shared MFC DLL" option in MFC DLL wizard.
My #include "OpenHR_DLL_Test\OpenHR_DLL_Test.h" is in stdafx.h
I do have the proper library in my Project Setting - Link -General - Object/Library modules as
OpenHR_DLL_Test/Debug/OpenHR_DLL_Test.lib.
I am using VC++ 6.0 and get no compiler errors, except the linker:
Linking...
OpenHR.obj : error LNK2001: unresolved external symbol "public: __thiscall COpenHR_DLL_TestApp::COpenHR_DLL_TestApp(void)" (??0COpenHR_DLL_TestApp@@QAE@XZ)
Debug/OpenHR.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
This is my first attempt on MFC DLL and I have no clue what I missed.
I am not to comfortable troubleshooting linker errors - so a general reference to "how to" would be also appreciated.
Thanks for your help.
Vaclav
|
|
|
|
|
0. It would be easier for you to use a MFC extension DLL at beginning.
Such DLLs do not have own applications instances...
1. Try to find any usage of COpenHR_DLL_TestApp in your code (OpenHR.cpp ?):
it should not be used outside of its owner DLL Check your definition of Irrationality[ ^]
1 - Avicenna
5 - Hubbard
3 - Own definition
|
|
|
|
|
Eugen,
please clarify "outside of its owner DLL".
I do access this DLL in
BOOL COpenHRApp::InitInstance()
{
....
That must be the "problem"?
So how do I use the DLL?
Forgive me these ignorat statements, but this is my first attemt to use DLL.
Vaclav
BTW I tryed MFC extension DLL and got same linker error. Not suprised if the above is correct.
|
|
|
|
|
The InitInstance() of your DLLs application is a task of the Loader,
that is a part of your Windows OS...
Usually -
the people use exported classes and functions of a DLL only
That is why
the wizard does not make the class of the DLLs application exported Check your definition of Irrationality[ ^]
1 - Avicenna
5 - Hubbard
3 - Own definition
|
|
|
|
|
I have no idea what "OpenHR" is, but I'll try to help based on what you've posted.
Vaclav_Sal wrote: Linking...
OpenHR.obj : error LNK2001: unresolved external symbol "public: __thiscall COpenHR_DLL_TestApp::COpenHR_DLL_TestApp(void)" (??0COpenHR_DLL_TestApp@@QAE@XZ)
Debug/OpenHR.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
The first thing to note about a linker error is that everything compiled Ok: all the declarations of the required classes and methods are present. The linker error indicated that it can't find "COpenHR_DLL_TestApp::COpenHR_DLL_TestApp(void) " in "OpenHR.obj". This suggests that the file OpenHR.cpp attempts to construct a COpenHR_DLL_TestApp but the definition for the constructor isn't present (only its declaration). The first step is to have a look and see if it exists.Steve
|
|
|
|
|
the *cpp in which the class COpenHR_DLL_TestApp is implemented got to be included in the project. Or the lib.
Somehow is the ctor declared but not implemented.Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Many thanks to all who replied, I really appreciate it.
But ... I am still confused.
I think the terminology used is part of the confusion.
Let me attempt to clarify what I have done so far.
So I have a application - MFC DLL with *.cpp and *.h files.
I have done this
1. Created "child" direcotory to mine main program - COpenHR_DLL_Test
2. Used wizard to build the MFC DLL "application"
3. Build the COpenHR_DLL_Test DLL.
4. Added this COpenHR_DLL_TestApp to my workspace.
5. Made COpenHR_DLL_TestApp dependent on main application ( OpenHR)
6. Put #include "OpenHR_DLL_Test\OpenHR_DLL_Test.h" into stdafx.h
6.Added the *.lib (in Project - Settings -Link ) OpenHR_DLL_Test/Debug/OpenHR_DLL_Test.lib
7.copied OpenHR_DLL_Test.dll into windows/system32 – I understand it is not necessary
8.Sucessfuly compiled and linked both project in workspace.
9.Added in
BOOL COpenHRApp::InitInstance()
{
COpenHR_DLL_TestApp m_COpenHR_DLL_TestApp;
10.Now it will compile with described linker error.
What you have told me I am missing the implementation of the constructor.
I just do not see where.
I have the header file of the DLL included and the libraly linked.
What else is there??
Here is quote from the *.h as generated by wizard.
// COpenHR_DLL_TestApp
// See OpenHR_DLL_Test.cpp for the implementation of this class
//
In the meantime I'll try using the MFC DLL extension option in the MFC DLL wizard.
Vaclav
|
|
|
|
|
Beeing a geenhorn in MFC DLL I missed AFX_EXT_CLASS !!
Or did the wizard missed it?
I blame it on wizard! It should be smarter - it is building MFC extension DLL in first place!
Or at least make some smart remarks about it!
Anyway, thanks for all you help.
class AFX_EXT_CLASS OpenHR_DLL_Test : public CWnd
|
|
|
|
|
Hai,
Can Anyone give me a link to connect to MySqlServer using CDataBase Class. I searched a lot but i am not able to find out a proper link.Can anyone help me on this??
Thanks,
|
|
|
|
|
|
|
Hi all,
I have developed one win32 dll in VC++ for windows mobile. I need to do some work after each 1 hour, So I want to use Timer in this dll.
Can any one please let me know that how can i use Timer in dll?
Regards,
Rahul Vaishnav
|
|
|
|
|
|
See my answer to (your ?) same post here[^].
ARWhen the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
|
|
|
|
|
I have a parent process that creates a child process that in turn exchanges data with an external network addressed computer. I would like the parent to be able to monitor the amount of data the child is sending and receiving. The application runs on W2K through Win7 and is written in C/C++. I already have the handles and PIDs of both the parent and child and know the internal IP address, external IP address and the IP address and port on the external network computer. I found some sniffer articles on here that may apply but they require a driver installed which I can not allow. Any suggestions or help is appreciated.
|
|
|
|
|