Saturday, November 14, 2009

xp disk defragmenter does not analyze or defrag

My system (as usual) was starting too sluggishly for my liking to start the defragmentation. But, when I clicked "Analyze" or "Defrag", nothing happened. I mean, absolutely nothing. No error messages. Not even a warning. Something in the lines of "hey moron, you are doing something wrong here" would have been more appropriate. Well, like any dumb user, I entered the realm of Google, and ended up triggering the defrag.exe from the command prompt. There, I got something. "Windows cannot connect to the Disk Defragmenter engine". Now, if only I KNEW where and how the hell I kick start that damn engine. Once again Larry ewing's nerds helped me from yonder. It seemed that the "DCOM Server Process Launcher" was not running. It had to be kick started for the defragger to skate board on. So, I clicked "Start/Run" and typed in "services.msc" and opened the services window. (the more normal way would be to go to My Computer, right click on it, Manage, and click services, bah, am a lazy guy). Kick started it, (but it acutally didnt. I had to set the mode to "Automatic" and restart the system). Then, I launched our guy, and voila, we are up and running.... Okay, he is working RIGHT NOW. Off I go. Tata

Thursday, August 06, 2009

Mouse scroll in VB6 IDE

VB6 had the dubious distinction of the only IDE without a supported mouse scroll in the code window. Fortunately, in true Microsoft style, they have given workarounds and patches to overcome this disability. Check this Microsoft's link on how to enable/activate mouse scrolling in the VB IDE

Friday, June 19, 2009

How to Enable Tooltip for Dialog Controls

Lets get things straight. You want the user to be more dumb and want him/her to get an idea of what he wants to do with all the controls on his screen without reading the help file? Then dive right in. Else, Ciao. Have a good day.



Step 1: Enable the tooltip command using the command EnableToolTips (TRUE). Ideal location to include this line would be in your class' init routine CYourClass::InitDialog.

Step 2: Windows sends the tooltip related controls in TTN_NEEDTEXT message. We need to handle this. Add the following code to enable your handler in the MessageMap function

BEGIN_MESSAGE_MAP(CMyClassDlg, CDialog)
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXT, 0, 0xFFFF, OnToolTipNotify)
END_MESSAGE_MAP()


Step 3: Declare the handler function in your header.
afx_msg bool OnToolTipNotify( UINT id, NMHDR* pNMHDR, 
LRESULT* pResult );


Step 4: We are near. Just add then handler code in your cpp. Below is a sample of the same

bool CMyClassDlg::OnToolTipNotify( 
UINT id, NMHDR* pNMHDR, LRESULT* pResult )
{
// Get the tooltip structure.
TOOLTIPTEXT *pTTT = (TOOLTIPTEXT *)pNMHDR;

// Actually the idFrom holds Control's handle.
UINT CtrlHandle = pNMHDR->idFrom;

// Check once again that the
// idFrom holds handle itself.
if (pTTT->uFlags & TTF_IDISHWND)
{
// Get the control's ID.
UINT nID = ::GetDlgCtrlID( HWND( CtrlHandle ));

// Now you have the ID. depends on control,
// set your tooltip message.
switch( nID )
{
case ID_BUTTON1:
// Set the tooltip text.
pTTT->lpszText = _T("First Button");
break;

case ID_EDIT1:
// Set the tooltip text.
pTTT->lpszText = _T("First Edit Box");
break;

default:
// Set the tooltip text.
pTTT->lpszText = _T("Tooltips everywhere!!!");
break;
}

return TRUE;
}

// Not handled.
return FALSE;
}