|
My MSDN for .NET says:
If the handler returns FALSE, the message will be handled by the parent as well, while a call that returns TRUE does not allow the parent to handle it. Note that the reflected message is handled before the notification message.
...and this is right, so you are right as well.
Regards,
BB
|
|
|
|
|
Hi i have the below piece of code which
i use to query a table in my database with ado
however i would like to know how many records this query pulls back
does any one know how to do it, im a bit of a novice, i know its something
to do with using RecordCount, but im stuck on how to use it
thanks
si
strSQL.Format("Select * from temp2 where surname like '"+m_eind_searchnme+"'");
_variant_t vstrSQL;
vstrSQL.ChangeType(VT_BSTR);
vstrSQL = strSQL;
MySet.CreateInstance(__uuidof(Recordset));
MySet->Open(vstrSQL,MyDb.GetInterfacePtr(),adOpenDynamic,adLockOptimistic,adCmdText);
|
|
|
|
|
RecordCount doesn't always work and I think it has to do with the database. However, if you want to know all the records that you have pulled there are two different ways (in case RecordCount doesn't work).
// The first one is to iterate throuch each recordset
// pRs is an object of RecordsetPtr_
pRs->MoveFirst()
nCounter = 0;
while( pRs->GetEOF() == FALSE )
{
nCounter++;
pRs->MoveNext();
}
// The second method is to use SQL statements by using
SELECT COUNT(*) AS Total FROM Table WHERE condition
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
Hi,
I am trying to create a grid control using CListCtrl and my main problem right now is getting the control to display the cells in the first columns as button.
I'm not sure if this is the right way, maybe there is a way to create header for the rows just like the columns.
ANy ideas on how to do this.
Thanks in advance.
|
|
|
|
|
Try the customdraw service. You will have total freedom for drawing the first column cells however you like.
|
|
|
|
|
I'm already using Custom Draw, but I'm not sure on how to create row headers.
Thanks
|
|
|
|
|
As we all know, when windows loading, explorer.exe will initialize the desktop,taskbar etc.
I write a progrom which uses system tray icon.But there is a problem. when the explorer.exe is killed or error corrupt, when the taskbar is reinitialized, the icon which added by my program is dispeared.
How can I get the notification when the explorer.exe is initialized, So as I can put my icon on system tray again just like the system process "Sound.exe" or "Network"?
Thanks.
|
|
|
|
|
Just register TaskbarCreated, it sent every time top explorer restarted
|
|
|
|
|
|
Hi, everyone!
Sometimes we use pointer as the parameter type and sometimes
we use reference as the parameter type.
I think using reference is better than using object directly.
Since it can save memory and operation (assignment operator).
But what about pointer V.S. reference? I want to know in which
case should I use pointer and in which case should I use reference.
Here are two samples,
Using reference,
--------
ostream& operator << (ostream&, ObjectType);
--------
Using pointer
--------
MemPoolAddSize (char*, size_t)
--------
I want to know your suggestions about pointer v.s. reference.
What is the general consideration about when using pointer and
when using reference?
Thanks in advance,
George
|
|
|
|
|
I use a rule from Scott Meyers: if the referenced-to object must always exist, use a reference; if you want to allow for a non-existing reference (NULL), use a pointer. Note that in your case the only way to use C strings is through a pointer to char.
|
|
|
|
|
That's a very good description!
Scott Meyers rules I like his books
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
Yes, I agree!
George
|
|
|
|
|
Thanks, João buddy!
What means "if you want to allow for a non-existing reference
(NULL), use a pointer" in your reply?
regards,
George
|
|
|
|
|
It means that if you want to allow NULL argument for your function (which means "no object"), use a pointer. The reference-based function argument requires you to pass an existing object and not the NULL value.
Happy Easter!
BB
|
|
|
|
|
Thanks, Bartosz buddy!
George
|
|
|
|
|
I want to implement an object pooling scheme for one of my C++ classes that are created and deleted frequently (so much as to cause a performance degradation). I am thinking about creating a pool and keep it in a static list, and manage the list instead of actually calling new and delete every time.
Is this recommended for improving performance OR is there a better alternative apporach?
My article on a reference-counted smart pointer that supports polymorphic objects and raw pointers
modified 29-Aug-18 21:01pm.
|
|
|
|
|
Some of our intense code uses object pooling, and in our case it definately improves performance. We have a log and it will show that the object pooling removed the need for thousands upon thousands of calls to new (these are comm message objects, which would get created and deleted quite frequently when comm is heavy). The key is finding the right number of objects to store in your pool, so that you aren't using too much unnecessary memory, and so that your pool doesn't run out all the time. It will probably take some tuning.
If you are wary of it, then just try implementing it (it shouldn't be too bad). If profiling shows significant performance gains, it would be a good idea for you. As for alternative approaches, I don't really know of any off the top of my head.
Chris Richardson
You can stash and you can seize
In dreams begin, responsibilities U2 - Acrobat[^]
Stop being PC and accounting for everyone and his momma's timeframe. Just enjoy your - Rohit Sinha in the content-challenged thread
|
|
|
|
|
Thank you very much for the reply.
I made one implementation already. My objects are very small and the number of objects that are in memory at any time is not significantly high. To my surprise, my application improved more than 20% in performance. I am planning to post an article this weekend with the code.
Currently, the pool grows to the maximum number of objects of the class that have ever been in memory. I want to put in some code to release some of these objects, if they are not being used. Anyway. it is not important to me at this moment because memory usage is not very huge.
Thomas
My article on a reference-counted smart pointer that supports polymorphic objects and raw pointers
modified 29-Aug-18 21:01pm.
|
|
|
|
|
Sounds good. 20% is a nice gain, and I look forward to your article.
Chris Richardson
You can stash and you can seize
In dreams begin, responsibilities U2 - Acrobat[^]
Stop being PC and accounting for everyone and his momma's timeframe. Just enjoy your - Rohit Sinha in the content-challenged thread
|
|
|
|
|
To disable ctrl-alt-del I use the following code but it is not working in windows 2000. So how to do it????
BOOL c=TRUE;
BOOL ret=SystemParametersInfo(SPI_SETSCREENSAVERRUNNING,1,&c,0);
|
|
|
|
|
I do not know if it is still possible. What you could do is set a keyboard hook [^]. But it is usually not really user friendly to mess up with ctrl-alt-del
~RaGE();
|
|
|
|
|
In windows NT 4.0 and above you need to replace the MSGina.dll (handles windows login) with a new one. See GINA in MSDN.
GINA
A Graphical Identification and Authentication dynamic-link library (DLL). The GINA is a replaceable DLL component that is loaded by the Winlogon executable. The GINA implements the authentication policy of the interactive logon model and is expected to perform all identification and authentication user interactions.
When logged on, if a user enters a secure attention sequence (SAS), the user is presented with a security options screen. Among the options listed are:
Shut down the system.
Log off.
Change the password.
Go to the task list.
Lock the workstation.
A replacement GINA can provide similar options when an SAS event is received while a user is logged on.
secure attention sequence
(SAS) A key sequence that begins the process of logging on or off. The default sequence is CTRL+ALT+DEL.
John
|
|
|
|
|
How to block Window key and Alt key operation
|
|
|
|
|