|
CMainDlg * pMain = (CMainDlg*)GetParent(); ( or AfxGetMainWnd() )
pMain->RunThisFunctionPlease();
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
|
Ok guys,
I know you can add a title to tooltips, ala W2K. I've got dll that allows me to do it via code, but I have no idea how to do it myself?
I've searched for ages but whilst I find websites that say it can be done, none of them have told me how
Anyone help me out?
TIA
Mark
|
|
|
|
|
Send TTM_SETTITLE to your tooltip control. It sets both icon and bold text.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Hello
1) I am new in C++ (acully in windows either ) anyway can any one tell me how can check if there is another copy of my program is running (if you know how in C then its good for me than C++ )? I know its easy for you put please help me
2) anyone know where can I find a good site C/C++ source (I mean site like planet-source-code.com
Thank you
Muslim
mrguest@IamMuslim.org
|
|
|
|
|
Hi !
The most common way is to create a named (with a unique name) kernel object (say - mutex) on your programm start up (::CreateMutex() ). In case if the return value will be NULL you shoudl call to GetLastError() and if you'll get the ERROR_ALREADY_EXISTS - it will show you that this is not a first instance of your programm. And you have to close the object before programm exit... (or you wont be able
to run even first copy
Best regards,
-----------
Igor Soukhov (Brainbench/Tekmetrics ID:50759)
igor_soukhov@yahoo.com | ICQ:57404554 | http://siv.da.ru
|
|
|
|
|
I have an MFC application which fills a listctrl with records from a database. It runs fine on my local machine, but if I put the database on another PC and connect to it over the network, it runs really, really slowly. It runs slowly even when you are not doing anything with the database. After about 10 seconds it completely grinds to a halt.
Something I did notice is that when I load the workspace into Visual Studio it eats up at least half my memory which I am sure is not right (the code is only about 4-5MB). Could the workspace/resources/code be corrupt??
Please Help!!
David Osborn
|
|
|
|
|
If you want any *real* help, provide more detailed information, for example: what database are you using.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
I am using an MS Access (97) database and linking to it using ODBC. The application runs through all the records and adds them to various customised list ctrls. I am also using an Outlook-style menu component with a 3-way split screen - the main screen switches between different CFormViews depending on what is selected from the "Outlook" bar.
I have other applications which link to Access databases over a network just fine.
David Osborn
|
|
|
|
|
Are your list controls filled OK, and after that program crashes? Or it happens in the middle of operation?
BTW: why are you using ODBC for Access? Aren't MFC DAO classes enough?
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
It is not consistent. It just runs really slowly - sometimes it freezes while trying to fill the first list and sometimes it fills the lists but then if I try anything (even just bringing a dialog box up) it goes really slowly until it just stops responding. As I said it runs fine locally.
I am using ODBC because the application will be running on a client/server environment, eventually running with SQL Server.
David Osborn
|
|
|
|
|
When it stops responding, use Break command in the debugger. You'll be able to see which routine hangs your app. I'd also look search Knowledge Base for BUG-style articles related to ODBC/Access - there's a chance that you hit some ODBC problem.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
If you copy a file from one pc to another, the speed of transference of the file is good?
The problem can be that the network is slow.
Carlos Antollini.
|
|
|
|
|
There is no problem with the network. Files copy okay and as I said we have other similar applications which run very quickly over a network. It is something to do with the application.
David Osborn
|
|
|
|
|
This is a bug with Microsoft Data Access Components versions 2.1, 2.5, 2.6
an excessive amount of network packet activity occurs, even when the ODBC connection is idle
It is caused by wrong interpetation of the timout value.
since it is expecting to be in miliseconds and you set it to seconds.
Also, if you create a new ODBC data source with the MDAC 2.1 or later version of the Access ODBC Driver, the driver incorrectly uses a default value of 5 for PageTimeout. The correct default value should be 5000 with the MDAC 2.1 version of the driver.
See MSDN for The resolution:
[SNIP]
"
The recommended setting for PageTimeout with the MDAC 2.1 or later version of the Microsoft Access ODBC driver is 5000. To change this value, click Options in the ODBC data source and modify the PageTimeout value.
You can also add this to your ODBC connection string. For example, here is an ODBC connection string that uses a DSN as well as adds the PageTimeout setting:
"DSN=MyODBCDataSource;PageTimeout=5000;"
Here is an example ODBC connection string that uses a DSN-less connection as well as adds the PageTimeout setting:
"Driver=Microsoft Access Driver (*.mdb);PageTimeout=5000;DBQ=C:\MyFile.doc;"
[/SNIP]
Click here for article
Cheers
Alfadhly
/*
It is Illogical to define an inventor by his invention
*/
|
|
|
|
|
Thanks, this sorted the problem.
David Osborn
|
|
|
|
|
Hi all,
I've written a library and I would like to specify in the source code additionnal include and library path to avoid specify in the Project/Settings in each project I've made...
I know that we can specify libray to include to the linker in this way:
#pragma comment(lib,"test.lib")
...and that work correctly. I've seen on MSDN that we can set some linker options like this:
#pragma comment(linker, "LIBPATH :\lib")
...but it seems to do nothing and we can't specify additionnal include directories...
Thx in advance...
|
|
|
|
|
Just a guess: change d:\lib to d:\\lib.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Sorry, I've done an error in my example... It is "d:/lib" not "d:\lib"
|
|
|
|
|
I am reading field values from records which then i convert to CString
_Recordset rs;
variant_t var = rs->Fields->GetItem (variant_t ("name"))->Value;
then i try to convert to CString var:
var.ChangeType (VT_BSTR);
CString strName = var.bstrVal;
whenever field has NULL i got error of access violation
please help
|
|
|
|
|
would
CString name;
if (var.bstrName)
name = var.bstrVal;
else
// go home
work ?
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
it did not or I made something wrong:
variant_t vGroupID = rsMenu->Fields->GetItem (_variant_t ("group_id"))->Value;
vGroupID.ChangeType (VT_BSTR);
if (vGroupID.bstrVal)
{
sGroupID = vGroupID.bstrVal;
}
else
sGroupID = "NULL";
i got the same error
|
|
|
|
|
try checking var.vt for VT_NULL (and VT_EMPTY possibly)
maXallion "Is there any Tea on this Spaceship?" - Arthur Dent
Home of The Code Devil
|
|
|
|
|
it works, but probably what i have done is NOT the best coding example
CString sGroupID;
variant_t vTest;
variant_t vGroupID;
vTest.ChangeType (VT_NULL);
vGroupID = rsMenu->Fields->GetItem (_variant_t ("group_id"))->Value;
if (vGroupID != vTest)
{
vGroupID.ChangeType (VT_BSTR);
sGroupID = vGroupID.bstrVal;
}
else
sGroupID = "NULL";
thank you
|
|
|
|
|
that should do the job:
CString sGroupID;
_variant_t vGroupID;
vGroupID = rsMenu->Fields->GetItem (_variant_t ("group_id"))->Value;
if (vGroupID.vt != VT_NULL)
sGroupID = (LPCTSTR)_bstr_t(vGroupID);
else
sGroupID = "NULL";
maXallion "Is there any Tea on this Spaceship?" - Arthur Dent
Home of The Code Devil
|
|
|
|