Click here to Skip to main content
16,007,163 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: WM_USER OR WM_APP How to Pin
tahirjhangvi10-Dec-02 3:47
tahirjhangvi10-Dec-02 3:47 
GeneralWord Wrap Pin
Dennis L9-Dec-02 10:45
Dennis L9-Dec-02 10:45 
QuestionRemove CStatusBar Gripper?? Pin
RobJones9-Dec-02 10:15
RobJones9-Dec-02 10:15 
AnswerRe: Remove CStatusBar Gripper?? Pin
pranavamhari9-Dec-02 14:22
pranavamhari9-Dec-02 14:22 
Generalaghghghghh!!!!! Pin
joshfl9-Dec-02 7:55
joshfl9-Dec-02 7:55 
GeneralRe: aghghghghh!!!!! Pin
Maximilien9-Dec-02 8:00
Maximilien9-Dec-02 8:00 
GeneralRe: aghghghghh!!!!! Pin
Rickard Andersson209-Dec-02 8:03
Rickard Andersson209-Dec-02 8:03 
GeneralRe: aghghghghh!!!!! Pin
joshfl9-Dec-02 8:23
joshfl9-Dec-02 8:23 
sorry Smile | :)

heres the code

......

	int  len;                                   // Length of returned email address.
	int  result;
	char c2[255];	                            // Storage for returned email address
	char c3[]="\0"; // Email address ignore list (pipe delimited).
	char c4[]="";            // License key (See comments above.)

<br>
	//// starting message
	AfxMessageBox("Starting The Bouncer!"); 
<br>

	/// Open the DSN Connection
	HENV hEnv = NULL; // Env Handle from SQLAllocEnv()
	HDBC hDBC = NULL; // Connection handle
	HSTMT hStmt = NULL;// Statement handle
	UCHAR szDSN[SQL_MAX_DSN_LENGTH] = "cplusmysql";// Data Source Name buffer
	UCHAR szUID[10] = "xxxx";// User ID buffer 
	UCHAR szPasswd[10] = "xxxx";// Password buffer
	UCHAR szModel[128];// Model buffer
	SDWORD cbModel;// Model buffer bytes recieved
	RETCODE retcode; // Return Code
<br>	// Allocate memory for ODBC Environment handle
	SQLAllocEnv (&hEnv);
	// Allocate memory for the connection handle
	SQLAllocConnect (hEnv, &hDBC);
<br>	// Connect to the data source using userid and password.
	retcode = SQLConnect (hDBC, szDSN, SQL_NTS, szUID, SQL_NTS, szPasswd, SQL_NTS);

<br><br>	// load api
	BOOL freeResult, runTimeLinkSuccess = FALSE; 
	HINSTANCE dllHandle = NULL;     		
	BounceCheckType BounceCheckPtr = NULL;
	dllHandle = LoadLibrary("bBounce.dll");

