Click here to Skip to main content
16,019,843 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: HTML Control Pin
David Crow22-Aug-06 2:53
David Crow22-Aug-06 2:53 
AnswerRe: HTML Control Pin
Ed K22-Aug-06 2:54
Ed K22-Aug-06 2:54 
GeneralRe: HTML Control Pin
CoolASL22-Aug-06 21:01
CoolASL22-Aug-06 21:01 
AnswerRe: HTML Control Pin
Hamid Taebi22-Aug-06 20:28
professionalHamid Taebi22-Aug-06 20:28 
QuestionTo set the font style to BOLD Pin
Sameer_Thakur22-Aug-06 1:36
Sameer_Thakur22-Aug-06 1:36 
AnswerRe: To set the font style to BOLD Pin
Christian Graus22-Aug-06 1:59
protectorChristian Graus22-Aug-06 1:59 
AnswerRe: To set the font style to BOLD Pin
David Crow22-Aug-06 2:40
David Crow22-Aug-06 2:40 
QuestionCreating a desktop shortcut on 64-bit Vista Pin
kpkrind22-Aug-06 1:19
kpkrind22-Aug-06 1:19 
Hello,

I am creating a short-cut to an installed application in the "C:\Program Files (x86)" folder, but the target always seems to point to the "C:\Program Files" folder, the only problem with this is the short-cut icon shown is the default one. But if i double-click the short-cut, the app is invoked fine. Is this a problem with the 64-bit Vista shell or am i doing something wrong in the below mentioned program. My appname is test.exe and is installed in the "C:\\Program Files (x86)\\Sample" folder.

All the folders usedin the below program were valid one's on my system.

This same program works fine on XP-64 bit.

Regards,



HRESULT CreateLink(LPCSTR lpszPathObj, LPCSTR lpszPathLink, LPCSTR lpszDesc, LPCSTR lpszWorkDir) ;

int _tmain(int argc, _TCHAR* argv[])

{

CoInitialize(NULL);

HRESULT ret = CreateLink("C:\\Program Files (x86)\\Sample\\test.exe","c:\\users\\public\\desktop\\test.lnk","Test","C:\\Program Files (x86)\\Sample");

if(SUCCEEDED(ret))

printf("\nCreate link succeeded");

else

printf("\nCreate link failed");

CoUninitialize();

return 0;

}

HRESULT CreateLink(LPCSTR lpszPathObj, LPCSTR lpszPathLink, LPCSTR lpszDesc, LPCSTR lpszWorkDir)

{

HRESULT hres;

IShellLink* psl;


// Get a pointer to the IShellLink interface.

hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,

IID_IShellLink, (LPVOID*)&psl);

if (SUCCEEDED(hres))

{

printf("\nSucceded in creating an instance");

IPersistFile* ppf;


// Set the path to the shortcut target and add the description.

psl->SetPath(lpszPathObj);

psl->SetDescription(lpszDesc);

psl->SetWorkingDirectory(lpszWorkDir);

//psl->SetIconLocation(lpszWorkDir, 0);



// Query IShellLink for the IPersistFile interface for saving the

// shortcut in persistent storage.

hres = psl->QueryInterface(IID_IPersistFile, (LPVOID*)&ppf);


if (SUCCEEDED(hres))

{

WCHAR wsz[MAX_PATH];


printf("\nSucceded in querying interface");

// Ensure that the string is Unicode.

if(MultiByteToWideChar(CP_ACP, 0, lpszPathLink, -1, wsz, MAX_PATH))

{

// TODO: Check return value from MultiByteWideChar to ensure success.

printf("\nSucceded in conversion");

char pszGetPath[MAX_PATH];

if(SUCCEEDED(psl->GetPath(pszGetPath,MAX_PATH,NULL,SLGP_RAWPATH)))

printf("\nGet Path: %s",pszGetPath);

else

printf("\nGet Path failed");

// Save the link by calling IPersistFile::Save.

hres = ppf->Save(wsz, TRUE);


}


ppf->Release();

}

psl->Release();

}

return hres;

}


Regards,
Pavan
AnswerRe: Creating a desktop shortcut on 64-bit Vista Pin
kakan22-Aug-06 3:16
professionalkakan22-Aug-06 3:16 
GeneralRe: Creating a desktop shortcut on 64-bit Vista Pin
kpkrind22-Aug-06 3:42
kpkrind22-Aug-06 3:42 
GeneralRe: Creating a desktop shortcut on 64-bit Vista Pin
kakan22-Aug-06 4:13
professionalkakan22-Aug-06 4:13 
QuestionNeed help Urgent Pin
reddy harish22-Aug-06 1:02
reddy harish22-Aug-06 1:02 
AnswerRe: Need help Urgent Pin
Cedric Moonen22-Aug-06 1:10
Cedric Moonen22-Aug-06 1:10 
GeneralRe: Need help Urgent Pin
reddy harish22-Aug-06 1:25
reddy harish22-Aug-06 1:25 
GeneralRe: Need help Urgent Pin
Cedric Moonen22-Aug-06 1:31
Cedric Moonen22-Aug-06 1:31 
AnswerRe: Need help Urgent Pin
Christian Graus22-Aug-06 1:17
protectorChristian Graus22-Aug-06 1:17 
AnswerRe: Need help Urgent Pin
Hamid Taebi22-Aug-06 1:19
professionalHamid Taebi22-Aug-06 1:19 
AnswerRe: Need help Urgent Pin
toxcct22-Aug-06 2:25
toxcct22-Aug-06 2:25 
AnswerRe: Need help Urgent Pin
Zac Howland22-Aug-06 4:59
Zac Howland22-Aug-06 4:59 
QuestionGetKeyState fonction how to use Pin
NorGUI22-Aug-06 0:33
NorGUI22-Aug-06 0:33 
AnswerRe: GetKeyState fonction how to use [modified] Pin
_AnsHUMAN_ 22-Aug-06 0:47
_AnsHUMAN_ 22-Aug-06 0:47 
QuestionHow to activate a application and show it on screen which is currently minimized? Pin
Hemant kulkarni22-Aug-06 0:00
Hemant kulkarni22-Aug-06 0:00 
AnswerRe: How to activate a application and show it on screen which is currently minimized? Pin
prasad_som22-Aug-06 0:10
prasad_som22-Aug-06 0:10 
GeneralRe: How to activate a application and show it on screen which is currently minimized? Pin
Hemant kulkarni22-Aug-06 0:43
Hemant kulkarni22-Aug-06 0:43 
AnswerRe: How to activate a application and show it on screen which is currently minimized? Pin
Nibu babu thomas22-Aug-06 0:12
Nibu babu thomas22-Aug-06 0:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.