I've been hooked to regex for a couple of days now and getting to know the real power of it. I wish that I had tried this years ago.
And the coolest one is this one which I just figured out. Change the date format from DD/MM/YYYY to MM/DD/YYYY and vice versa (assuming date is the first field in the line).
Search: ^{[0-9]*}/{[0-9]*}
Replace: \2/\1
I did this in MS VC.Net 2003 editor, and as far, its supports regex well.
Here's my Tech blog. I try to put down my adventures with Technology and other DIY stuff here.
Thursday, July 03, 2008
Saturday, December 08, 2007
PDFCreator
I have been using the PDFCreator for long time. It helps converting any documents to a PDF file with ease. But this creates just plain PDF with no links or bookmarks (document map as in Microsoft Word). I disparately needed to include the bookmarks in one of the huge document ( >1000 pages) and I came across Word to PDF pluggin for Word, called as PDF-T-Maker
It converts the word document into an intermediate format, containing the bookmarks, comments, links and routes to the PS converter.
It converts the word document into an intermediate format, containing the bookmarks, comments, links and routes to the PS converter.
Thursday, June 21, 2007
Disabling zip folder integration in Windows XP
After I got my new laptop which had new XP installation , I found that the Windows Explorer being slow to update at times, especially expanding the folder in the tree view. Figured it out that the built in zip support was slowing things up, I decided to disable the feature. To disable, simply unregister the component:
regsvr32 /u %windir%\system32\zipfldr.dll
regsvr32 /u %windir%\system32\zipfldr.dll
Wednesday, March 21, 2007
Widescreen hassles
The new format of the computer monitors and laptops are definitely good for watching movies, but not at all for regular web browsing. The increase in real estate can be better utilized by having two documents opened side by side and could improve some productivity. But the web pages in wide screen mode is annoying. I was searching for a tool which limits the browser window to be maximized only to 1024 pixels wide. Fooled around with msdn and thought that SetWindowPlacement would do the trick, but I was mistaken. Apparently it doesn't work with the explorer shell and the documentation doesn't say so. i found that there is another way that is handled by the individual applications. Each application can specify its maximized size. The message to handle is WM_GETMINMAXINFO. I would need to install a message hook to get into the application and handle for each of them. Still not clear whether its worth the try.
Wednesday, January 03, 2007
My Shares

It was not very hard, but finding the right API's was a bit challenging. And then I was stuck at some conversion functions.
Here's are the main functions that I chose:
NetShareEnum - Gives the list of shared resources on a given machine
wcstombs - To convert wide str to mcbs (NetShareEnum returns wide str)
OpenClipboard, EmptyClipboard, SetClipboardData, CloseClipboard- For clipboard operations
GetAsyncKeyState - Status of shift key
Monday, January 01, 2007
Removing labels from VSS
If you had accidentally created a label for any items (file of directory), you can remove it by viewing the label from the item history, and deleting the label text. Close the dialog after confirmation and the label is removed. The changes would be affected globally irrespective of the item for which the label was modified.
Friday, April 21, 2006
Share data among processes through DLLs
I ran across this problem wherein I had to notify a process of an event which is triggered by another process through a DLL. Well, more precicely, the first process would invoke (this is an event) an exported function of the DLL and this function has to notify another process about this event. Now, this function could simply post a message to the main window of the second process, if it has a handle to it. Storing this handle is the problem. One obvious solution is to declare a static data in the dll and let the second process 'register' for notification by passing its window handle. Once it is stored, subsequent notifications are easy - just call PostMessage with this hwnd parameter. But there is a caveat. Eventhough DLL's map their code into the memory of each processes, it has separate instance for globals and static variables. Now these static members will be initialised separately for each processes when the DLL is loaded, which defeates the above method of sharing the window handle. There is a solution, atleast in MSVC environment. Create a named data-section in the dll code and place the data to be shared in it.
#pragma data_seg (".sharedseg")
HWND hNotifyWnd;
#pragma data_seg()
And give the linker option: /SECTION:.sharedseg,RWS
#pragma data_seg (".sharedseg")
HWND hNotifyWnd;
#pragma data_seg()
And give the linker option: /SECTION:.sharedseg,RWS
Tuesday, April 18, 2006
Logon Notification events under Windows


While working on the PSP program, I wanted to have a mechanism where to get notifications when the computer is locked and unlocked. Initially I thought that there would be some windows notification messages sent to every windows, but it was not the case. There is something called Windows Notification Package, which fecilitates the logon events for an application. All you need is to create a dll with required export functions (each function for Lock, Unlock, Logon,...) and create some registry entries. Now, this is a service of the Winlogon process, which is the main process started after the boot sequence. It is the Winlogon process that displays the SAS dialog. The registry key need to be created under:
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\Notify
Once the registry entries and dll are in place, the Windows need to be restarted. Apparently the Winlogon creates a list of notification functions at startup and debugging becomes a pain since the dll is locked by the process.
Subscribe to:
Posts (Atom)