|
I have to develop an application that "sniffs" all UDP
packets sent over the LAN.
How can I develop this functionality ??
Are there some VC++ sample applications ??
Thanks a lot !!!
|
|
|
|
|
See WinPcap[^]
Cheers,Joao Vaz
Three primary LAN architectures for Network Engineers,
under the sky,
Seven OSI layers for the Open System Architects,
in their halls of stone,
Nine N-xDU operations* for mortal Developers,
doomed to die,
One protocol suite for the Dark Sysadmin,
in his dark server room,
In the land of mordor.net,
where the shadowed fibers lie
|
|
|
|
|
Hi all,
I want to declare on a method that one of its parameter is a pointer to a function. the function is not the same for each call, meaning it can get different parameters each time..... i know i need to use the 3 dots to define the undetermined parameters....
touble is i am not familier with the syntax of either cases.....
can any1 help plz?
thanks in advanced
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
|
tons of thanks!
cheers
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Try something like...
typedef void (* TFunction)(int param1, ...);
void MyFunction(TFunction pF)
{
pF(90, 30, 20, 10);
};
Best regards
jAB
|
|
|
|
|
thanks man,
that's really helpfull
cheers
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
an other question please...
what is the syntax for calling the MyFunction?? what do i pass as parameter for TFunction PF??? can u show me code
thanks
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Here is the whole code...
typedef void (* TFunction)(int param1, ...);
void MyFunction(TFunction pF)
{
pF(90, 30, 20, 10);
};
void OtherFunction(int param1, ...)
{
// Do something
}
// Calling...
...
MyFunction(OtherFunction);
...
|
|
|
|
|
thanks..
c code is a little misunderstood for me... i will describe the problem i have in c++ maybe you can write the proper example code :
the class CBDRMainDlg contains the called method :
class CBDRMainDlg
{
public
.
.
void ClearIt();
};
the class also contains a function called add that one of its parameters is a pointer to the method ClearIt:
class CBDRMainDlg
{
public
void Add(
.
.
void ClearIt();
};
out side the class in on other class i am defining an object of the class:
...
...
CBDRMainDlg dlg;
dlg.DoModal();
see all the remarks above, can u replace them with the proper code?
thanks again for all your help
Cheers
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
This is sintactically correct:
class CBDRMainDlg;
typedef void (CBDRMainDlg::* DlgMethod)(void);
class CBDRMainDlg
{
public:
void Add(DlgMethod method)
{
};
void ClearIt()
{
printf("Clear It");
};
};
int main(int argc, char* argv[])
{
CBDRMainDlg dlg;
dlg.Add(CBDRMainDlg::ClearIt);
return 0;
}
... but i can't figure out how to call the method inside 'Add' since the compiler needs to push the this pointer in the stack before make the calling. It is possible using inline asm but i think that is not the best solution...
Why do you want to call methods this way? I think you can do that using virtual methods...
|
|
|
|
|
I have a problem, I´m trying to use the IP address control in a VC++ 5.0 project. The code should be ok, but, when the resources are to be compiled, it does not recognise the SysIPAddress32 control.
Does anybody have a solution for this, i.e. do I have to set the control (in the resource editor) as a custom control, and if yes, how?
Thanks in advance
Phil
bum... and I thought I´d got rid of all the bugs
|
|
|
|
|
HI,
are you able tyo create CIPAddressCtrl
and use ??
please help me if you can
thanks
sarfu
|
|
|
|
|
Sorry, but if you look at the date, this is over 6 years ago, and for the life of me I can't remember how I got it to work... I've moved onto "Greener Pastures" now
Cheers
Phil
Who the f*** is General Failure, and why is he reading my harddisk?
|
|
|
|
|
Hi,
I need some help please.
I tried to figure it out, but with no success so far.
Why do I get E_INVALIDARG when I try to use the appendChild Function.
This is my source code:
IHTMLElement* pHTMLElement;
IHTMLElement* pNewHTMLElement;
IHTMLDOMNode* pHTMLDOMNode;
IHTMLDOMNode* pNewHTMLDOMNode;
IHTMLDOMNode* pNew2HTMLDOMNode;
IDispatch* pDisp;
v.vt = VT_BSTR;
v.bstrVal = SysAllocString(L"HEAD");
hResult = pIHTMLElementCollection->tags(v,&pDisp );
if (hResult == S_OK)
{
hResult = pDisp->QueryInterface(IID_IHTMLElementCollection,(void**)&pIHTMLElementCollection);
if (hResult == S_OK)
{
pIHTMLElementCollection->get_length(&lCollectionSize);
v.vt = VT_I4;
v.lVal = 0;
hResult = pIHTMLElementCollection->item(v,v,&pDisp);
if (hResult == S_OK && pDisp != NULL)
{
hResult = pDisp->QueryInterface(IID_IHTMLElement,(void**)&pHTMLElement);
if (hResult == S_OK)
{
hResult = pHTMLElement->QueryInterfa(IID_IHTMLDOMNode,(void**)&pHTMLDOMNode);
if (hResult == S_OK)
{
bstrTemp = SysAllocString(L"BASE");
hResult = pIHTMLDocument2->createElement(bstrTemp, &pNewHTMLElement);
SysFreeString(bstrTemp);
if (hResult == S_OK)
{
bstrTemp = SysAllocString(L"href");
v.vt = VT_BSTR;
v.bstrVal = strWebPageDomain.GetBuffer();
hResult = pNewHTMLElement->setAttribute(bstrTemp, v, 0);
SysFreeString(bstrTemp);
if (hResult == S_OK)
{
hResult = pNewHTMLElement->QueryInterface(IID_IHTMLDOMNode,(void**)&pNewHTMLDOMNode);
if (hResult == S_OK)
{
****************************************************************************
hResult = pHTMLDOMNode->appendChild(pNewHTMLDOMNode, &pNew2HTMLDOMNode);
****************************************************************************
}
}
}
}
}
}
}
}
}
}
|
|
|
|
|
Good morning,
I have a problem with adding an file to a mail.
This process should use OLE Automation. I already figured out all the other things, but I'm not able to do that...
I also found no help in the msdn library, so you out there are my last chance...
Thanks in advance.
|
|
|
|
|
Hi there,
I have created a MDI Application which has two view(one derived from CEditView and other with CView) and get the data from one Document. No my problem is that i have used the method for Open/Save Filters using the article in this site and when i open the txt it is opening CEditView but the problem is that it is not opening the contents in the file. How to solve this problem if anybody knows plz reply me fast.
Sreeramachandra G
|
|
|
|
|
Hi
Any one can help me in finding the IOCTRL for a Driver for a special Hardware. because I need to communicate with the driver in Kernel Mode not in user mode , and this Hardware have an interface via dll and the dll connect to the driver
Thanks for any help
Fadi
|
|
|
|
|
oh, hi fadi
there are some types of IOCTLs, the standard ones and the custom ones.
to find out the standard ones, read the DDK and/or the DDK header files.
the custom ones are a problem...
good luck,
alex
Don't try it, just do it!
|
|
|
|
|
<br />
szBuffer[0] = '\0';<br />
<br />
strncpy(szBuffer, cMediaFileInfo.szFrameRate, strlen(cMediaFileInfo.szFrameRate) - 4);<br />
<br />
<br />
szBuffer[strlen(cMediaFileInfo.szFrameRate) - 4] = '\0';<br />
double dFramerate = atof(szBuffer);<br />
dFramerate is always 0.
|
|
|
|
|
|
Your code snippet does not show the allocation for szBuffer. Are you show it is at least as large as say 6 or more bytes?
Chris Meech
It's much easier to get rich telling people what they want to hear. Chistopher Duncan
But for a man, barbecuing eggplant and portobello mushrooms is a sure way to have people question your sexual orientation. Kuro5hin
|
|
|
|
|
I used CHtmlView to display html page.
And I create a new thread as my work thread.
In my work thread , I call m_pMyHtmlView->Navigate2(...) to navigate to a html page.
The problem is when my program runs,the downloadComplete isn't be done sometime. And the URL I open is the file in the local computer with my program. So I don't know why the download is fail?
I try to debug it,and find the function run like under:
OnBeforeNavigate2()
DownloadBegin()
DownloadComplete()
DownloadBegin()
-------------------if error happens,the under don't be done
OnTitleChange
NavigateComplete()
DownloadComplete()
OnTitleChange
DocumentComplete()
Why after execute DownloadBegin() not execute DownloadComplete()?
Does anybody meet the status like this?
The error doesn't happen every time.Sometimes it happens after program runs 5 minutes. Some time the program work well whole day.
When the error happens,the thread of CHtmlView doesn't work.Even if the work thread call's m_pmyHtmlView->Navigate2(...),the thread of CHtmlView does't respond.It seems that thread was blocked.
|
|
|
|
|
Design the necessary classes for a program that would allow a state government office to track vehicle registrations/license plates. The program should at least allow tracking of the Registrant, the Vehicle, and the Registration Details including fees paid.
What are 4-7 classes I could use to write this program?
|
|
|
|
|