Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > moving from c++ to visual studio c++ (winpcap)

Reply
Thread Tools

moving from c++ to visual studio c++ (winpcap)

 
 
exman
Guest
Posts: n/a
 
      12-11-2006
Hi !
i have a problem related to winpcap, i'm curretly making a sniffer
aplication for my studies.
I want to accomplish this
http://www.winpcap.org/docs/man/html...cap__tut3.html
but in visual studio, the problem is related to the function

pcap_loop(adhandle, 0, packet_handler, NULL);

it has a pointer to the function packet_handler.
It works fine in console, but how do i make it work in windows forms??

a have made an form with an button which pressed should do the stuff
that the function main does in te program from the above linlk, but
should call the function from inside the class like this:

namespace sniffer {
/ /code
public ref class Form1 : public System::Windows::Forms::Form
{
....................


private: System::Void buttonStart_Click(System::Object^ sender,
System::EventArgs^ e) {
//some code

pcap_loop(adhandle, 0, packet_handler, NULL);

}//koniec obslugi przycisku start

public: void packet_handler(u_char *param, const struct pcap_pkthdr
*header, const u_char *pkt_data)
{ }

};


the function reference worked fine when i've putted it outside the
class but then i dont know how to get the data from the function to
members of the class.

 
Reply With Quote
 
 
 
 
peter koch
Guest
Posts: n/a
 
      12-11-2006

exman skrev:
> Hi !

[snip]
> it has a pointer to the function packet_handler.
> It works fine in console, but how do i make it work in windows forms??
>
> a have made an form with an button which pressed should do the stuff
> that the function main does in te program from the above linlk, but
> should call the function from inside the class like this:
>
> namespace sniffer {
> / /code
> public ref class Form1 : public System::Windows::Forms::Form
> {
> ....................
>
>
> private: System::Void buttonStart_Click(System::Object^ sender,
> System::EventArgs^ e) {

[snip]
The code above is not C++, so why do you post it here? If it is C#,
post your question in a forum dedicated to that language (probably
public.microsoft........)

/Peter

 
Reply With Quote
 
 
 
 
exman
Guest
Posts: n/a
 
      12-11-2006


On 11 Gru, 13:17, "peter koch" <(E-Mail Removed)> wrote:
> exman skrev:
>
> > Hi !

> [snip]
> > it has a pointer to the function packet_handler.
> > It works fine in console, but how do i make it work in windows forms??

>
> > a have made an form with an button which pressed should do the stuff
> > that the function main does in te program from the above linlk, but
> > should call the function from inside the class like this:

>
> > namespace sniffer {
> > / /code
> > public ref class Form1 : public System::Windows::Forms::Form
> > {
> > ....................

>
> > private: System::Void buttonStart_Click(System::Object^ sender,
> > System::EventArgs^ e) {[snip]

> The code above is not C++, so why do you post it here? If it is C#,
> post your question in a forum dedicated to that language (probably
> public.microsoft........)
>
> /Peter


Its visual C++ not C# thats why i post it here

 
Reply With Quote
 
Kai-Uwe Bux
Guest
Posts: n/a
 
      12-11-2006
exman wrote:

>
>
> On 11 Gru, 13:17, "peter koch" <(E-Mail Removed)> wrote:
>> exman skrev:
>>
>> > Hi !

>> [snip]
>> > it has a pointer to the function packet_handler.
>> > It works fine in console, but how do i make it work in windows forms??

>>
>> > a have made an form with an button which pressed should do the stuff
>> > that the function main does in te program from the above linlk, but
>> > should call the function from inside the class like this:

>>
>> > namespace sniffer {
>> > / /code
>> > public ref class Form1 : public System::Windows::Forms::Form
>> > {
>> > ....................

>>
>> > private: System::Void buttonStart_Click(System::Object^ sender,
>> > System::EventArgs^ e) {[snip]

>> The code above is not C++, so why do you post it here? If it is C#,
>> post your question in a forum dedicated to that language (probably
>> public.microsoft........)
>>
>> /Peter

>
> Its visual C++ not C# thats why i post it here


It's not C++ as defined per ISO/IEC 14882. That's why it does not belong
here.


Best

Kai-Uwe Bux
 
Reply With Quote
 
Jacek Dziedzic
Guest
Posts: n/a
 
      12-11-2006
exman wrote:
>
> On 11 Gru, 13:17, "peter koch" <(E-Mail Removed)> wrote:
>> exman skrev:
>>
>>> Hi !

>> [snip]
>>> it has a pointer to the function packet_handler.
>>> It works fine in console, but how do i make it work in windows forms??
>>> a have made an form with an button which pressed should do the stuff
>>> that the function main does in te program from the above linlk, but
>>> should call the function from inside the class like this:
>>> namespace sniffer {
>>> / /code
>>> public ref class Form1 : public System::Windows::Forms::Form
>>> {
>>> ....................
>>> private: System::Void buttonStart_Click(System::Object^ sender,
>>> System::EventArgs^ e) {[snip]

>> The code above is not C++, so why do you post it here? If it is C#,
>> post your question in a forum dedicated to that language (probably
>> public.microsoft........)
>>
>> /Peter

>
> Its visual C++ not C# thats why i post it here


This is not C++ -- that funky "^" character is a dead giveaway,
unless you do weird things with your preprocessor, like

#define ^ &

Anyway, you've got a wrong newsgroup here, try the microsoft
hierarchy.

- J.
 
Reply With Quote
 
exman
Guest
Posts: n/a
 
      12-11-2006


On 11 Gru, 13:46, Jacek Dziedzic <(E-Mail Removed)>
wrote:
> exman wrote:
>
> > On 11 Gru, 13:17, "peter koch" <(E-Mail Removed)> wrote:
> >> exman skrev:

>
> >>> Hi !
> >> [snip]
> >>> it has a pointer to the function packet_handler.
> >>> It works fine in console, but how do i make it work in windows forms??
> >>> a have made an form with an button which pressed should do the stuff
> >>> that the function main does in te program from the above linlk, but
> >>> should call the function from inside the class like this:
> >>> namespace sniffer {
> >>> / /code
> >>> public ref class Form1 : public System::Windows::Forms::Form
> >>> {
> >>> ....................
> >>> private: System::Void buttonStart_Click(System::Object^ sender,
> >>> System::EventArgs^ e) {[snip]
> >> The code above is not C++, so why do you post it here? If it is C#,
> >> post your question in a forum dedicated to that language (probably
> >> public.microsoft........)

>
> >> /Peter

>
> > Its visual C++ not C# thats why i post it here This is not C++ -- that funky "^" character is a dead giveaway,

> unless you do weird things with your preprocessor, like
>
> #define ^ &
>
> Anyway, you've got a wrong newsgroup here, try the microsoft
> hierarchy.
>
> - J.


Ok i'll try another group

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Free Moving Estimate, Local Movers, Long Distance Moving, PackingSupplies, Storage Rental, Home Moving, Apartment Moving, Office Moving,Commercial Moving linkswanted ASP .Net 0 01-06-2008 04:45 AM
Should I write Visual studio 2005 or Visual studio 2003 MCSD =?Utf-8?B?VmlqYXk=?= Microsoft Certification 14 06-30-2006 09:05 AM
Is Visual Studio Team System and Visual Studio Foundation Server are same?. Thirumalai ASP .Net 0 05-22-2006 08:48 AM
visual studio .net 2003 verses visual studio .net 2002 wh ASP .Net 2 01-16-2004 04:54 PM



Advertisments