1Danke
ERLEDIGT
JA
JA
ANTWORTEN
2
2
ZUGRIFFE
1589
1589
EMPFEHLEN
-
Guten Morgen ich hätte da mal eine Frage und hoffe sehr das mir da jemand weiterhelfen kann.
Es geht ganz einfach gesagt darum mittels C++ ein Icon auf dem Desktop zu erzeugen.
Weis jemand wie das geht oder hat da jemand Erfahrung mit gemacht?
Wäre wirklich sehr dankbar um jeden Tipp und jede Idee
greetz sand13r#include<MCoder.h>
#include<iostream>
#include<conio.h>
int main()
{
MCoder *pmcoder;
cout<<"Please ask your Question!!"<<endl;
cin>>pmcoder->QuestionString;
cout<<"Answer is:" <<pmcoder->GetAnswer(pmcoder->QuestionString)<<endl;
getch();
return 0;
}
-
Ist ein bißchen aufwendig, sieh dir mal die Funktionen an.
Benötigt
#include <windows.h>
#include <shlobj.h>
und ich meine auch eine shlwapi.lib (oder so ähnlich).
Code :1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
bool CProgramGroups::CreateLink( const GR::tChar* szPath, const GR::tChar* szDescription, const GR::tChar* szFile, const GR::tChar* szIconPath, GR::u32 dwIconIndex, const GR::tChar* szParameter ) { HRESULT hRes; IShellLink *pISL; IPersistFile *pIPF; GR::tChar szTemp[1000]; bool bResult; if ( !SUCCEEDED( CoInitialize( NULL ) ) ) { return false; } hRes = CoCreateInstance( CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void **)&pISL ); if ( !SUCCEEDED( hRes ) ) { CoUninitialize(); return false; } hRes = pISL->QueryInterface( IID_IPersistFile, (void **)&pIPF ); if ( !SUCCEEDED( hRes ) ) { //MessageBox( NULL, "failed to query isl", "error", MB_OK | MB_APPLMODAL ); CoUninitialize(); return false; } pISL->SetPath( szFile ); wsprintf( szTemp, szFile ); do { if ( _tcslen( szTemp ) ) { szTemp[_tcslen( szTemp ) - 1] = 0; } else { break; } } while ( szTemp[_tcslen( szTemp ) - 1] != 92 ); pISL->SetWorkingDirectory( szTemp ); if ( szParameter ) { pISL->SetArguments( szParameter ); } if ( szIconPath != NULL ) { pISL->SetIconLocation( szIconPath, dwIconIndex ); } GR::tString strDummy; strDummy = szPath; if ( strDummy.length() > 0 ) { if ( strDummy[strDummy.length() - 1] != 92 ) { strDummy += '\\'; } } strDummy += szDescription; strDummy += _T( ".lnk" ); // falls der Shortcut schon existiert, löschen, sonst klappt Save nicht! DeleteFile( strDummy.c_str() ); #ifdef UNICODE std::wstring wString( strDummy ); #else std::wstring wString = GR::Convert::ToWString( strDummy ); #endif hRes = pIPF->Save( wString.c_str(), STGM_READ ); if ( SUCCEEDED( hRes ) ) { bResult = true; } else { bResult = false; } pIPF->Release(); pISL->Release(); CoUninitialize(); return bResult; } bool CProgramGroups::CreateProgramLink( const GR::tChar* szDescription, const GR::tChar* szFile, const GR::tChar* szParameter, const GR::tChar* szIconPath, GR::u32 dwIconIndex, bool bCurrentUser ) { GR::tChar szStartMenuPath[MAX_PATH], szTemp[1000]; HKEY hKey, hChildKey; DWORD dwType, dwSize; GR::tString strShellFolder = _T( "Programs" ); if ( bCurrentUser ) { hKey = HKEY_CURRENT_USER; } else { hKey = HKEY_LOCAL_MACHINE; strShellFolder = _T( "Common Programs" ); } wsprintf( szTemp, _T( "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders" ) ); hChildKey = NULL; if ( RegOpenKeyEx( hKey, szTemp, 0, KEY_QUERY_VALUE, &hChildKey ) != ERROR_SUCCESS ) { return false; } dwSize = sizeof( szStartMenuPath ); RegQueryValueEx( hChildKey, strShellFolder.c_str(), NULL, &dwType, (unsigned char*)szStartMenuPath, &dwSize ); RegCloseKey( hChildKey ); RegCloseKey( hKey ); return CreateLink( szStartMenuPath, szDescription, szFile, szIconPath, dwIconIndex, szParameter ); } bool CProgramGroups::CreateDesktopLink( const GR::tChar* szDescription, const GR::tChar* szFile, const GR::tChar* szIconPath, GR::u32 dwIconIndex, bool bCurrentUser ) { GR::tChar szTemp[1000], szDesktopPath[MAX_PATH]; HKEY hKey, hChildKey; DWORD dwType, dwSize; if ( bCurrentUser ) { hKey = HKEY_CURRENT_USER; } else { hKey = HKEY_LOCAL_MACHINE; } wsprintf( szTemp, _T( "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders" ) ); hChildKey = NULL; if ( RegOpenKeyEx( hKey, szTemp, 0, KEY_QUERY_VALUE, &hChildKey ) != ERROR_SUCCESS ) { return false; } dwSize = sizeof( szDesktopPath ); RegQueryValueEx( hChildKey, _T( "Desktop" ), NULL, &dwType, (unsigned char*)szDesktopPath, &dwSize ); RegCloseKey( hChildKey ); RegCloseKey( hKey ); return CreateLink( szDesktopPath, szDescription, szFile, szIconPath, dwIconIndex ); }
-
Ich danke dir für deine Hilfe

Hat sich auch schon erledigt
werd wenn ich noch was brauche deinen Code
gerne hinzunehmen Danke dafür
DANKE DANKE
greetz sand13r#include<MCoder.h>
#include<iostream>
#include<conio.h>
int main()
{
MCoder *pmcoder;
cout<<"Please ask your Question!!"<<endl;
cin>>pmcoder->QuestionString;
cout<<"Answer is:" <<pmcoder->GetAnswer(pmcoder->QuestionString)<<endl;
getch();
return 0;
}
Ähnliche Themen
-
Icon auf Desktop kopieren
Von Onkel Schuppig im Forum VisualStudio & MFCAntworten: 2Letzter Beitrag: 23.08.07, 10:23 -
Desktop icon Blue Boy
Von digital art im Forum Bildbearbeitung & IllustrationAntworten: 6Letzter Beitrag: 30.09.06, 18:45 -
Desktop Icon
Von Martin Schroeder im Forum Microsoft WindowsAntworten: 3Letzter Beitrag: 22.12.04, 23:40 -
Icon auf Desktop
Von Nobsi im Forum Coders TalkAntworten: 0Letzter Beitrag: 23.07.04, 08:01 -
Desktop-Icon des IE ändern
Von GiminiC im Forum Microsoft WindowsAntworten: 8Letzter Beitrag: 27.08.02, 16:44





Zitieren
Login






