|
No reason other than it was the first key I came to that had the EventMessageFile value.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hi:
I have tried to insert 600 columns in the list control each of width of 70 ,only about 409 columns headers appear in the list ? any suggestions..
|
|
|
|
|
I would sure hate to have to navigate that many columns. Anyway, perhaps a grid control is more up to the task.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Is there anyone that know how to save the web page that shown in a web browser control to HTML File?
G Nagendran
|
|
|
|
|
VARIANT vtEmpty;<br />
vtEmpty.vt = VT_EMPTY;<br />
m_WebBrowserCtrl.ExecWB(OLECMDID_SAVEAS,OLECMDEXECOPT_PROMPTUSER,&vtEmpty,&vtEmpty);
|
|
|
|
|
Thank you very much... It's working...
G Nagendran
|
|
|
|
|
This program will put the menu on the screen but
it won't print the results to the screen.
/* Currency equivalence to the Dollar*/
#include <stdio.h>
float Australian_Dollar; //Australian Dollar
float Euro; //Euro Dollar
float British_Pound; //British_Pound Dollar
float Japanese_Yen; //Japanese_Yen Dollar
float Swiss_Franc; //Swiss_Franc Dollar
/* Dollar conversion */
int main(void)
{
/* 13 */
int menunum; /*Defines the menunum as an integer for the scanf */
float count;
while (menunum != 0) {
printf (" Select a currency by entering a the number beside the currency. \n\n");
printf(" Enter q to quit.\n\n");
printf (" 1. Australian Dollar \n");
printf (" 2. Euro \n");
printf (" 3. British Pound \n");
printf (" 4. Japanese Yen \n");
printf (" 5. Swiss Franc \n"); /* 28 */
scanf("%f", &menunum); /* 30 Users enters the number on the menu bar */
if (menunum == 1){
printf("%f\n", Australian_Dollar);
} /* Australian_Dollar */
else if (menunum == 2) {
printf("%f\n", Euro);
}
else if (menunum == 3) {
printf("%f\n", British_Pound);
} /* 41 British_Pound */
else if (menunum == 4) {
printf("%f\n", Japanese_Yen);
} /* Japanese_Yen */
else if (menunum == 5) {
printf("%f\n", Swiss_Franc);
} /* 51 Swiss_Franc */
else {
printf("Choose another or quit.\n");
}
Australian_Dollar = 1.43; // 50 Define Australian dollar
Euro = 0.83; // Define Euro currency
British_Pound = 0.55; // Define British Pound
Japanese_Yen = 110.9; // Define Janpanese Yen
Swiss_Franc = 1.28; // Define Swiss Franc
scanf ( );
return 0;
}
|
|
|
|
|
madref wrote:
scanf("%f", &menunum);
You're mixing float and int here.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
HANDLE icmphandle = IcmpCreateFile();
if(icmphandle=INVALID_HANDLE_VALUE )
AfxMessageBox("Error");
char reply[sizeof(icmp_echo_reply)+8];
DWORD dw = IcmpSendEcho(icmphandle,inet_addr(IPAddress),0,0,NULL,reply,sizeof(icmp_echo_reply)+8,1000);
IcmpCloseHandle(icmphandle);
return dw ;
the above mentioned code when executed gives the following error
"The Procedure entry point IcmpcreateFile could not be found in dynamic link library iphlpapi.dll "
|
|
|
|
|
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;
}
/*------------------------------------------------------------------------------------------------------ */
|
|
|
|