|
I put that in stdafx.h, right? Well, I tried it there and it said:
[quote]
Line (13) : warning C4083: expected 'string'; found identifier '_T'
[/quote]
...then I tried it in the main source file and it said the same. I have seen that suggested in other forums, do I need to put the path as well or just the name? Do I still need to add the references to the lib in the link tab or no? BTW, since I have read to use the pragma thing, I have tried it this way:
[quote]
#pragma comment( lib, "wpcap.lib")
[/quote]
...and that did not work as well. I thought the added _T() thing would be the solution. thanks anyway.. any more ideas from anyone? thanks
|
|
|
|
|
borono wrote: #pragma comment( lib, "wpcap.lib")
What is the exact error when you try using this? Can you copy and paste the output from the bottom of MSVC.
|
|
|
|
|
sure, here it is:
--------------------Configuration: test - Win32 Release--------------------
Compiling...
test.cpp
C:\test.cpp(24) : error C2065: 'pcap_findalldevs_ex' : undeclared identifier
C:\test.cpp(24) : error C2065: 'PCAP_SRC_IF_STRING' : undeclared identifier
Error executing cl.exe.
test.dll - 2 error(s), 0 warning(s)
thanks in advance
|
|
|
|
|
This is not a lib error, this error means you are trying to use a function which the compiler cannot find. Did you include the header file for winpcap
#include <pcap.h>
-- modified at 0:42 Sunday 2nd April, 2006
|
|
|
|
|
yes. I added it to the project via project > add to project > files... then in code as you have above. I looked in the header and the pcap_findalldevs_ex identifier is not listed, only pcap_findalldevs is, and neither is PCAP_SRC_IF_STRING.. those are identified in the wpcap.lib file. That is why I assumed the lib was not linked properly. I have the associated .dll for the lib, so it should work if linked properly, I assume. I must have screwed something up in the transition. It has to be in the way I am linking the header or lib. Assuming the header is present, the lib is linked via the links tab, what else could be the problem and/or possible soultion? I appreciate the help guys. thanks
|
|
|
|
|
borono wrote: those are identified in the wpcap.lib file
A defined function is only a function name, these will be in your header files and they tell the compiler that there is a function of that type, the linker then tries to find it.
A declared function is a function and all of it's code, this would be in a source file, or in your case a lib file.
The problem you are having is that the compiler doesn't know that the function exists.
Add this line directly before you include pcap.h #define HAVE_REMOTE
and let me know.
-- modified at 1:09 Sunday 2nd April, 2006
Another note, you can't find them in the header file because you are looking in the wrong one. Take a look in the remote-ext.h header file
|
|
|
|
|
I dont know if I did the equivalent. I did this and it compiled with no errors, just a minute ago.
1. Project
2. Settings
3. C/C++ tab
4. Change Settings For to All Configurations
5. Preprocessor Defintions add: HAVE_REMOTE
6. OK
I now have to figure out why the dll when called is crashing the app. At least I can start working on the code again, that was rather annoying to deal with, indeed. I will try to do it your way to see if that makes a difference at run time. I appreciate the help a lot, I might come back once I get a handle on this dll and actually start coding something. I will most likely have questions. haha
Anyway, I guess this is solved. Thanks again
best regards
|
|
|
|
|
borono wrote: I dont know if I did the equivalent.
There is no difference, they will both do the same thing
|
|
|
|
|
Hi Nish,
I was visiting your site recently and about the method of showing a message box after the main window is closed on an mfc app, i have 2 alternatives. (I decided to contact you here)
1) Removing the WM_QUIT message from the queue after dlg.DoModal() returns.
2) Calling AfxOleLockApp() at the beginning of InitInstance and then calling AfxOleUnlockApp() and AfxPostQuitMessage(0) when i really have to quit.
Best regards and great articles you have,
Mauro Leggieri.
-- modified at 4:45 Sunday 2nd April, 2006
|
|
|
|
|
Mauro Leggieri wrote: i have 2 alternatives. (I decided to contact you here)
How about contacting him directly? or Posting the question in related forum.
http://www.voidnish.com/ContactMe.aspx[^]
Got Signature?
|
|
|
|
|
Hi,
He wrote in his site to contact him by email or any can found him on codeproject's lounge and I was unsure if I post the message in other forum he would see it.
It was a simple choice and my intention was not to offend anyone.
Best regards, Mauro.
|
|
|
|
|
Is this shot priceless or what?
Young Nish
and cool Window Sizer app - I was looking for something like that for making consistently sized screencasts.
Montreal great Guy Lafleur, quoted by CBC on being mugged while vacationing recently in Buenos Aires: "I didn't have any time to react before I got a sucker-punch in the eye. It was like one of the players from the Bruins."
|
|
|
|
|
Hi!
I have got a dialog application that incorporates an openGL Window. When I call an AfxMessageBox my whole application just stalls when it is supposed to come up. Does anyone know why that would be? I am just using the normal command
AfxMessageBox("Errormessage");
Thanks in advance!
|
|
|
|
|
Its because AfxMessageBox creates a model dialog box, which is supposed to prevent interaction with application. I you want to be able to interact with application while a dialog is being showed look for modeless dialog in msdn.
-Saurabh
|
|
|
|
|
Oh but the message box does not even show up! Or could it be that I just can't see it, but don't think so. I tried the message box in another dialg application (which is a lot simpler though) and it works fine there. Very strange!!
|
|
|
|
|
are you sure line containing AfxMessageBox is being executed. can you try to put a breakpoint at that line, run in debugging mode, and see if control reaches that line.
-Saurabh
|
|
|
|
|
hi,
please help me, how to access picture in memory
i have try used DirectShow but stiil can't
|
|
|
|
|
Can you be more explicit? what's the source of picture, what format is it in.
-Saurabh
|
|
|
|
|
Hello,
I wrote one post this day to my problem. Now I am able to describe my problem more detailed. So once more:
I want to write a base class and a class that manage a list of objects derived from my base class. The list-class should have a = operator that copies the whole list and creates copies of all its elements (derived from base class).
The base class is derived from CObject because of serialisation and so on. It also includes some basic methods and members.
<br />
class CBase::Cobject<br />
{<br />
....<br />
}<br />
Now I derive some classes from it.
<br />
class CA::CBase<br />
{<br />
}<br />
<br />
class CB::CBase<br />
{<br />
}<br />
<br />
All classes should have a = operator to copy its elements!
The list-class now have a list of pointers to some instances from CA und CB in a CObArray.
The = operator of the list-class shoud create a copy of the list an the members.
<br />
CBase* pElement1;<br />
CBase* pElement2;<br />
CRuntimClass* pRTC;<br />
int nIndex;<br />
<br />
for (nIndex=0; nIndex<pList->GetCount(); nIndex++)<br />
{<br />
pElement1 = pList->GetAt(nIndex);<br />
pRTC = pElement1->GetRuntimeClass();<br />
pElement2 = (CBase*)pRTC->CreateObject();<br />
pRTC = pElement2->GetRuntimeClass();<br />
*pElement2 = *pElement1;<br />
Add(pElement2);<br />
}<br />
<br />
pList is a pointer to the source CObArray-Object.
Add() adds an element in the destination CObArray-Object.
Now the problem:
*pElement2 = *pElement1 do not call the = operator of CA or CB. The = operators have no virtual behaviour. The result ist that not all elements (CBase and CA/CB) are copied. Only the = operator of CBase is called.
What is to do? And how can i call in the = operator function of CA the = operator funrction of CBase to copy the base elements?
And one more question:
What is the reason for the Cxyz& return type of the = operators and the return(*this) statement?
Thanx
Dr-Kuulun
|
|
|
|
|
operator= is not inherited and (I think) cannot be virtual. Polymorphism wouldn't apply to an assignment because the compiler has to know exactly what types are involved in an assignment. Each class is responsible for its own copying/assignment behavior.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
But the operator is represented by a function. Functions can be virtual. Why is it not possible for an operator? Now I wrote a virtual clone-function an the list class calls this function to copy the elements. This way works fine.
Dr-Kuulun
|
|
|
|
|
hi
i m using this code to for fileopen dialog with multiselection of files.
here is it
::OPENFILENAME ofn;
char *szFileName=new char[1024];
ZeroMemory(szFileName, sizeof(szFileName));
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn); // SEE NOTE BELOW
ofn.lpstrFilter = "Bitmap Files (*.bmp)\0*.bmp\0All Files (*.*)\0*.*\0";
ofn.lpstrFile =szFileName;
ofn.nMaxFile = 1024;
ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST|OFN_ALLOWMULTISELECT|OFN_READONLY;
ofn.lpstrDefExt = "bmp";
CString str;
if(GetOpenFileName(&ofn))
{
MessageBox(ofn.lpstrFile);
MessageBox(szFileName);
str=ofn.lpstrFile;//szFileName ;
CString temp;
str.Trim();
int index;
while(str.GetLength()>0)
{
index=str.Find('\0') ;
temp=str.Left(index);
MessageBox("The Extract:\t"+ temp);
str=str.Mid(index+1,str.GetLength());
MessageBox("The Remaing\t"+ str);
}
}
for single file selection it shows the full file name. for multiselection the ofn.lpstrFile contain only the directory name and nothing else i had shown that on the msgbox. it prints the directory. where in MSDN i read the after directory name then null and then file names are present. which are not.
Tasleem Arif
|
|
|
|
|
Your problem is here:
str=ofn.lpstrFile;
The CString will only contain up to the first NULL in the ofn.lpstrFile.
When the CFileDialog return OK, you need to do something like this:
pos = filedlg.GetStartPosition();<br />
while (pos != NULL)<br />
{<br />
name = filedlg.GetNextPathName(pos);<br />
m_pathlist.AddTail(name);<br />
m_pFileList.AddString(name);<br />
}<br />
m_pFileClear.EnableWindow(TRUE);<br />
m_pFileTouch.EnableWindow(TRUE);
That gets each file name selected and adds them to a CStringArray (m_pFileList) for later use.
Hope that helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
<kmedcalf@ev1.net>
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
thanks for reply but i wanted to use only API not MFC class
char *pdes=::strchr(ofn.lpstrFile,'\0');
index=(int)(pdes-ofn.lpstrFile+1);
Drive=ofn.lpstrFile;
ofn.lpstrFile+=index;
while(strlen(ofn.lpstrFile)>0)
{
char *pdes=::strchr(ofn.lpstrFile,'\0');
index=(int)(pdes-ofn.lpstrFile+1);
str=ofn.lpstrFile;
ofn.lpstrFile+=index;
MessageBox(Drive+str);
}
dats solution i worked out thanks for answering me
Tasleem Arif
|
|
|
|
|