|
Hi
What's the easiest way to start an application and wait until it has finished?
Should I use ShellExecute or CreateProcess?
And should I use a timer to check if the app has finished or is there a better way?
regards
|
|
|
|
|
Use WaitForSingleObject with a handle returned by CreateProcess. ShellExecute doesn't return the handle, but you can use ShellExecuteEx.
Your thread will be stopped until the spawned process runs.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I'm a bit confused about the use of ADO and the use of SQL. I have an application that uses a database, which database depends on the users configuration but almost always it's either MSAccess or MSSQL or Oracle SQL server. I have up till now used a sql string to create a recordset but now I'm beginning to wonder if this is the way ADO is meant to be used.
If someone would explain the pro and cons of using SQL contra 'ADO internal' I would appreciate it!
// Mike
|
|
|
|
|
Is this a bug?
I tried this function overloading with Turbo C++ 3 & VC++ 6 and both produced the same error of ambigous call:
float Op (float X, float Y, float Z)
{
...
}
int Op (int X, int Y, int Z)
{
...
}
1) Op (3.0, 6.0, 9.0);
2) Op (3, 6, 9);
The compiler said that the (1) function call is ambigous despite the fact that the parameters have decimals. I tried this:
3) Op (3.1, 6.1, 9.1);
with the same result. But by specifying even the first element's type, the compiler did not complained (and called the correct function):
Op ((float) 3.0, 6.0, 9.0);
How come the compiler does not recognize the decimals of the parameter as float? Also after placing decimal values > 0 (as in the (3) function), the compiler still would not consider the parameters as float.
Is this a BUG?
|
|
|
|
|
A floating point literal (like 3.0) has the type double , not float .
|
|
|
|
|
So does this mean that even though the other overload function's parameter is discreet (char, int, ...; non-Real), the compiler while still be confused between choosing a discreet and a real overload?
Is there a way (or rather, a numerical representation of a number) to tell the compiler to use FLOAT without TYPECASTING?
ThanXs,
|
|
|
|
|
Use:
function(0.3f, 0.6f, 0.9f);
This forces the compiler to look at those numbers as floats instead of doubles.
J
|
|
|
|
|
Conversion from double to float can lose precision or overflow. So can conversion from double to int. That's why the compiler considers tham eqully bad and complains about ambiguity. Use the suffix "f" or "F" to tell that a literal number is a float , e.g. 3.0F or 1e6f .
|
|
|
|
|
I've been using a bit of STL here and there for the past year, but being a bit of hacker have probably been using it incorrectly.
What is the correct way of using strings so that they work for UNICODE and ANSI? What function should I use to get the data out of the string to pass it to a Windows API function?
Michael
|
|
|
|
|
string and wstring are the specializations of basic_string template. Use first with ANSI, second with Unicode.
What function should I use to get the data out of the string to pass it to a Windows API function?
If you just want to pass a const char * pointer, use string::c_str - you can pass this to API functions expecting LPCTSTR. I'm not sure if it's possible to use string as a buffer writable by API.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
So I have to do my only #ifdef UNICODE and define mystring as string or wstring?
Is there any difference between the c_str method and the data method of string?
Thanks for you answers,
Michael
|
|
|
|
|
So I have to do my only #ifdef UNICODE and define mystring as string or wstring?
Yes. Or you can go fancy and use TCHAR:
typedef basic_string<TCHAR, char_traits<TCHAR>, allocator<TCHAR> > mystring;
Is there any difference between the c_str method and the data method of string?
Yes - data() doesn't guarantee that you'll get the terminating null character. If the string is empty, data returns "a non-null pointer that cannot be dereferenced" according to docs that shipped with VC6
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hello, I've no clue on how to print a specific area of the form on my SDI App. The view class is dialog based. The reason I need to do this is because it has to look the same on the document as on the form - the form has 46 static controls with text and 46 edit boxes - so I have no clue how to print them exactly as they are placed
Any help appreciated,
Deian
|
|
|
|
|
Hi!
In my main dialog (the dialog that appears when I run my app) I have a button that opens a second dialog (the dialog box have a WS_POPUP style), in the main dialog I want to start a timer + change the text of some controls (statics etc.)
Now to the problem: I have code to do that when I close the dialog. But I want to start a timer and change some stuff immediate when I push a button on the second dialog!! HOW!??
/*
BETA
*/
|
|
|
|
|
But I want to start a timer and change some stuff immediate when I push a button on the second
You push on a second dialog and want to change something on a second dialog? Or push on a second and want to change on first?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
are these modaless dialogs u r talkin bout???
|
|
|
|
|
In my program I'm calling a stored procedure (SQL Server) several times. Most of the times it works fine, but eventually I get the following exception:
"Could not allocate a new object descriptor for required system catalog in database '6'. Another database must be closed or objects in another database dropped in order to open this database."
Here's the code that generates the exception:
prsStolpe->MoveFirst();
CString sql;
sql.Format("{CALL TabortBesiktning(%d, %d)}",
prsStolpe->m_LinjeomradeId, prsStolpe->m_StolpeId);
prsStolpe->m_pDatabase->ExecuteSQL(sql);
prsStolpe->Edit();
Initiera();
prsStolpe->Update();
I suspect that the combination of recordset and ExecuteSQL might cause the exception, but then I don't understand why it works fine for several calls before the exception occurs.
I did a search on the exception string and read something about the cause being "resource limitation". What resource would that be?
Please help me out if you can. I'm as confused as a baby in a topless bar.
Thanks!
|
|
|
|
|
Hi,
I have a suspicion that there is a memory leak in a ActiveX App that I am working on.
The reason for the suspicion is the containing application occassionally doesn't redraw correctly.
During this investigation i am going to ignore the activeX technology for the moment.
Anyway, i am sifting through the code to make sure that all mallocs are properly free and dynamic objects destroyed. But surely a problem with one of these wouldn't cause the current symptons.
Some one sugested that the problem might be caused by messages which are left when the app finishes? is this likely? How would i handle it? Anyone any other ideas of what to watch out for?
Thanks Again
Rich
|
|
|
|
|
Can we know the available memory at runtime in other words how can we make sure that our program doesn't have any memory (even a single byre.)?
If anybody knows plz answer me.
|
|
|
|
|
Take a look at GlobalMemoryStatus
Nish
Sonork ID 100.9786 voidmain
|
|
|
|
|
in other words how can we make sure that our program doesn't have any memory (even a single byre.)?
Your program always uses some memory. What exactly do you want to achieve?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Sorry, the question is incomplete. How can i be sure that my program( program or an activex component)doesn't have any memory leaks and how can i prove it to somebody else.
Thanx in advance.
|
|
|
|
|
Hi,
I'm trying to change the value of a recordset's property. The property is "scroll backwards" (want to change from false to true).
I opened a recordset, and then I got it's properties. I got the wanted property(according to it's index), but I can't change the value - I get an error saying that "the operation can't be done when the object is open".
Which object is the error talking about?
Do I need to change the property after openning the recordset?
What am I doing wrong?
Can someone please send me a code example of what should I do...???
Thanks.
|
|
|
|
|
hey, i know that this will sound stupid, but i can't find any function that changes the static control's text color. Example of doing that?
Thanks,
Deian
|
|
|
|
|
Put this in the OnCtlColor
if(nCtlColor==CTLCOLOR_STATIC )
{
pDC->SetBkColor(RGB(255,9,9));
pDC->SetTextColor(RGB(9,9,255));
}
Replace the RGB values with what you prefer
Regards
Nish
Sonork ID 100.9786 voidmain
|
|
|
|