|
so what i do, create proper one. want to used any specific wizard.
Thankyou...
|
|
|
|
|
Why don't you answer to my questions? Why do you need a C++ DLL if the Framework is involved? Cannot you simply write a C# function?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
ya possible to write C# code. but why i am trying like this, in our application need some more algorithm to further development that also have c++ code. which is not possible to write c# code . thats may take more time. But c++ code is working properly also tested. so only we are going c++ code.
Thankyou
|
|
|
|
|
In order to build an ordinary DLL with Visual Studio (at least the 2005 one), you may choose Win32 project and then DLL in the Application Settings window.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi,
I already download the example code and try to connect to MySQL using "mysql-connector-c++-noinstall-1.0.5-win32-vs2005".
The problem that I'm facing is, I can't even compile the code-error:
fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory
The example program that I used is as below. I already change the setting, include the HEADER file and INCLUDE file while compiling, but still got error.:
#include "mysqlplus.h"
#include <stdio.h>
sql_connection_c::sql_connection_c()
{
host = user = password = database = 0;
opendbbase = 0;
errc = 0;
}
sql_connection_c::sql_connection_c( char *__database, char *__host, char *__user, char *__password )
{
host = user = password = database = 0;
opendbbase = 0;
errc = 0;
connect( __database, __host, __user, __password );
}
sql_connection_c::~sql_connection_c()
{
if ( host )
{
delete[] host;
host = 0;
}
if ( user )
{
delete[] user;
user = 0;
}
if ( password )
{
delete[] password;
password = 0;
}
if ( database )
{
delete[] database;
database = 0;
}
OPENDB *odb;
for ( odb = opendbbase; odb; odb = odb->next )
{
mysql_close( &odb->mysql );
}
while ( opendbbase )
{
odb = opendbbase;
opendbbase = opendbbase->next;
if ( odb -> busy )
{
}
delete odb;
}
}
void sql_connection_c::connect( char *__database, char *__host, char *__user, char *__password )
{
host = new char[ strlen( __host ) + 1 ];
strcpy( host, __host );
if ( __user )
{
user = new char[ strlen( __user ) + 1 ];
strcpy( user, __user );
}
if ( __password )
{
password = new char[ strlen( __password ) + 1 ];
strcpy( password, __password );
}
database = new char[ strlen( __database ) + 1 ];
strcpy( database, __database );
freedb( grabdb() ); }
OPENDB *sql_connection_c::grabdb()
{
OPENDB *odb;
for ( odb = opendbbase; odb; odb = odb->next )
{
if ( !odb->busy )
{
break;
}
}
if ( !odb )
{
odb = new OPENDB;
if ( !mysql_init( &odb->mysql ) )
{
errc = 1;
}
if ( !mysql_connect( &odb->mysql, host, user, password ) )
{
errc = 2;
}
if ( mysql_select_db( &odb->mysql, database ) )
{
errc = 3;
}
odb->busy = 1;
odb->next = opendbbase;
opendbbase = odb;
}
else
{
odb->busy++;
}
return odb;
}
void sql_connection_c::freedb( OPENDB *odb )
{
odb->busy = 0;
}
short sql_connection_c::errcode()
{
return errc;
}
sql_query_c::sql_query_c()
{
sql_connection = 0;
odb = 0;
res = 0;
row = 0;
results.set_size( 0 );
}
sql_query_c::sql_query_c( sql_connection_c *__sql_connection )
{
sql_connection = __sql_connection;
odb = sql_connection->grabdb();
res = 0;
row = 0;
results.set_size( 0 );
}
sql_query_c::sql_query_c( sql_connection_c *__sql_connection, char *sql )
{
sql_connection = __sql_connection;
odb = sql_connection->grabdb();
res = 0;
row = 0;
try_execute( sql );
results.set_size( 0 );
}
sql_query_c::~sql_query_c()
{
for ( int idx = 0; idx < results.n_items(); idx++ )
{
delete results[ idx ];
results[ idx ] = 0;
}
if ( res )
{
mysql_free_result( res );
}
if ( odb )
{
sql_connection->freedb( odb );
}
}
int sql_query_c::try_execute( char *sql )
{
if ( sql_connection && odb && !res )
{
if ( !mysql_query( &odb->mysql, sql ) )
{
return 1;
}
}
return 0;
}
int sql_query_c::execute( char *sql )
{
if ( sql_connection && odb && !res )
{
if ( try_execute( sql ) )
{
res = mysql_store_result( &odb->mysql );
}
}
return (int)res;
}
sql_result_c *sql_query_c::store()
{
if ( !res )
{
return 0;
}
sql_result_c *p = new sql_result_c( this, res );
results.add( p );
res = 0;
return p;
}
void sql_query_c::free_result( sql_result_c *sql_result )
{
for ( int idx = 0; idx < results.n_items(); idx++ )
{
if ( results[ idx ] == sql_result )
{
delete results[ idx ];
results[ idx ] = 0;
results.del( idx );
break;
}
}
}
void sql_query_c::free_result()
{
if ( sql_connection && odb && res )
{
mysql_free_result( res );
res = 0;
row = 0;
}
}
__int64 sql_query_c::insert_id()
{
if ( sql_connection && odb )
{
return mysql_insert_id( &odb->mysql );
}
return -1;
}
MYSQL_FIELD *sql_query_c::fetch_field()
{
if ( sql_connection && odb && res )
{
return mysql_fetch_field( res );
}
return 0;
}
char *sql_query_c::fetch_fieldname()
{
MYSQL_FIELD *field = 0;
if ( sql_connection && odb && res )
{
field = mysql_fetch_field( res );
}
return field ? field->name : "";
}
int sql_query_c::ping()
{
if ( odb )
{
return mysql_ping( &odb->mysql );
}
return -1;
}
sql_var_c::sql_var_c()
{
value = 0;
}
sql_var_c::sql_var_c( int i )
{
value = 0;
*this = i;
}
sql_var_c::sql_var_c( double d )
{
value = 0;
*this = d;
}
sql_var_c::sql_var_c( char *s )
{
value = 0;
*this = s;
}
sql_var_c::sql_var_c( const char *s )
{
value = 0;
*this = (char *)s;
}
sql_var_c::~sql_var_c()
{
release();
}
sql_var_c::operator int ()
{
if ( !value )
{
return 0;
}
return atoi( value );
}
sql_var_c::operator double ()
{
if ( !value )
{
return 0;
}
return atof( value );
}
sql_var_c::operator char * ()
{
return value;
}
sql_var_c::operator const char * ()
{
return value;
}
sql_var_c::operator = ( int i )
{
release();
value = new char [ 11 + 1 ];
itoa( i, value, 10 );
}
sql_var_c::operator = ( double d )
{
release();
value = new char [ 32 ];
sprintf( value, "%15.5f", d );
}
sql_var_c::operator = ( char *s )
{
release();
value = new char [ strlen( s ) + 1 ];
strcpy( value, s );
}
sql_var_c::operator = ( const char *s )
{
*this = (char *)s;
}
void sql_var_c::release()
{
if ( value )
{
delete[] value;
value = 0;
}
}
sql_row_c::sql_row_c()
{
row = 0;
__allow_null = 1; }
sql_row_c::sql_row_c( MYSQL_ROW __row )
{
row = __row;
__allow_null = 1; }
void sql_row_c::allow_null( int allow )
{
__allow_null = allow;
}
sql_var_c sql_row_c::operator [] ( int idx )
{
return sql_var_c( __allow_null ? ( row[ idx ] ) : ( row[ idx ] ? row[ idx ] : "" ) );
}
sql_field_c::sql_field_c()
{
field = 0;
}
sql_field_c::sql_field_c( MYSQL_FIELD *__field )
{
field = __field;
}
char *sql_field_c::get_name()
{
return field->name;
}
char *sql_field_c::get_default_value()
{
return field->def;
}
enum_field_types sql_field_c::get_type()
{
return field->type;
}
unsigned int sql_field_c::get_max_length()
{
return field->max_length;
}
sql_result_c::sql_result_c()
{
query = 0;
res = 0;
}
sql_result_c::sql_result_c( sql_query_c *__query, MYSQL_RES *__res )
{
query = __query;
res = __res;
}
sql_result_c::~sql_result_c()
{
if ( res )
{
mysql_free_result( res );
}
}
__int64 sql_result_c::n_rows()
{
if ( query && res )
{
return mysql_num_rows( res );
}
return 0;
}
sql_row_c sql_result_c::fetch_row()
{
MYSQL_ROW row = mysql_fetch_row( res );
return sql_row_c( row );
}
unsigned int sql_result_c::n_fields()
{
if ( query && res )
{
return mysql_num_fields( res );
}
return 0;
}
sql_field_c sql_result_c::fetch_field( unsigned int field_idx )
{
if ( query && res )
{
MYSQL_FIELD *field = mysql_fetch_field_direct( res, field_idx );
return sql_field_c( field );
}
return sql_field_c();
}
|
|
|
|
|
6kyAngel wrote: fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory
Well, the error is clear: the compiler is not able to find mysql.h include file. You've to tell the compiler where it can find such header file. For instance, using Visual Studio 2005 , choose the menu item Project->Properties , then select the Configuration Properties->C/C++->General node and add the proper folder in the Additional Include Directories item.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Why would you deem it necessary to post all this code just to show a C1083 error?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi All,
I have MFC form view application on which I have some push buttons. I want to display animated GIF's such water flowing from left tp right as back ground Image and on top this image I want to place my buttons. What I mean is push buttons has to be placed on animtaed GIF instead of default back ground.
I check Add GIF-animation to your MFC and ATL projects with the help of CPictureEx and CPictureExWnd project in the link
http://www.codeproject.com/KB/graphics/pictureex.aspx
but when I am running the application the buttons are covered by GIF's .. I am unable to see the buttons ..
Please let me know how to do this ...
|
|
|
|
|
is your GIF getting animated?
if so then try changing the taborder of the controls and see.
gud luck.
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
Chandu thank you for response , I will try this and let you know
|
|
|
|
|
Hi Chandu...
then try changing the taborder of the controls and see ...
by following your suggestion I changed GIF indexed as lower than the buttons but still my buttons are covered by GIF.. Is their anything any needs do other than lowering the index number of GIF ..
Please let me know so that I can try that option .. Thank you very much in advance
|
|
|
|
|
>I check Add GIF-animation to your MFC and ATL projects with the help of CPictureEx and CPictureExWnd project in the link
You don't need all this code (not professional) to play GIF files in Windows.
Animated GIF is native with Win32 COM SH interfaces (used by IE...)
|
|
|
|
|
Thank you for your response
|
|
|
|
|
Hi All,
1) I have an MFC form view application which will have some push buttons on it. I want to connect these push buttons by arrow lines. What I mean is when I run the application the push buttons has to be shown by conncted to each other by arrow lines .. How can I do this ?
|
|
|
|
|
Use MoveTo and LineTo GDI calls in the OnPaint function of the dialog class.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Could someone direct me to a source of information on how is F1 key processed in "standard" MFC application. I would like to intercept other function keys to change focus to various controls in CFormView derived view. I have been experimenting with PreTranslateMessage and OnHelpInfo but need some guidance here.
Thanks for you help
Cheers Vaclav
modified on Thursday, June 18, 2009 3:10 PM
|
|
|
|
|
There is some information concerning context-sensitive help support of MFC on MSDN. You may want to examine MFC source files like winfrm.cpp, winfrmx.cpp and apphelpx.cpp for CFrameWnd and CWinApp classes.
You may use accelerator table resources to intercept other keys like F1 below.
IDR_MAINFRAME ACCELERATORS PRELOAD MOVEABLE PURE
BEGIN
VK_F1, ID_CONTEXT_HELP, VIRTKEY, SHIFT
VK_F1, ID_HELP, VIRTKEY
END
You may also benefit from mnemonic keys for form controls.
|
|
|
|
|
|
if(pMsg->message==WM_KEYDOWN && pMsg->wParam==112)
{
}
i used it this way in oneof my apps in pretranslatemessage. it worked.
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
Found a solution thanks to the forum using PreTranslateMessage in CFormView. Also found Q222829 article very helpful but confusing. Is it really necessary to run TranslateAccelerator ? Also I do not see why Accelerator resource is also in the picture.
Addendum - Apparently it is necessary to use TranslateAccelerator and other functions when the accelerator key is in menu.
I am including (for review only – it is redundant) two ways to retrieve the VK_F2 (function key F2 ) , they both accomplish same result.
Of course the de-reference symbol is as always “->” and not “-&gt;”. I really do not know why, but is it not my mistake!
Thanks guys Vaclav
BOOL CFD2008View::PreTranslateMessage(MSG* pMsg)
{
// TRACE("\n BOOL CFD2008View::PreTranslateMessage(MSG* pMsg) ");
if (m_hAccelTable) {
if (::TranslateAccelerator(m_hWnd, m_hAccelTable, pMsg)) {
{
if(pMsg-&gt;wParam==VK_F2)
{
TRACE("\nBOOL CFD2008View::PreTranslateMessage(MSG* pMsg) VK_F2");
m_edit.SetFocus();
}
return(TRUE);
}
}
}
if(pMsg-&gt;message == WM_KEYDOWN)
{
if(pMsg-&gt;wParam==VK_F2)
{
TRACE("\nBOOL CFD2008View::PreTranslateMessage(MSG* pMsg) VK_F2");
m_edit.SetFocus();
}
}
{
// Let the ToolTip process this message.
m_tooltip.RelayEvent(pMsg);
}
return CFormView::PreTranslateMessage(pMsg);
}
modified on Thursday, June 18, 2009 3:40 PM
|
|
|
|
|
Hello. I would like to create an alias to an array of pointers, but don't know the syntax for such an operation. For example, to create an alias, "b", to an integer, "a", I would do the following:
int a;
int &b(a); Here changing either b or a also modifies the other. However, how do I do this if the type of a is an array of double* const, as in the following:
double* const a[2];
double* const (&b)[2](a); Is the second line doing what I want it to, and creating an alias for a? If this is not correct, does anyone know how to do this? Thanks,
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
|
The way to make it easier to parse (by you, not the compiler!) is to split the type definition from the reference declaration:
typedef double* const MyArrayType[2];
MyArrayType a = { whatever };
MyArrayType& b = a;
Simpler, no?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
hi,
May i know when to use smart pointers than ordinary pointers....
|
|
|
|
|
pradeep455 wrote: May i know when to use smart pointers than ordinary pointers....
First you should know when to use Google [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|