<br>	//Get pointer to function using GetProcAddress:
	BounceCheckPtr = (BounceCheckType)GetProcAddress(dllHandle,"BBBOUNCECHECK");

	if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)
	{
		// Open directory for read
		CFileInfoArray fia;
		fia.AddDir(
		   m_spoolpath,                                // Directory
		   "*.*",                                      // Filemask (all files)
		   TRUE,                                       // Recurse subdirs
		   CFileInfoArray::AP_SORTBYNAME | CFileInfoArray::AP_SORTASCENDING, // Sort by name and ascending
		   FALSE                                       // Do not add array entries for directories (only for files)
		);
	
		/// here will start the directory iteration
		for (int ji=0;ji<fia.GetSize();ji++) {

		    ifstream is;
		    is.open (fia[ji].GetFilePath(), ios::binary );
		    // get length of file:
		    is.seekg (0, ios::end);
		    int length = is.tellg();
		    is.seekg (0, ios::beg);
		    // allocate memory:
		    char * c1 = new char [length+1];
		    // read data as a block:
		    is.read (c1,length);
		    is.close();
		    c1[length+1] = '\0';

			// call api function
			if(NULL != dllHandle) 
			{
				// If the function address is valid, call the bbounce api's function. 
				if (runTimeLinkSuccess = (NULL != BounceCheckPtr))
				{
					 result = BounceCheckPtr(*c1, *c2, len, *c3, *c4);
				}
			}

			///// prepare database entry
			UCHAR szSqlStr[128];
			if (result == 1) { 

				sprintf((char*)szSqlStr,"INSERT into bouncetest Values ('HB', '%s')",c2);

				SQLAllocStmt (hDBC, &hStmt); 
				// Prepare the SQL statement by assigning it to the statement handle
				SQLPrepare (hStmt, szSqlStr, sizeof (szSqlStr)); 
				// Execute the SQL statement handle
				SQLExecute (hStmt); 
				// Project only column 1 which is the models
				SQLBindCol (hStmt, 1, SQL_C_CHAR, szModel, sizeof(szModel), &cbModel);
				// Get row of data from the result set defined above in the statement
				SQLFetch (hStmt);
				// Free the allocated statement handle
				SQLFreeStmt (hStmt, SQL_DROP);
			}

			// delete memory i create on heap
			delete[] c1;

		}
		// end directory iteration

	    //Free the library:
	    freeResult = FreeLibrary(dllHandle);	

	}

	//// End the DSN Connection	
	// Disconnect from datasource
	SQLDisconnect (hDBC);
	// Free the allocated connection handle
	SQLFreeConnect (hDBC); 
	// Free the allocated ODBC environment handle
	SQLFreeEnv (hEnv);

	AfxMessageBox("Finished Sorting Bounces");

GeneralRe: aghghghghh!!!!! Pin
Joaquín M López Muñoz9-Dec-02 8:40
Joaquín M López Muñoz9-Dec-02 8:40 
GeneralRe: aghghghghh!!!!! Pin
joshfl9-Dec-02 8:59
joshfl9-Dec-02 8:59 
GeneralRe: aghghghghh!!!!! Pin
carrie9-Dec-02 9:03
carrie9-Dec-02 9:03 
GeneralRe: aghghghghh!!!!! Pin
joshfl9-Dec-02 9:43
joshfl9-Dec-02 9:43 
GeneralRe: aghghghghh!!!!! Pin
Joaquín M López Muñoz9-Dec-02 9:09
Joaquín M López Muñoz9-Dec-02 9:09 
GeneralRe: aghghghghh!!!!! Pin
joshfl9-Dec-02 9:50
joshfl9-Dec-02 9:50 
GeneralRe: aghghghghh!!!!! Pin
Joaquín M López Muñoz9-Dec-02 9:58
Joaquín M López Muñoz9-Dec-02 9:58 
GeneralRe: aghghghghh!!!!! Pin
joshfl9-Dec-02 10:33
joshfl9-Dec-02 10:33 
GeneralRe: aghghghghh!!!!! Pin
Joaquín M López Muñoz9-Dec-02 10:54
Joaquín M López Muñoz9-Dec-02 10:54 
GeneralRe: aghghghghh!!!!! Pin
Ranjan Banerji9-Dec-02 10:54
Ranjan Banerji9-Dec-02 10:54 
QuestionWrite to an RTF File with MFC? Pin
mickelthepickle9-Dec-02 7:45
mickelthepickle9-Dec-02 7:45 
AnswerRe: Write to an RTF File with MFC? Pin
Le centriste9-Dec-02 7:50
Le centriste9-Dec-02 7:50 
AnswerRe: Write to an RTF File with MFC? Pin
Rohit  Sinha9-Dec-02 8:54
Rohit  Sinha9-Dec-02 8:54 
GeneralAnyone know a good article about.... Pin
Le centriste9-Dec-02 7:38
Le centriste9-Dec-02 7:38 
GeneralRe: Anyone know a good article about.... Pin
Dudi Avramov10-Dec-02 2:10
Dudi Avramov10-Dec-02 2:10 
GeneralRe: Anyone know a good article about.... Pin
Le centriste10-Dec-02 14:37
Le centriste10-Dec-02 14:37 
GeneralWindows dialog in other languages .... Pin
PhD9-Dec-02 6:57
PhD9-Dec-02 6:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.