|
FranzKlein wrote:
I am using VC6 SP5 Professional Edition (German).
Here is the error message
I thought the English edition was the only one.
Well my friend, I tried a similar code and I got C2512 too!
I would call it a bug but I'm not a C++ expert!
Rickard Andersson8
Here is my card, contact me later!
UIN: 50302279
E-Mail: nikado@pc.nu
Interests: C++, ADO, SQL, Winsock, 0s and 1s
|
|
|
|
|
What does the CSQLConnection class look like?
|
|
|
|
|
Here are the contents of the .cpp file for the CSQLServerConnection class
#include "stdafx.h"
#include "SQLServerConnection.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
CSQLServerConnection::CSQLServerConnection()
{
}
CSQLServerConnection::~CSQLServerConnection()
{
}
bool CSQLServerConnection::Connect(string database, string host, string user, string password)
{
server_connection = new Connection(database.c_str(), host.c_str(), user.c_str(), password.c_str());
return true;
}
bool CSQLServerConnection::SQLQuery(string query, string& error_message)
{
try
{
Query thequery = server_connection->query();
thequery << query;
}
catch (BadQuery error)
{
error_message = error.error;
return false;
}
return true;
}
Here are the contents of the .h file for the CSQLServerConnection file:
#if !defined(AFX_SQLSERVERCONNECTION_H__72EDA6F0_B4A2_4B36_8353_222CCFB751AB__INCLUDED_)
#define AFX_SQLSERVERCONNECTION_H__72EDA6F0_B4A2_4B36_8353_222CCFB751AB__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <string>
#include <mysql++>
using namespace std;
class CSQLServerConnection
{
public:
CSQLServerConnection();
virtual ~CSQLServerConnection();
bool Connect(string database, string host, string user, string password);
bool SQLQuery(string query, string& error_message);
private:
string database_name;
string user_name;
string query_text;
Connection* server_connection;
Result query_result;
};
#endif // !defined(AFX_SQLSERVERCONNECTION_H__72EDA6F0_B4A2_4B36_8353_222CCFB751AB__INCLUDED_)
|
|
|
|
|
Yes, but what about the CSQLConnection class?
|
|
|
|
|
I renamed the CSQLConnection class to CSQLServerConnection. All other references to CSQLConnection have also been changed to CSQLServerConnection. I think the problem might lie with me using the Halcon Imaging Library (www.mvtec.com).
So in the Document class header file (SQLDocument.h) I have:
class SQLDocument
{
.....
private: CSQLServerConnection* m_DatabaseConnection;
};
and in the implementation file (SQLDocument.cpp) I have:
#include "SQLDocument.h"
#include "SQLServerConnection.h"
<p>
SQLDocument::SQLDOcument()
{
m_DatabaseConnection = new CSQLServerConnection;
}
On my other computer I have swapped the #include statements around in the implementation file:
#include "SQLServerConnection.h"
#include "SQLDocument.h"
Now I don't get any error messages, but then I am not using the Halcon Imaging Library.
|
|
|
|
|
Say we have this Matlab piece of code
nr_of_samples = 10000;
y(1:nr_of_samples) = y_long(1:nr_of_samples);
samplingtime = 1/52e6;
for i=1:nr_of_samples
t(i) = (samplingtime)*i;
end;
I would like to rewrite such a code in VC++. How do I proceed?
Plz do not advise me to use Matlab compiler!
Thx
F.K
|
|
|
|
|
well i could probably help you out a bit but i don't know Matlab. What does this mean in plain english:
flora_k wrote:
y(1:nr_of_samples) = y_long(1:nr_of_samples);
And what is t(i)? Is that some form of plot? If you just want values for a calculation the bulk of the code would look something like:
int nNrOfSamples = 10000;
float fSampling = .00000001923;
float t[ 10000 ];
for( int i = 0; i < nNrOfSamples; i++ )
t[ i ] = fSampling * i;
The above will store your values in an array t. If you are actually looking to plot those values on a graph you have a lot of work ahead of you unless you decide to buy a commerical ( or find a free ) charting package. If you let me know what that one line means i should be able to tell you how to convert it.
Joseph Dempsey
joseph_r_dempsey@yahoo.com
"Software Engineering is a race between the programmers, trying to make bigger and better fool-proof software, and the universe trying to make bigger fools. So far the Universe in winning."
--anonymous
|
|
|
|
|
Try this:
flora_k wrote:
nr_of_samples = 10000
int nrOfSamples=10000;
flora_k wrote:
y(1:nr_of_samples) = y_long(1:nr_of_samples);
for(int i=0;i<nrOfSamples;i++)
{
y[i]=ylong[i];//you have to declare what type of arrays are y and ylong
}
flora_k wrote:
samplingtime = 1/52e6;
float fSamplingTime = .00000001923;
flora_k wrote:
for i=1:nr_of_samples
t(i) = (samplingtime)*i;//you have to declare the type of array of t
end;
for(i=0;i<nrOfSamples;i++)
{
t[i]=fSamplingTime*i;
}
cheers
Daniel Cespedes Daza
"Santa Cruz de la Sierra Paraiso Terrenal!"
daniel.cespedes@ieee.org
|
|
|
|
|
Hi,
I need to send some data from one application to another(MFC).can anybody tell me what is the best way to do it.I may need to invoke a function of one application from another,or i may use any other method to send a buffer across apllication.
Can anybody help me regarding this.
I badly need it.
|
|
|
|
|
Window messages?
Define your custom message and handle it in your app. Use SendMessage() to send your data!
Rickard Andersson8
Here is my card, contact me later!
UIN: 50302279
E-Mail: nikado@pc.nu
Interests: C++, ADO, SQL, Winsock, 0s and 1s
|
|
|
|
|
Thanks Rickard,where can i get the info regarding custom masseges.I am a begginer.
|
|
|
|
|
You can use memory mapped-files perhaps ?
This is a file that is mapped into memory and you can put data in it. You can use a pointer on it to retrieve data !
Take a look at the MSDN documentation (CreateFileMapping, MapViewOfFile, ..)
Hope this helps
|
|
|
|
|
Hi ,
Thanks a lot for suggestion.
Can you please tell me where i can get a good tutorial on this.
|
|
|
|
|
Sorry, no. I don't know any tutorial.
What I can do is perhaps send some code files but it's just some separate files so I don't think it will help you very much.
Can you give me your e-mail adress?
Ced
|
|
|
|
|
I don't know it's good enough?
can anyone sell it;about 300$
Audio chat web server,coded by C++,can run on windows/liunx
ease to install and use.very good audio quality.
|
|
|
|
|
Hi all ,
Can we subclass scrollbar control of editbox, combobox, listbox... in MFC?
How to do it? Please help me!
Thanks alot
|
|
|
|
|
It's no answer, isn't it ?
So boring
|
|
|
|
|
how do i set the font and color of individual controls in an mfc dialog box.
also can i set the foreground color of a CButton.
can someone post some code.
rIsHaBH
|
|
|
|
|
The message you need to handle is different depending on what control you need to override. You should look at the WM_CTRLCOLOR(x) messages. For a button the WM_CTLCOLORBTN would be sent to your dialog ( parent window ) when before the button is drawn. This will allow you to set the foreground color of the dlg. The others are located here:
WM_CTLCOLORBTN[^]
WM_CTLCOLORDLG[^]
WM_CTLCOLOREDIT[^]
WM_CTLCOLORLISTBOX[^]
WM_CTLCOLORSCROLLBAR[^]
WM_CTLCOLORSTATIC[^]
Joseph Dempsey
joseph_r_dempsey@yahoo.com
"Software Engineering is a race between the programmers, trying to make bigger and better fool-proof software, and the universe trying to make bigger fools. So far the Universe in winning."
--anonymous
|
|
|
|
|
Any advice as to which is a good way to add CD data burning capabilities to an app ? Anyone here have any experiences with an SDK or Control?
I think if I could stick to XP that I could use the Image Mastering API, unfortunately not all users have XP yet.
Regardz
Colin J Davies
* WARNING * Save your work This link is to reboot your PC
It's a real shame that people as stupid as you can work out how to use a computer. said by Christian Graus in the Soapbox
|
|
|
|
|
I've heard people say that there's a free Nero SDK that's a good one to use, but I've never done CD burning myself, so I don't know.
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
The SDK is free, but you need Nero installed for it to work...
-
|
|
|
|
|
I'm trying to grab text that is already in a multi-line edit control, append more text to it and then reset the edit control to the new text. Unfortunately I'm getting memory errors after one or two times of performing this process.
Here is the code I'm using:
int cTxtLen = GetWindowTextLength(hwndEdit);
pszMem = (LPTSTR) GlobalAlloc(GPTR, cTxtLen + 1);
GetWindowText(hwndEdit,(LPWSTR)pszMem,cTxtLen + 1);
List = pszMem;
GlobalFree(pszMem);
// run List through a function that appends more text
SendMessage (hwndEdit, WM_SETTEXT, 0, (LPARAM) List.GetBuffer(0)) ;
List.ReleaseBuffer();
Anyone see what might be causing these errors?
Thanks,
stf
|
|
|
|
|
Not good code. You aren't checking any return values. You are using old 16bit Global memory functions. You haven't said what the errors are, which makes helping quite difficult. Have you ruled out "function that appends more text" isn't the culprit.
What is wrong with:
GetWindowText( &List ) assuming you have a CWnd or
CWnd::FromHandle( hwndEdit )->GetWindowText( &List ) if you don't.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Also note:
cTxtLen + 1
should be
cTxtLen + sizeof(TCHAR)
Trust in the code Luke. Yea right!
|
|
|
|