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

Hi !
i have a problem related to winpcap, i'm curretly making a sniffer
aplication for my studies.
I want to accomplish this
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.

I've thought this would work but still no effects pcap_loop(adhandle,
0, &sniffer::Form1::packet_handler, NULL);

Dont know if this is the right place but hope so.
Thx 4 anny help

exman (1)
12/11/2006 12:32:20 PM
vc.mfc 33608 articles. 0 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 33

You are dealing with WinForms namespace in .Net. This is a MFC
newsgroup. You will be better off posting this in a managed VC
newsgroup. Related newsgroups are:

microsoft . public . dotnet . framework . windowsforms
microsoft . public . dotnet . languages . vc


ajaykalra (6842)
12/11/2006 2:46:10 PM

Similar Artilces:

Dialog Focus problem
Hello everyone, I am implementing a Popup window (like Outlook's new message or messenger's someone-signed-in window) based on a CDialog derived window. In order not to interfere with the user's experience, I don't want my dialog window to capture the focus when it shows, so I return FALSE in OnInitDialog. This is working well, until I click a button on the popup window that, in turn, closes the window. The next time the popup window appears after this, it is capturing the focus. I already tried to send a window message to another window when the user clicks the button, an...

Big problem with OAL
Hi After I have installed SP1 on my Exchange server 2003 I get an error when it trays to generate the Offline address list I get at event error 9333 and 9335 I have tried to rebuild of the offline address books, and the problem persisted Can any one help me how to solve my problem? -Anders The 9333 OALGen encountered error 80004005 while opening the base offline address list public folder. Please make sure that a public folder replica exists. - /o=XXX/cn=addrlists/cn=oabs/cn=Default Offline Address List And The 9335 OALGen encountered error 8004010f while cleaning the offline addre...

Weird scrolling problem with folders
I am having a really weird problem with my storage folders and scrolling to the bottom folder in the list. At the bottom of my email account list ( I have 15 email accounts, mostly imap), I have Outbox and underneath it Storage folders. I have a dozen or so folders in storage folders. When I expand storage folders and try to scroll down to the last item and click on it, the list will jump up , it will frequently jump back up a couple of items, and I can't see the bottom of the list. Does anyone have a bunch of folders in Storage folders, and does this happen to you? YOu have ...

Money 2002 problems
Last week, I was editing an entry, and the program crashed. Since that time, I can not open the program. I have tried everyway I can think of, but nothing happens. My operating system is Windows 98. I could reload the progam, but if I do, will I lose my current data. If that is the case, I do have a relatively current backup. Thanks for you help. Dennis H What error do you see? Reinstalling shouldn't affect your data, but I would take a backup copy of your MNY file for safety anyway. -- Glyn Simpson, Microsoft MVP - Money Check

Problem With Front End Server Exchange 2003
i m running exchange 2003 Stan on server 2003. i got Error message on my screen There is no RPC-HTTP Front-end in your exchange Organization. There Must be at Lease on RPC-HTTP Front-end Server in the organization before the RPC-HTTp back and serve. so how can i configuration RPCHTTP Front End On Thu, 6 Jan 2005 08:11:04 -0800, dua <> wrote: >i m running exchange 2003 Stan on server 2003. >i got Error message on my screen >There is no RPC-HTTP Front-end in your exchange Organization. There Must be >at Lease on R...

Collation on moving GP to new server
We have GP9 running on SQL 2000. We will be moving it to a new server with SQL 2005. (and then upgrade to GP 10). The instructions in KB878449 say that the new SQL server sortorder must be the same as the old server. The old server is Latin-General, binary sort. We wanted to make the new server Latin-...CI... Is there any way to do this? Due to the way DynamicsGP makes use of the tempdb, the Server default collation MUST be the same at the DYNAMICS and Company database, otherwise the tempdb will not have the same collation and you WILL get errors. Therefore, the SQL2005 instance must b...

'problem starting the Office Assistant'
Hello, I know this is slightly off-topic but... I'm using Excel from Office 2000 and am getting an error on startup which I'd really like to get rid of: - There was a problem starting the Office Assistant. Would you like to try installing it? I did try to re-install it but it didn't help. Any tips on how to get rid of this would be welcome! Thanks! >From Excel, along the menu at top, click Help and de-select "Show the Office Assistant". I'm biting my tongue, trying to resist the urge to editorialize about THAT particular piece of code. On 21 Nov 2005 18:...

