|
Try including some or all of the following in your file:
#include <winsock2.h>
#include <windows.h>
#include "ipexport.h"
#include "icmpapi.h"
#pragma comment(lib, "Ws2_32.lib")
#pragma comment(lib, "iphlpapi.lib")
It may help.
Jerry
|
|
|
|
|
no its wont help still facing the same error
include "stdafx.h"
#include "IPV2.h"
#include "IPV2Doc.h"
#include "IPV2View.h"
#include<winsock2.h>
#include <afxtempl.h>
#include<iphlpapi.h>
#include<icmpapi.h>
#include "ipexport.h"
#include "icmpapi.h"
#pragma comment(lib, "Ws2_32.lib")
#pragma comment(lib, "iphlpapi.lib")
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
this is list of all the includes in CPP file
|
|
|
|
|
Perform DUMPBIN /EXPORTS on both
Ws2_32.dll
and
iphlpapi.dll
and see if the function is actually exported from the DLL.
Maybe you typed the name wrong?
|
|
|
|
|
Could somebody tell me where can I find a article or exaple about to create reports using the Crystal Reports with VC 6++.
Thank
Ariel
|
|
|
|
|
|
How come I got the following error when including my dialog1.h file twice in separate files.
The compiler brakes at:
<br />
class CDialog1 : public CDialog<br />
{<br />
public:<br />
CDialog1 (CWnd* pParent = NULL);
<br />
enum { IDD = IDD_DIALOG1 };
…<br />
};<br />
…<br />
This error is followed by the “error C2057: expected constant expression”
Thanks
_____________________________
...and justice for all
APe
|
|
|
|
|
d00_ape wrote:
enum { IDD = IDD_ CDIALOG1 }; // BRAKES HERE AND GIVES THE ERROR: error C2065: 'IDD_DIALOG1' :
Assuming this line should read
enum { IDD = IDD_DIALOG1 };
Then you need to ensure that IDD_DIALOG1 exist in the following files:
resource.h
<projectname>.rc
Where <projectname> is the name of your project.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
d00_ape wrote:
IDD_ CDIALOG1
first check above IDD_CDIALOG1 present in the Resource.h,
if yes then just include
#include"resource.h"
above class
if no ,look for the real id of dialog
-----------------------------
"I Think It will Work"
Formerly Known As "Alok The Programmer" at CP
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
ThatsAlok wrote:
#include"resource.h"
made it for me!!
Thanks
...and justice for all
APe
|
|
|
|
|
how could I measure size of a folder(including sub-folders and files) from code? tried CFileStatus.m_size, but it seems that MFC doesnt look at a folder as a kind of file. All comments are welcomed, especially with sample code
|
|
|
|
|
Recursively add up the size of each file in each folder. This is a trivial problem with plenty of examples available here at CP, as well as Google.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
hi,
I m using DragAcceptFiles().
now how can i chk which file is draged n droped ,
i want to get file name and path .
some said use DragQueryFile(..)
but return according to MSDN only name of file not full path .
but i m fail to get a name too
thanx
Regards.
|
|
|
|
|
What does your code look like? According to MSDN, the path is included.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
My code is as follows
May be i have mistake in it.
str gives nothing;
void CCloseDlg::OnDropFiles(HDROP hDropInfo)
{
AfxMessageBox ("Darg n drop");
LPTSTR str;
UINT n;
DragQueryFile( hDropInfo, 0xffffffff , str, n);
AfxMessageBox(str);
CDialog::OnDropFiles(hDropInfo);
}
plz make correction
thanx
Regards.
|
|
|
|
|
zahid_ash wrote:
May be i have mistake in it.
Several.
void CCloseDlg::OnDropFiles(HDROP hDropInfo)
{
UINT uCount;
CString strText;
TCHAR szBuffer[MAX_PATH];
uCount = DragQueryFile(hDropInfo, 0xffffffff, NULL, 0);
for (UINT uIndex = 0; uIndex < uCount; uIndex++)
DragQueryFile(hDropInfo, uIndex, szBuffer, sizeof(szBuffer));
CDialog::OnDropFiles(hDropInfo);
}
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hi man,
I have a really urgent matter and I really could use your help
Right now, I am doing an internship in a company and unless I can finish this project correctly, I will have
to re-do my internship
Here it goes
I have to make an application (for a small brokers company) that does the following:
1- Get data from a certain data source (using dll interface) - Step succeeded
2- Turn a first thread to start reading continuous flow of data (c++ structures), transforms them to xml flow
(std::string strXml = ProcessThe Record ) and place the strXml in a Queue
In fact we have 3 Queues (each of which corresponds to the type of message)
2 StaticQueue + 1 Dynamic Queue
3- Turn another thread that creates a socket, and listens to sockets trying to connect
Each new client will start receiving data from the 2 static queues (temporary queues are used coz the data
contained in a static queue need not to be lost)
When this new client receives the static messages, he will start receiving dynamic ones from the dynamic queue
The problem is that the applicaiton is compiled and built successfully
It runs fine but after a while (sometimes half an hour, sometimes 6 hours) it gives me this error
"instruction at ... uses adress memory ... Memory cannot be written"
"Unhandled exception in ....exe NTDLL.dll 0xC0000005 Acess violation"
I tried to debug the application:
I sometimes get the cursor on this line of code : strMsg = dynQ.pop(); (Thread connection)
I have rewritten the Queue class making it a "Synchronized queue" coz I thought it was a "critical section"
We have 2 threads, 1 is reading and the other is writing to the same Queue
Here is the code of the synchronized Queue:
............................................................................................
#include <queue>
#include <deque>
typedef std::queue<std::string, std::deque<std::string,="" std::allocator<std::string=""> > > SQ;
class SynchronizedQueue {
public:
SynchronizedQueue(){ boolTurnIsTaken = false; };
~SynchronizedQueue(){};
std::string pop();
void push(std::string);
void clear();
bool empty();
private:
bool boolTurnIsTaken;
SQ myqueue;
};
std::string SynchronizedQueue::pop() {
std::string res = "";
while(boolTurnIsTaken == true) Sleep (1);
try{
if (!myqueue.empty()){
boolTurnIsTaken = true;
try{
res = myqueue.front();
if (!myqueue.empty()){
try {
myqueue.pop();
}
catch(...)
{
res = "";
boolTurnIsTaken = false;
return res;
}
}
boolTurnIsTaken = false;
}
catch(char *strQ){
res = "";
boolTurnIsTaken = false;
}
}
}
catch(...){
boolTurnIsTaken = false;
res = "";}
return res;
};
bool SynchronizedQueue::empty() {
return myqueue.empty();
};
void SynchronizedQueue::push(std::string xToPush){
while(boolTurnIsTaken == true)
Sleep (1);
try
{
boolTurnIsTaken = true;
myqueue.push(xToPush);
boolTurnIsTaken = false;
}
catch(...){boolTurnIsTaken = false;}
};
void SynchronizedQueue::clear(){
while(boolTurnIsTaken == true) Sleep (1);
std::string strWhat;
try
{
while (!myqueue.empty()){
boolTurnIsTaken = true;
strWhat = myqueue.front();
myqueue.pop();
boolTurnIsTaken = false; }
}
catch(...){boolTurnIsTaken = false;}
};
............................................................................................
The main 3 threads in my application are the following:
- ThreadGetMessage: Read messages from the provider + converts them to XML + Fill the Queues
- ThreadTreatMessage: Creates a server socket + listens to connected clients
Each newly connected client will get the static messages and afterwards it'll start getting dynamic msg
_ ThreadConnection :
Broadcast XML Converted Messages to all Connected Clients
We do not take into consideration the status of the Client
This thread works apart from from the thread that adds New
Clients and provide them with static messages
I am really desperate
Please, your help would be greatly appreciated
/* THREAD No I ---------------------------------------------------------------------------------------
Read Messages + Convert to XML from QuoteSpeed
------------------------------------------------------------------------------------------------------ */
UINT ThreadGetMsg(LPVOID pParam){
// Output File
ofstream foutM("Messages.txt");
std::string strXML, resultat;
int nSize;
nSize = -1;
strXML = "";
resultat = "";
BYTE *bMessageBuffer;
bMessageBuffer = new BYTE [1024];
while(true){
try {
// Reading Msg Buffer
if ( bMessageBuffer != NULL )
{
if ( (nSize=TApiReadRecord(bMessageBuffer)) != NULL ){
try{ // Try to Process the Record
strXML = ProcessTheRecord(bMessageBuffer);
if (strXML.empty()== 0 && strXML.size() > 10){
if (boolMessageisStatic == true){
if (boolMessageisStaticIS == true){
// Add Static Messages to Static Queue for Index and Stocks
staQ.push (strXML.c_str());
foutM << strXML.c_str() << endl;
intTotalStatic ++;
intTotalIndexStock ++;
IntroScreen ();
}
else if (boolMessageisStaticOF == true){
// Add Static Messages to Static Queue for Futures and Options
staQ2.push (strXML.c_str());
foutM << strXML.c_str() << endl;
intTotalStatic ++;
intTotalFutureOption ++;
IntroScreen ();
}
}
else { // It's a Price, Add it to the Dynamic Queue
//while (boolDynQIsBusy)
// Sleep(1);
//boolDynQIsBusy = true;
dynQ.push (strXML.c_str());
//boolDynQIsBusy = false;
foutM << strXML.c_str() << endl;
intTotalDynamic ++ ;
IntroScreen ();
}
} // End if strXML NOT Empty
}// End Try Process the Record
catch( char * strTM ){fout << " Error: ThreadTreatMessage - " << strTM << endl;}
}
else
{
Sleep (10);
}
} // else bMessageBuffer != NULL
else
Sleep (10);
//bMessageBuffer = NULL;
//delete [] bMessageBuffer;
}// End Try
catch (char *strE3){
intErrorCode = 5;
if (strGError == NULL)
strGError = new char [30];
strGError = strE3;
fout << strGError << endl;
IntroScreen ();
getch();
foutM.close ();
return 1;
}
}//End While
foutM.close ();
// Thread completed successfully
return 0;
}
/* End THREAD No I ------------------------------------------------------------------------------------- */
/* THREAD No II --------------------------------------------------------------------------------------
Broadcast Messages to all Connected Clients
------------------------------------------------------------------------------------------------------ */
UINT ThreadTreatMsg( LPVOID pParam )
{
// Server listens on port 4020 + Broadcasts Messages to all conected clients (Specify Port No + No of Connections)
SocketServer in(4020, 10000);
std::string charC, statMsg;
int intCounter = 0;
int intCounter1 = 0;
Sleep (10000);
while (1) {
charC = "";
const std::string b = ".";
Socket* s = in.Accept();
if (s != NULL){
// Give Client Static Messages
charC = in.getCurrentClient();
intTotalClients ++;
IntroScreen ();
statMsg = "";
try {
intCounter = 0;
while (!staQ.empty()) {
// Give the Newly Connected Client Static Messages
statMsg = staQ.pop();
tempQ.push (statMsg); // Add item to the temp Queue
try{
(*s).SendLine(statMsg);
intCounter ++;
}
catch(char *strEConnT1){fout << "Error: Thread Treat Message: " << strEConnT1 << endl; }
} // End While Sta Queue Not Empty
foutCount << "Sent Index and Stocks TOTAL = " << intCounter << endl;
intCounter1 = 0;
while (!staQ2.empty()) {
statMsg = staQ2.pop(); // Give the Newly Connected Client Static Messages
tempQ2.push (statMsg); // Add item to the temp Queue
try {
(*s).SendLine(statMsg);
intCounter1 ++;
}
catch(char *strEConnT2){ fout << "Error: Thread Treat Message 02: " << strEConnT2 << endl; }
} // End While Static Queue 2 Not Empty
foutCount << "Sent Futures and Options TOTAL = " << intCounter1 << endl;
try {(*s).SendLine(b);}
catch(char *strEConnT3){ fout << "Error: Thread Treat Message - Sending Break : " << strEConnT3 << endl; }
// Empty the Temp Q + Refill Static Q
while (!tempQ.empty()) {
try{
statMsg = tempQ.pop();
staQ.push (statMsg);
}
catch (char *strETM3){ fout << "Error: Thread Treat Message - ReFilling Static Queue: " << strETM3 << endl; }
} // End While Static Queue Not Empty
while (!tempQ2.empty()) {
statMsg = tempQ2.pop();
staQ2.push (statMsg);
} // End While Static Queue Not Empty
AfxBeginThread(ThreadConnection, (void*) s);
}
catch (char *strESend ){
intErrorCode = 6;
if (strGError == NULL)
strGError = new char [30];
strGError = strESend;
fout << strGError << endl;
IntroScreen ();
getch();
return 1;
}
} // End if s != NULL
Sleep (4000);
} // End While (1)
return 0; // Thread completed successfully
}
/* THREAD No II ----------------------------------------------------------------------------------- */
/* THREAD No III -------------------------------------------------------------------------------------
Broadcast XML Converted Messages to all Connected Clients
We do not take into consideration the status of the Client
This thread works apart from from the thread that adds New
Clients and provide them with static messages
------------------------------------------------------------------------------------------------------ */
UINT ThreadConnection(LPVOID pParam){
std::string strMsg;
strMsg = "";
try {
Socket* sTC = (Socket*) pParam;
g_connections.push_back(sTC);
socket_list::iterator os;
Sleep (20);
while (1) {
// Old client does Not Get Static Messages
while (!dynQ.empty()) {
try {
strMsg = "";
strMsg = dynQ.pop(); // Read and Remove Message
// Send Message
for (os = g_connections.begin(); os != g_connections.end(); os++){
try { (*os)->SendLine(strMsg);}
catch(char *strEConnT){fout << "Error: ThreadConnection - Sending Message : " << strEConnT << endl; }
} // End For
}
catch (char *strEConn)
{fout << "Error: ThreadConnection - Front + Pop + SendLine: " << strEConn << endl; }
}// End While Dyn Queue Not Empty
Sleep (20);
}// End While (1)
g_connections.remove(sTC);
delete sTC;
}// End try
catch (char *strE2) {fout << "Error: ThreadConnection: " << strE2 << endl; }
return 0;
}
/*------------------------------------------------------------------------------------------------------ */
|
|
|
|
|
hi...
I have no clue in my troubles.
I hope somebody can help me.
Question: How can I prevent from capturing a screen capture utilities or PrintScrn key?
thanks in advance!
|
|
|
|
|
basically you can prevent Printscrn keystoke using the Windows Keyborad hook.
there is dozens of pretty gud article on hook at cp just find using keyword "hooks"
|
|
|
|
|
thanks for your reply.
I understand what you mean.
If i hook the key stroke for print screen, i will prevent from screen capture. OK.
But, I still have a question.
How can i prevent from screen capturing by image capture utilities?
|
|
|
|
|
In my application there are two threads running.
One is main thread which is handled in GUI(front end) another one is
backend thread which is running in the background.
There is a result structure which will be filled by the backend thread and displayed in the gui by main thread.
Each time the new result will be added to the previous one. like iteration info1, 2....10 like that.
When backend thread fills info 1 it generates an event to main thread to display that in gui, and it starts reading/calculating for the second iteration info.
Any iteration info can be displayed only when it is completely filled.
But here i am getting exception as the event for the second one is invoked before the first one is not displayed completely.
Please let me know how to handle this using mutex.
vidya
|
|
|
|
|
You can create two buffers, the thread doing filling fills an alternate buffer each time, the main gui reads from the one NOT being filled.
If you fill faster than you read, however, then you need a thread-safe queue.
The mutex would be locked when you are reading and element from or writing and element to the queue.
|
|
|
|
|
hi,
I m capotruing a video using VC++ and DirectX.
i want to magnify it ,,in running mode Means to say that wil preview / Capturing it.
or in second sense zoom it.
but better word i think is to magnfiy it ,same as when u r getting picture from ur digittal camera u cam zoom / magnify it .
any hint or sample
thanx
Regards.
|
|
|
|
|
Look at source code for ZoomIn developer utility ships with Visual C++.
|
|
|
|
|
hi,
Where can i get this xource code of Zoom in utility of VC++.
plz tell ,
and i want to use zoom in for video previewing that i m building with VC++ and directshow ....
thanx for help
Regards.
|
|
|
|
|
The ZoomIn is a utility that ships with visual Studio 6.0.
I am pretty sure the source code is available from the MSDN library.
Also take a look at PJ's code here:
http://www.codeproject.com/tools/imageviewer.asp
It has ability to zoom in as well.
|
|
|
|