Posts

Showing posts from December, 2011

Adding shortcut menu in the Windows Start menu

In relation to the previous article the simplest way to add a shortcut menu in the Windows Start menu is to add the shortcut menu into the similar folder below.. C:\Documents and Settings\earl\Start Menu\Programs\ That's it! =)

Adding desktop shortcut programmtically in Windows

I was tinkering of how I can put a desktop shortcut of my program and I thought this is one of those things I still have to learn. So, I wander into the internet to find a most simple example and read lots of articles and discussion and somehow I find it daunting to read all those codes where all I want is to create a simple desktop shortcut. After a lot of reading and experimentation I finally have the code below. #include<windows.h> #include<shlobj.h>  int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInstance, LPSTR szCmdLine, int iCmdShow) {     createShortcut();     return 0; } void createShortcut() {     HRESULT hr;     ::CoInitialize(NULL); IShellLink *pShellLink; hr = ::CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_ALL,IID_IShellLink, (void**)&pShellLink); hr = pShellLink->SetPath("C:\\MyProjects\\OCXTest\\Debug\\OCXTest.exe");  // Path to the object we are referring to hr = pShellLink->SetDescription("This is a test!!&q