Problems with calendar in 2003
Until a few days ago, when I chose the Calendar button at the bottom of my navigation pane, my calendar used to appear. Now I only get a list of all the appointments etc I have put in my calendar with headings such as Subject, Location, Start, End, Recurrence Pattern. what have I done wrong and how do I get my calendar to again appear when I click on the Calendar button? TIA Liz J <> wrote: > Until a few days ago, when I chose the Calendar button at the bottom > of my navigation pane, my calendar used to appear. Now I only get a &g...

Problems saving excel file from outlook
I have an EU that whenever he saves an excel file from outlook, it will rename the file (by adding the number "2" at the end of the file "file2.xls") and it also changes all the embedding links in the document. (The embedding link of F:\users\file.xls changes to c:\documents and settings\file.xls) Are you setting a Hyperlink base for your links? See Menu > File > Property > Summary tab. Put the original folder location there and when you move or save the file the links will not be renamed. Also assigning a letter to the drive can cause problems (not ...

Problem after e-mail server re-start
Hi, I have the prblem for OWA users to access the Exchange server every times re-started the server, and Outlook users using IMAP connection also experience delays or hangs. The following is found in the event log Source: W3SVC Event ID: 101 The server was unable to add the virtual root '/Exchange' for the directory 'M:\\MBX' due to the following error: The system cannot find the path specified. The data is the error code. From the Internet Services Manager, paths for Exchange, ExchWeb & Exadmin are all unavailable. The first two can be manually r...

Area graph problem.
Hello, I have two columns of data, one for Chainage, and one for Elevation. Basically, it's the data of a track; the chainage is the total distance of a particular track point from the starting, and the elevation is the elevation of that particular track point. Anyhow, when I plot an Area graph with the elevation being the Y-axis, and the Chainage being the X-axis, the Chainage doesn't seem to maintain a constant interval. For example, the total chainage is from 0 to 115 km, and total elevation difference is from 2000m to 4000m. In the Y-axis, the elevation has an interval of 25 m...

cursor moves to where my pointer is while i type
while i am typing in Word or in blogs my cursor will move to the location of the pointer instead of remaining at the end of the last line that i typed. for example, right now while typing this message, the cursor jumped up to the first line of text and i started typing in the middle of that sentence. if my pointer is above the last line of text that i have typed, instead of newly typed words appearing where they belong, at the end of the line that i am typing, they will appear wherever the pointer happens to be located. this takes place about once every few minutes, and if i am not loo...

i have problem with password to email server
i just got on the sight. How do i go about finding out the password to outlook express to the email server. I have to set up a internal email system. and everytime i get to log on outlook express it pops up with a window to enter a user and password. but i dont know it. How do i get my password back. can i get in touch with isp and get it. ...

subform problems 06-12-07
Does anyone know how to make a button on the mainform delete the records showing on its subform which is in datasheet view? Thanks for the help! -- Michael Create a query based on the table or query that is the rowsource of the subform. The query should include the Linkchild field of the subform. Set the criteria of that field to: Forms!NameOfMainForm!NameOfLinkMasterfieldOfSubform Change the query to a delete query. Create a button on the main form and in the On Click event open the query. PC Datasheet Providing Customers A Resource For Help With Access, Excel And Word Applications res...

Send to Remote user problem
Using Exchange 5.5 on a Win 2k server All users in the office work fine. New employee works exclusively on the road, never coming to the office. I set up the account so that the office people could email through Outlook ( obviously wrong ) to the employee's internet email account. Exchange converts the email address to the local email mail box name and nothing is sent. I know this is my error, but I need help fixing it. The SMTP addresses are the in office mailbox and the internet address I want everything sent...

Accelerator key problem on custom button
Hi! I added custom menu button with unique accelerator key on it (Map&e). But, accelerator key do not work on it. Is it possible to enable it? Office 2003 (11.8010.6568) If it doesn't work, the most likely explanation is that there is another = visible command with the same accelerator.=20 --=20 Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 and Microsoft Outlook Programming - Jumpstart for=20 Administrators, Power Users, and Developers =20 "Tom...

Moving Average Formula Problem
I have a workbook with a date on worksheet 1 that indicates data has been entered for that month. On worksheet 2 is are columns of numbers with an average for each column at the bottom. I would like the average to use the date on worksheet 1 to calculate the average. The start of the range is known, but the end of the range is found only by looking up the date on worksheet 1. I have tried to use something like: =AVERAGE(B10:ADDRESS(VLOOKUP(date, range, 1, TRUE). This doesn't work and I can't find the functions needed to make it successful. Thanks in advance for any help! Needs...

Strange Print Problem
My forms have a print button which prints a report displaying the same information shown on the form. So far, so good. I found that a few users were using Ctrl P to print and therefore printing the form instead of the report. I have fixed this problem by calling the print button code when the user presses Ctrl P. This works great except for one form where it ignores the keydown code, UNLESS I press the print button first. If the print button has been pressed previously then Ctrl P works just the way I want it to. But if you press Ctrl P before the print button is pressed the standard p...

Copy (Ctrl C) in a macro
I want to copy the value one field and paste it into another field in a macro. However, when I run the macro and it gets to the Copy command line (CommandExec form BuiLtin command cmdEditCopy ), I get "Command Disabled". Is it possible to copy and paste from within a macro? If so, how do I do it? Never mind - I just figured it out! I need to Edit > Select All before I can Edit > Copy. "Elaine" wrote: > I want to copy the value one field and paste it into another field in a > macro. However, when I run the macro and it gets to the Copy comm...

Problem with delegates Autorisations
Hi All, I have a user that can add delegates to her mailbox however the Autorisation button is always grayed out. What can cause this? only one user and the mailbox rights look OK. We use Outlook 2003 Sp3 and Exchange 2003. Regards, I'd like to add this to my post: -It's the Permission button that remains grayed out -Only one user has the problem. Thanks, "JacquesT" <> a �crit dans le message de news: e0r6HKzmIHA.4504@TK2MSFTNGP06.phx.gbl... > Hi All, > > I have a user that can add delegates to her mailbox however the > A...

Anybody knows native group to discuss C++ fundas ?
Hi, anybody please know microsoft newsgroup to discuss C++ fundamentals and concepts ?? does ms have such kind of group to discuss c or c++ problems.. ?? -- --Jigar Mehta Software Developer +91 98258 69961 "Jigar Mehta" <> wrote in message news:enuTCpmVFHA.3076@TK2MSFTNGP12.phx.gbl... > Hi, anybody please know microsoft newsgroup to discuss C++ fundamentals and > concepts ?? does ms have such kind of group to discuss c or c++ problems.. > ?? > > > -- > --Jigar Mehta > Software Developer > ...

Running Totals Problem
Hi, I=92m having a problem with running totals. I have several spreadsheets with thousands of rows that are broken into groups. I have to create running totals for each group in the spreadsheet. The data is set up as follows, and the running totals formula should be in column C. Column A Column B Column C Apples 1 1 Apples 5 6 Apples 3 9 Oranges 6 6 Oranges 1 7 Pears 2 2 Pears 3 5 Pears 5 10 Plums 8 8 Peaches 3 3 Peaches 2 5 The only way I know of to do this would be to use something like: =3DSUM($B$2:B2) and copy it down for each group...

Problems with Windows XP updates
Downloaded automatic updates have (4) times caused my computer to not restart. Could not start in safe mode to access restore point. Could not reboot to last known good configuration. Had to repair OS and decided to turn off auto updates. I'm now missing too many updates but it's pointless to download updates - mess up my computer - do repair and have the same thing happen again. Any suggestions? The original Windows XP came installed on my computer, but I did buy a backup CD from Microsoft - this is the CD I've used to do OS repairs. My computer summary is li...

nested find in if problem
for excel 2003, the formula =IF(FIND("s",A2:A14),B2,IF(FIND("s",A2:A14),C2,0)) will fail ( show #VALUE as result) when s is not present but "r" is. what can one do about that? Try this: =IF(COUNTIF(A2:A14,"S"),B2,IF(COUNTIF(A2:A14,"R"),C2,0)) Is that something you can work with? -------------------------- Regards, Ron (XL2003, Win XP) Microsoft MVP (Excel) "gs" <gs@dontMail.telus> wrote in message news:uH0U8kNFIHA.748@TK2MSFTNGP04.phx.gbl... > for excel 2003, the formula =IF(FIND("s",A2:A14),B2,IF(FIND(&q...

Ink problems in PPT 2010 Plus
I am having the same inking problem in Office 2010 Plus (not the beta) as I had in the beta version last year. I use a Tablet PC extensively in my classroom and often use my pen to annotate slides during slideshows (cloned display). In PPT 2007, once I turn the ink on, it stays on throughout the slideshow unless I turn it off. In PPT 2010, I have to turn the ink on for each slide, which ruins the functinality for me and my students. Does anybody know if this is a bu or simply a change in functionality in Office 2010? Thanks! PS: I purchased Office 2010 Plus through Journe...