|
jhwurmbach wrote: Hacking a shareware program?
actually not, its something far more simpler then that.
BTW you have any idea if i can actually change the timer?
and thanks for all your help, ill go check msdn.
thank you very much
|
|
|
|
|
shja88 wrote: you have any idea if i can actually change the timer?
When the application is using SetTimer / WM_TIMER, you could try sending WM_TIMER messages to the application window.
See is this speeds up the timer.
On of the gaping security holes in windows design: Anyone can send any message to anyone. (See also WM_COPYDATA).
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
thank you very much, you helped me a lot
|
|
|
|
|
Hi,
I have created a property sheet and set the wizard mode for that, then added a property page to that sheet, When i execute that i see property page embeded in property sheet and plus some more space(which is not part of dialog) at the border, how can i remove that space.
Best Regards,
Mushq
Mushtaque Ahmed Nizamani
Software Engineer
Ultimus Pakistan
"English is my second language; please excuse any grammatical or spelling mistakes"
|
|
|
|
|
The wizard as also Propertysheets are using the size of biggest sheet. Check this out.
If this wont help you it is best to think about writing the wizard with multiple dialogs.
Greetings from Germany
|
|
|
|
|
The framework uses the size of the largest page to determine how much space to allocate in the property sheet for the property pages. So, how many pages does your sheet have?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Mine property sheet has 7 pages, and all property pages have same size.
But the problem is that even if i have only one property page in a property sheet, still i see some extra space(along with property sheet border)other than dialog's space.
Best Regards,
Mushq
Mushtaque Ahmed Nizamani
Software Engineer
Ultimus Pakistan
"English is my second language; please excuse any grammatical or spelling mistakes"
|
|
|
|
|
Can you provide a screenshot?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
http://img460.imageshack.us/img460/2465/extraspaceofpropertyshemk5.jpg[^]
Button having caption Cancel occupies the whole property page, but still there is some space occupied by property sheet, I have pointed that with some painting of blue colored airbrush.
Best Regards,
Mushq
Mushtaque Ahmed Nizamani
Software Engineer
Ultimus Pakistan
"English is my second language; please excuse any grammatical or spelling mistakes"
|
|
|
|
|
I could be wrong, but I think that spacing is normal.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
VCF Blog
|
|
|
|
|
Hi All,
I am new to c++ and facing one prob. I have one base class Vehicle and two sub class Car and Motor. I have an array of pointer to sub class but i m not able to delete the memory for that.
CVehicle
CCar : CVehicle
CMotor : CVehicle
CVehicle** myVehicle;
myVehicle = new CVehicle*[3];
myVehicle[0] = new CCar;
myVehicle[1] = new CMotor;
myVehicle[2] = new CCar;
now when I tried to reallocate the memroy, it is giving an error.
delete myVehicle ;
Any idea how to delete the memory??
Any help
Monark - I am learning
|
|
|
|
|
When you are deleting an array of elements that you created using new, you should be doing it using '[]'
delete []variable;
|
|
|
|
|
when you use new, you must use delete.
when you use new[], you must use delete[].
BTW, i see a problem in your design.
a Car is actually a Vehicle, so, it's ok to derive it from CVehicle.
but a Motor is not a Vehicle. a Vehicle HAS A Motor... it seems that you confused with the IS A relationship.
also, are you sure to wanting to create an array of pointers rather than an array of objects ?
|
|
|
|
|
You need to deallocate as
delete myVehicle[0];
delete myVehicle[1];
delete myVehicle[2];
delete [] myVehicle;
- NS -
|
|
|
|
|
use the delete operator carefully. With delete you delete pointers:
first delete myVehicle[0];
delete myVehicle[1];
delete myVehicle[2];
delete *myVehicle;//pointer to pointer
Hammer in your head: to every new belongs a delete
Greetings from Germany
|
|
|
|
|
KarstenK wrote: delete *myVehicle;//pointer to pointer
Your syntax is a bit askew. Use:
delete [] myPointer;
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I chose this way use the same syntax as the declararion: to make it easier readable
Greetings from Germany
|
|
|
|
|
KarstenK wrote: I chose this way use the same syntax as the declararion: to make it easier readable
But it is wrong. As the address being deleted is not the same as the one allocated, you will receive an access violation.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
it was (not my code as followed) allocated:
CVehicle** myVehicle;
myVehicle = new CVehicle*[3];
so I would
delete *myVehicle;
or would I get (a deservred) exception
Greetings from Germany
|
|
|
|
|
You're missing it entirely. myVehicle and *myVehicle point to two different addresses, with the latter already having been freed (via delete myVehicle[0] ). Rather than guess at what you are trying to do, why not just try it?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi,
I'm having an application which connects to a database. I'm calling the SQLConnect() function in a seperate thread, so that if the connection is not there, it should time-out in 10 sec. and if the thread times out, I'm calling terminatethread. Is this the right way of doing? or is there any other way to terminate the thread? NB: SQLConnect() is a blocking call.
Please find the code snippet.
void DBConnectThread(void* param);
HANDLE hThread;
HANDLE hMutex;
int main()
{
unsigned long ThreadID=NULL;
unsigned long ExitCode=0;
DWORD retCode;
hThread = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)DBConnectThread, 0, 0, &ThreadID);
if (WAIT_TIMEOUT == WaitForSingleObject(hThread, 10000))
{
GetExitCodeThread(hThread, &ExitCode);
TerminateThread(hThread, ExitCode);
}
if (hThread != NULL)
CloseHandle(hThread);
return 0;
}
void DBConnectThread(void *param)
{
SQLHENV henv;
SQLHDBC hdbc;
SQLHSTMT hstmt;
SQLRETURN retcode;
SQLINTEGER rgbValue = 0;
DWORD startTickCount = 0;
unsigned char username[255] = "blue";
unsigned char password[255] = "_abc97";
SQLCHAR * OutConnStr = (SQLCHAR * )malloc(255);
SQLSMALLINT * OutConnStrLen = (SQLSMALLINT *)malloc(255);
// Allocate environment handle
retcode = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &henv);
// Set the ODBC version environment attribute
if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)
{
retcode = SQLSetEnvAttr(henv, SQL_ATTR_ODBC_VERSION, (void*)SQL_OV_ODBC3, SQL_IS_INTEGER);
cout << "setting odbc version" << endl;
// Allocate connection handle
if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)
{
retcode = SQLAllocHandle(SQL_HANDLE_DBC, henv, &hdbc);
cout << "Allocating SQL Handle"<< endl;
// Set login timeout to 5 seconds
if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)
{
cout << "Attempt to Connect" << endl;
startTickCount = GetTickCount();
// Connect to data source
retcode = SQLConnect(hdbc, (SQLCHAR*) "OQTUAM blue", SQL_NTS, username, SQL_NTS, password, SQL_NTS);
cout << "Connection Done in "<< (GetTickCount() - startTickCount) << " Secs" << endl;
// Allocate statement handle
if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)
{
cout << "Connection Successful"<< endl;
retcode = SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt);
// Process data
if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)
{
SQLFreeHandle(SQL_HANDLE_STMT, hstmt);
}
SQLDisconnect(hdbc);
}
else
{
cout << "Failed to Connect" << endl;
}
SQLFreeHandle(SQL_HANDLE_DBC, hdbc);
}
}
SQLFreeHandle(SQL_HANDLE_ENV, henv);
}
}
thanks in advance,
Rajesh
|
|
|
|
|
Rajesh_Parameswaran wrote: I'm calling terminatethread. Is this the right way of doing?
No.
TeminateThread() is almost always the wrong solution.
Use a variable whose pointer you hand to the thread, and have the thread terminate itself when the outside pulls this variable to false.
Also, read the following stuff (made by Christian Grauss who is a codeproject regular):
The Processes Articles[^]
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
You better let the SQL-Stuff run completly. Normally you can somewhere else set a proper timeout for the DB. Or you have to wait the time.
Otherwise you can damage your Database and THAT is an overkill accident
Check the material for the database for the details
Greetings from Germany
|
|
|
|
|
Hi jhwurmbach/KarstenK,
Thanks for your response.
jhwurmbach, but the problem is that the call to SQLConnect() in the thread is a blocking one. So until i get a connection or it will timeout, it will be holding the call. It is getting timeout only after 40 seconds, that is a huge delay. I'm unable to set the ODBC Connection time out also. Even I set the ODBC time-out, it is taking it as WAIT_INFINITE.
Any other alternative methods??
thanks in advance,
Rajesh
|
|
|
|
|
I strongly advise you to respect the Database (DB) and its rules. If you get in trouble with the Integrety of the DByou are in the biggest trouble. Dont ferget that the DB needs some reaction time and some work to do so it needs the time.
If it is a professional DB on a network 40 seconds arent a big delay. Make a progress bar or a wait dialog to show the process.
Whether you findnt this approbiate contact the adminstrators of the DB to discuss the issue.
And inform me please what they said.
Greetings from Germany
|
|
|
|