473,404 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

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

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.

Dec 11 '06 #1
5 2726

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

Dec 11 '06 #2


On 11 Gru, 13:17, "peter koch" <peter.koch.lar...@gmail.comwrote:
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

Dec 11 '06 #3
exman wrote:
>

On 11 Gru, 13:17, "peter koch" <peter.koch.lar...@gmail.comwrote:
>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
Dec 11 '06 #4
exman wrote:
>
On 11 Gru, 13:17, "peter koch" <peter.koch.lar...@gmail.comwrote:
>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.
Dec 11 '06 #5


On 11 Gru, 13:46, Jacek Dziedzic <jacek.dziedzic.n.o.s.p....@gmail.com>
wrote:
exman wrote:
On 11 Gru, 13:17, "peter koch" <peter.koch.lar...@gmail.comwrote:
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

Dec 11 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Gijsie | last post by:
Hi, We are a small company (2 developers, 6 other people) and develop "out of the box" applications for local government. Our databaseplatform is Oracle. We will stick with Oracle since all out...
0
by: Bryan Ax | last post by:
I posted this to the Visual Studio group 4 days ago, but didn't get any feedback. So, trying again b/c it presents long-term logistical problems for our deployment strategy. I'm currently...
8
by: Shaun Baker | last post by:
Hi, I'm a bit of a novice at this but i'm running into a few problems trying to wrap winpcap in C#. I know I can use a special socket flag to pick up all packets across an interface but this...
4
by: Woody Splawn | last post by:
I have a grid with, lets say, 3 fields in it, Debit, Credit and Comments, in that order. When the user moves to the debit field, if he enters data in it, I would like for the cursor to skip past...
6
by: Woody Splawn | last post by:
I have been using SQL Server 2000 on my stand-alone machine as a back-end to a VS.net application. It is time to switch environments and take the application to the customer. I need to install...
3
by: MartyNg | last post by:
I have been looking online for pointers, and read mixed things. I was hoping if I post direct questions here, I could get some solid answers. I work for a small company with less than 10 web...
0
by: tom c | last post by:
I have three questions concerning moving to version 2.0: 1. I have some ASP.NET 1.1 projects that I may need to do maintenance on in the future, but I would like to do all new projects in ASP.NET...
4
by: =?Utf-8?B?R1Q=?= | last post by:
I have a Form which has a great number of events. I thought I would organize the project by moving some of the code into multiple '.cs' files (since the Form.cs was getting huge). When I move them,...
12
by: =?Utf-8?B?TWFyaw==?= | last post by:
I modified a C# application from Bob Powell that moves graphics primitives around on the screen into a Vb.NET 2005 application. I want to modify this application so along with moving regular...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.