|
Hi !
I am ran into a great problem I can not solve.
How can we set IP over two modems that are connected togheter ?
A BIG thanks in advance.
|
|
|
|
|
find it out yourself or ask more special questions about it!
Don't try it, just do it!
|
|
|
|
|
Hello, everyone!
When using the following program to check in/out band width of a network adapter, the band width is always zero. Anyone know how to resolve the trouble?
Source Code:
----------
#include <windows.h>
#include <conio.h>
#include <stdio.h>
#include <pdh.h>
#include "iphlpapi.h"
#include "Iptypes.h"
#include "Iprtrmib.h"
#pragma comment(lib,"iphlpapi.lib")
int main (int argc, char** argv)
{
unsigned long pOutBufLen = sizeof (IP_ADAPTER_INFO);
IP_ADAPTER_INFO AdapterInfo;
memset (&AdapterInfo, 0, sizeof (IP_ADAPTER_INFO));
MIB_IFROW ifrow;
DWORD last_sent, last_recv, current_sent, current_recv;
DWORD diftime, dlwinspeed, upwinspeed, dw_refreshtime;
if( GetAdaptersInfo(&AdapterInfo, &pOutBufLen) != ERROR_SUCCESS ){
printf("Could not open default interface!");
return ( 0 );
}
ifrow.dwIndex = AdapterInfo.Index;
if( GetIfEntry( &ifrow ) != NO_ERROR ) {
printf("Could not open default interface!");
return ( 0 );
}
while (1)
{
current_sent = ifrow.dwOutOctets - last_sent;
current_recv = ifrow.dwInOctets - last_recv;
last_sent = ifrow.dwOutOctets;
last_recv = ifrow.dwInOctets;
printf ("Octs out: %ld\n", ifrow.dwOutOctets);
printf ("Octs in: %ld\n", ifrow.dwInOctets);
diftime=(GetTickCount()-dw_refreshtime);
dlwinspeed = current_recv/diftime;
upwinspeed = current_sent/diftime;
dw_refreshtime=GetTickCount();
printf ("Band in: %ld\n", dlwinspeed);
printf ("Band out: %ld\n", upwinspeed);
Sleep (5000);
}
return 0;
}
----------
Thanks in advance,
Geo
|
|
|
|
|
When I compile my .exe the compiler give me this error:
"error LNK2020: unresolved token (0A0000FD) SysStringByteLen"
"error LNK2020: unresolved token (0A000101) SysAllocStringByteLen"
This problem occur when I set the proprety project "Treat wchar_t as Built-in Type" (in th C/C++\Language Menu) to "No". My project use Managed Extensions and C# class.
I try (how is described in MSDN) to include "oleauto.h" and to link oleaut32.lib, but it was all in vain.
Thank you very much for any answer.
|
|
|
|
|
Anyone knows how SysIternal's FileMonitor gets it's information?
TIA
Peter
"Vierteile den, der sie Hure schimpft mit einem türkischen Säbel."
mlog || Agile Programming | doxygen
|
|
|
|
|
hey peter
this is a good question, and i have the answer.
it is using a file system filter hook!
you can email me if you want further help...
greez, alex
Don't try it, just do it!
|
|
|
|
|
Not exactly (other than what is shown here), but I've e-mailed Dr's Russinovich and Cogswell in the past and they have been helpful. They obviously don't give away trade secrets, but if something is available and it is just rather hard to find, it shouldn't be a problem. They might even point you to one of their books.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
"On Windows NT the heart of Filemon is a file system driver that creates and attaches filter device objects to target file system device objects so that Filemon will see all IRPs and FastIO requests directed at drives."(http://www.sysinternals.com/ntw2k/source/filemon.shtml):
also known as File System Filter Driver (Hook)!
Don't try it, just do it!
|
|
|
|
|
And you sent this to me because?? I know what their site says, which is why I referenced it in my reply. If that paragraph is a good enough description of what is going on, fine. If not (which I assumed was the case), contacting the author(s) is the way I'd go.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
I've ben pondering your sig for a while now.
Either you're tricking me - or there's something I'm missing
would "two birds" be an inappropriate answer?
"Vierteile den, der sie Hure schimpft mit einem türkischen Säbel."
mlog || Agile Programming | doxygen
|
|
|
|
|
peterchen wrote:
would "two birds" be an inappropriate answer?
decided to fly away != actually did fly away
I got caught by that too.
The kindest thing you can do for a stupid person, and for the gene pool, is to let him expire of his own dumb choices.
[Roger Wright on stupid people]
We're like private member functions
[John Theal on R&D]
We're figuring out the parent thing as we go though. Kinda like setting up Linux for the first time ya' know...
[Nitron]
|
|
|
|
|
Hello!
How is the memory allocated when using new ? The problem is that I have to allocate many single entries which are very small and I don't know now how that will affect memory consumption and speed.
For example:
Will
int i;
for(i = 0; i < 1000; i++)
p[i] = new DWORD[1]; waste much memory than if I would use
p = new unsigned char[4000]; Actually the entries aren't that simple and the code above should be meant just as an example. If I want to allocate lets say 16 bytes, does the memory allocation routine round that number up somehow and allocate more than I need?
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
i don't know how it is alloced, it's heap memory, so prolly by malloc.
use the debugger and follow the new call to find out, how it works!
Don't try it, just do it!
|
|
|
|
|
The first example will eat *much* more memory than the second.
Heaps are typically organized as a list of memory blocks that are either used or available. Since you might want to free the allocations in the first example individually, it needs to keep some extra information for each allocation.
The first one can slow down a program considerably, first because of memory footprint, second because searching for a matching free block takes longer (because there are much more blocks to look at). Many allocations of that small size are not recommended from the normal heap.
However, you can use a custom allocator that better fits your needs.
"Vierteile den, der sie Hure schimpft mit einem türkischen Säbel."
mlog || Agile Programming | doxygen
|
|
|
|
|
Ok, thank you Then I will have to do some sort of custom allocator.
Dominik
Btw: der Link zum Agile Programming tut nicht mehr direkt
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
Dominik Reichl wrote:
If I want to allocate lets say 16 bytes, does the memory allocation routine round that number up somehow and allocate more than I need?
Yes.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Hi guys,
I can't believe how much hassle I'm having trying to trap a user's confirmation of a CEdit entry. I have a toolbar with a CEdit control on it. Ideally the user should only input numbers.
What's the best strategy to catch the obligatory ENTER confirmation? I create the toolbar and CEdit control in CMainFrame, but CMainFrame doesn't get any of the key notifications.
Any ideas?
Many thanks,
S
Multimedia programmer, trying to learn a grown-up language!
|
|
|
|
|
Do you get the key notifications in PreTranslateMessage of your CMainFrame before they go to the edit control etc. If you do, you can trap and process them there.
Roger Allen
Sonork 100.10016
Death come early, death come late,
It takes us all, there is no reason.
For every purpose under heaven,
To each a turn, to each a season.
A time to weep and a time to sigh,
A time to laugh and a time to cry,
A time to be born and a time to die.
Dust to dust and ashes to ashes,
And so I end my song.
|
|
|
|
|
Thanks Roger, that worked great.
Multimedia programmer, trying to learn a grown-up language!
|
|
|
|
|
#include "ColourSelection.h"
ect. until
void CProjectView::OnInitialUpdate()<br />
{<br />
CFormView::OnInitialUpdate();<br />
GetParentFrame()->RecalcLayout();<br />
ResizeParentToFit();<br />
ChangeColour();
<br />
}<br />
<br />
void CProjectView::ChangeColour()<br />
{<br />
CColourSelection *pSelector = new CColourSelection(this);<br />
pSelector->Create(CColourSelection::IDD, this);<br />
pSelector->ModifyStyle(0,WS_VISIBLE);<br />
delete pSelector;<br />
Invalidate();<br />
}
I can't understand why the dialog box ISN'T opening
Anyone has any knows the correct code or what is the bug in my code?
|
|
|
|
|
Alton Williams wrote:
delete pSelector;
You are destroying immediatly the dialog box you have created. Destroy the object in CColourSelection::PostNcDestroy instead.
void CColourSelection::PostNcDestroy()<br />
{<br />
delete this;<br />
}
Silence Means Death
Stand On Your Feet
Inner Fear
Your Worst Enemy
|
|
|
|
|
KaЯl wrote:
Destroy the object in CColourSelection::PostNcDestroy instead.
I've tried that but dialog is still not opening.
KaЯl wrote:
void CColourSelection::PostNcDestroy()<br />
{<br />
delete this;<br />
}
I want to extract values from dialog object priorto destruction in my CFormView class. Hence, it's not appropiate for CColourSelection to "commit suicide".
|
|
|
|
|
Alton Williams wrote:
I've tried that but dialog is still not opening
You have also to call pColourSelection->ShowWindow(SW_SHOW);
Are you sure the problem doesn't come from your CColourSelection class?
Alton Williams wrote:
Hence, it's not appropiate for CColourSelection to "commit suicide".
It's not exactly a suicide. The PostNcDestroy method is called after the destruction of the dialog box (destruction != deleting). This method allows to free the memory you've allocated with the new CColourSelection .
Check your mail, I've send a small app showing the use of a modeless dialog.
HTH,
K.
Silence Means Death
Stand On Your Feet
Inner Fear
Your Worst Enemy
|
|
|
|
|
How do I make them disappear...
I've tried:
cs.dwStyles = ~ WS_VSCROLL;
But it causes the framework to not create a document or something like that...
Any ideas how I can go abouts doing this...?
Thanks
Cheers
I'm drinking triples, seeing double and acting single
|
|
|
|
|
Are you sure the scrollbars are carried by the CMDIChildFrame, and not by the embedded view contained in the Child Frame?
What kind of view do you use?
Silence Means Death
Stand On Your Feet
Inner Fear
Your Worst Enemy
|
|
|
|