|
May I change the caption of the Property Page before adding him to the Property Sheet?
If yes, then how?
Best regards,
Eugene Pustovoyt
|
|
|
|
|
Yes, you can. Set your new title to m_psp.pszTitle, and add flag PSP_USETITLE to m_psp.dwFlags.
Martin
|
|
|
|
|
Thank you very much!
That's ok.
Best regards,
Eugene Pustovoyt
|
|
|
|
|
Hi, everyone
How can I connect to a DB2 database that resides on an AS400 machine using Visual C++6.0?
Since I am very new to VC++, I have a very simple question. For me to implement the above functionality, should I use general ODBC or Microsoft ADO stuff? What are the advantages and disadvantages for these two?
Does anyone have any code example to help to go through this? Any help would be greatly appreciated.
Thanks in advance.;)
|
|
|
|
|
Lots of code examples in MSDN. Also good analysis of the different db access methods.
Good luck,
Bill
|
|
|
|
|
Could you please give me some links? I really appreciate it. or could you please tell me what keyword should I search for?;)
|
|
|
|
|
msdn.microsoft.com
search for ODBC
http://search.microsoft.com/default.asp?qu=odbc&boolean=ALL&nq=NEW&so=RECCNT&p=1&ig=01&ig=02&ig=03&ig=04&ig=05&ig=06&i=00&i=01&i=02&i=03&i=04&i=05&i=06&i=07&i=08&i=09&i=10&i=11&i=12&i=13&i=14&i=15&i=16&i=17&i=18&i=19&i=20&i=21&i=22&i=23&i=24&i=25&i=26&i=27&i=28&i=29&i=30&i=31&i=32&i=33&i=34&i=35&i=36&i=37&i=38&i=39&i=40&i=41&i=42&i=43&i=44&i=45&i=46&i=47&i=48&i=49&i=50&i=51&siteid=us/dev
search for ADO
http://search.microsoft.com/default.asp?qu=ado&boolean=ALL&nq=NEW&so=RECCNT&p=1&ig=01&ig=02&ig=03&ig=04&ig=05&ig=06&i=00&i=01&i=02&i=03&i=04&i=05&i=06&i=07&i=08&i=09&i=10&i=11&i=12&i=13&i=14&i=15&i=16&i=17&i=18&i=19&i=20&i=21&i=22&i=23&i=24&i=25&i=26&i=27&i=28&i=29&i=30&i=31&i=32&i=33&i=34&i=35&i=36&i=37&i=38&i=39&i=40&i=41&i=42&i=43&i=44&i=45&i=46&i=47&i=48&i=49&i=50&i=51&siteid=us/dev
search for ODBC ADO
http://207.46.197.63/default.asp?qu=ado+odbc&boolean=ALL&nq=NEW&so=RECCNT&p=1&ig=01&ig=02&ig=03&ig=04&ig=05&ig=06&i=00&i=01&i=02&i=03&i=04&i=05&i=06&i=07&i=08&i=09&i=10&i=11&i=12&i=13&i=14&i=15&i=16&i=17&i=18&i=19&i=20&i=21&i=22&i=23&i=24&i=25&i=26&i=27&i=28&i=29&i=30&i=31&i=32&i=33&i=34&i=35&i=36&i=37&i=38&i=39&i=40&i=41&i=42&i=43&i=44&i=45&i=46&i=47&i=48&i=49&i=50&i=51&siteid=us/dev
Many articles on Code Guru
http://codeguru.com/mfc_database/index.shtml
and here on Code project
http://codeproject.com/database/
You will serve yourself well if you develop a skill for searching the internet for answers to these kinds of question. You will get answers much faster and better with your own searches.
One of the best searches for obscure stuff, is Google. Just type in things like class names, error messages or what ever else is confounding you at the moment.
searching google for ADO ODBC
http://www.google.com/custom?q=ado+odbc&cof=T%3Ablack%3BLW%3A282%3BL%3Ahttp%3A%2F%2Fwww.refdesk.com%2Frd.gif%3BLH%3A94%3BBGC%3Awhite%3BAH%3Acenter%3BAWFID%3A6332576430c078b2%3B
Good luck,
Bill
|
|
|
|
|
Shayna wrote:
Does anyone have any code example to help to go through this? You can download the "Personal Developer" edition of IBM DB2 for free here, it includes all the necessary documentation and code samples. See also IBM's DB2 pages.
|
|
|
|
|
How could I test the existence of a file on a network drive ASynchronously?
I used _access() function. But, that is a synchronous one; won't return immediately for invalid file paths.
|
|
|
|
|
Go back to old-school
FILE *Stream;
Stream = fopen( "filename", "r" );
if ( Stream == NULL )
{
// That file or path doesn't exist
}
else
{
fclose( Stream );
};
Doug Joseph (Engineering Guy)
|
|
|
|
|
Joe: Thanks for your response.
But what I need is Asynchronous 'kind' of function to test a file existence.
I have the following situation:
Testing existence for \\Serv1\Vol1\Dir1\File1 is finished in few milli seconds if the server 'Serv1' is up and running.
But, if somebody is shutting down the Serv1 and my program tests for the existence of a file on Serv1 at the same time, it takes huge time for the 'check existence' code to return.
Under such situations, I wonder, if there is a kind of 'Asynchronous file existence checking' code which would just return immediately and fire a 'kind' of 'done' event later!!
|
|
|
|
|
Perhaps, you might want to try to ping the server, before checking for the file existance.
Ping's should be realtively quick, especially if you set an artificial timeout on it.
-Doug
Doug Joseph (Engineering Guy)
|
|
|
|
|
Srini Kella wrote:
...I wonder, if there is a kind of 'Asynchronous file existence checking' code which would just return immediately and fire a 'kind' of 'done' event later!!
This is a prime candidate for a worker (i.e., non-UI) thread.
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
Here's some old code I have that does it:
#include < sys/stat.h >
bool IsFile(const char* szFile)
{
assert(szFile);
struct stat statBuffer;
return (stat(szFile, &statBuffer) >= 0 &&
statBuffer.st_mode & S_IFREG);
}
I'm not really sure what you mean by it needing to be asynchronous. I think what you need is a way to just check for existence and nothing else. Well, this should do it.
Regards,
Alvaro
Insanity: doing the same thing over and over again and expecting different results. - Albert Einstein
|
|
|
|
|
Alvaro, Thanks for your response.
I have the following situation:
Testing existence for \\Serv1\Vol1\Dir1\File1 is finished in few milli seconds if the server 'Serv1' is up and running.
But, if somebody is shutting down the Serv1 and my program tests for the existence of a file on Serv1 at the same time, it takes huge time for the 'check existence' code to return.
Under such situations, I wonder, if there is a kind of 'Asynchronous file existence checking' code which would just return immediately and fire a 'kind' of 'done' event later!!
|
|
|
|
|
Well, in that case then you need to spawn a separate thread to check the existence and somehow report back to the main thread what the result is.
Regards,
Alvaro
Insanity: doing the same thing over and over again and expecting different results. - Albert Einstein
|
|
|
|
|
I do not know, if it will work, but if you would try it and let us know, please:
There is function FindFirstChangeNotification() to monitor changes within file system. If you could try to monitor all posible changes, then probably you might get some results as you require.
Martin
|
|
|
|
|
how can i make a carray global.
i have tried adding it in a header but it does not like my definion.
i have tried making it extern but it again does not like my definion.
it works great within the dialog it is created in. i am using it to hold report data.
thank you.
this is how i have it created.
*******************************************
in h file
*******************************************
typedef struct{
CString a;
CString b;
CString c;
} MYCARRAYSTRUCT;
********************************************
in cpp file
********************************************
*************created global for the cpp
MYCARRAYSTRUCT mycarraystruct;
CArray<mycarraystruct,mycarraystruct> mycarray;
*************my funtion
do{
........
mycarraystruct.a = m_pSet->firstfield;
mycarraystruct.b = m_pSet->secondfield;
.....................
m_pSet->MoveNext();
}while.............
|
|
|
|
|
Put it as a public member variable of your application class.
Martin
|
|
|
|
|
that is another part of my problem. the external function that i want to use it in is another class.
|
|
|
|
|
Declare your struct just before your application class.
Declare your array as:
public:
CArray <MYCARRAYSTRUCT, MYCARRAYSTRUCT &> m_mycarray;
in your appilication class. Write function like:
CYourApp *GetApp()
{
return (CYourApp *)AfxGetApp();
}
Declare your function (where you want use m_mycarray) as
<return type> YourFunction(CArray <MYCARRAYSTRUCT, MYCARRAYSTRUCT &> & m_mycarray)
And then you can use it as:
YourFunction(GetApp()->m_mycarray);
Is it possible?
Martin
|
|
|
|
|
You must define the extern declaration on the top of the .cpp file... otherwise your cpp doesnot know about the the structure you defined globally
do it now..!
Trace The Bugs...
|
|
|
|
|
yes i did that, but i found my problem.
very stupid
in my new class i forgot to add
#include <afxtempl.h>
|
|
|
|
|
If your application is called MyDialog
Add the following structure right after the line:
#include "resource.h"
in the file MyDialog.h (Not MyDialogDlg.h):
///////////////////////////
typedef struct
{
CString a;
CString b;
CString c;
} MYCARRAYSTRUCT;
//////////////////////////
Right after the declaration of MyDialogApp() a little further down in the .h file, Add the line:
///////////////////////////
MYCARRAYSTRUCT mm_Global;
///////////////////////////
Now in your dialog's (it is now global).
Add the following line into any subroutine
///////////////////////////////////////////////////////////////////////////
MYCARRAYSTRUCT *m_GData = &( ( MyDialogApp * ) AfxGetApp() ) -> mm_Global;
///////////////////////////////////////////////////////////////////////////
The above line sets up a pointer to the global mm_Global. Now you can refer to the variables as pointer extensions ('->'). Best of all, VS's autocompletion will give you a list of variables in the structure, and if you put a comment ('//') after each declaration, it will show them in the autocompletion as well.
Be careful if you have a timer event, that you are not clobbering work. I've chased this problem from time to time.
Woo Hoo!
That's it
I hope this helps
Doug
Doug Joseph (Engineering Guy)
|
|
|
|
|
I have a dialog window with a few drop down list. When I select one it updates a var that the other drop downs use. The problem is that when I use the other drop downs after this var gets set it doesn't show the latest
ex. if it increments a var the other boxes are one behind.
How do I get the boxes to jive?
|
|
|
|