Re: How to determine special folder location
Adam Walley <[email protected]> Mon, 29 Mar 2010 23:52:53 +0100
| Newsgroups | gmane.comp.python.windows-ce |
|---|---|
| Message-ID | <[email protected]> |
--===============2078627374== Content-Type: multipart/alternative; boundary=0015175884f68ce9a40482f85fbb --0015175884f68ce9a40482f85fbb Content-Type: text/plain; charset=ISO-8859-1 Nice work. I will definitely make a note of that one. Thanks rodi. Adam. On 29 March 2010 23:02, rodi <[email protected]> wrote: > Hello PytonCE users, > > have solved the question. The appropriate function > is 'SHGetSpecialFolderPath': see > http://msdn.microsoft.com/en-us/library/aa931257.aspx > > May be this info and the follwing code snippet is helpfull to others :) > > import ctypes > from time import sleep > > HANDLE = ctypes.c_ulong > HWND = HANDLE > INT = ctypes.c_int > BOOL = ctypes.c_int > > SHGetSpecialFolderPath = ctypes.windll.coredll.SHGetSpecialFolderPath > # BOOL SHGetSpecialFolderPath( HWND hwndOwner, LPTSTR lpszPath, int > nFolder, > BOOL fCreate ); > SHGetSpecialFolderPath.argtypes = [HWND, ctypes.c_wchar_p, INT, BOOL] > MAX_PATH = 260 > path = ctypes.create_unicode_buffer(MAX_PATH) > for i in range(0, 60): #[CSIDL_STARTMENU, CSIDL_PROGRAMS]: > try: > SHGetSpecialFolderPath( 0, path, i, 0) > if len(path.value)>0: > print i, path.value > else: > print i, 'not supported' > except Exception, e: > print i, 'exception', e > sleep(5) > > > Cheers rodi. > _______________________________________________ > PythonCE mailing list > [email protected] > http://mail.python.org/mailman/listinfo/pythonce > --0015175884f68ce9a40482f85fbb Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Nice work.<br><br>I will definitely make a note of that one.<br><br>Thanks = rodi.<br><br>Adam.<br><br><div class=3D"gmail_quote">On 29 March 2010 23:02= , rodi <span dir=3D"ltr"><<a href=3D"mailto:[email protected]">[email protected]</= a>></span> wrote:<br> <blockquote class=3D"gmail_quote" style=3D"margin: 0pt 0pt 0pt 0.8ex; borde= r-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Hello PytonCE use= rs,<br> <br> have solved the question. The appropriate function<br> is 'SHGetSpecialFolderPath': see<br> <a href=3D"http://msdn.microsoft.com/en-us/library/aa931257.aspx" target=3D= "_blank">http://msdn.microsoft.com/en-us/library/aa931257.aspx</a><br> <br> May be this info and the follwing code snippet is helpfull to others :)<br> <br> import ctypes<br> from time import sleep<br> <br> HANDLE =3D ctypes.c_ulong<br> HWND =3D HANDLE<br> INT =3D ctypes.c_int<br> BOOL =3D ctypes.c_int<br> <br> SHGetSpecialFolderPath =3D ctypes.windll.coredll.SHGetSpecialFolderPath<br> # BOOL SHGetSpecialFolderPath( HWND hwndOwner, LPTSTR lpszPath, int nFolder= ,<br> BOOL fCreate );<br> SHGetSpecialFolderPath.argtypes =3D [HWND, ctypes.c_wchar_p, INT, BOOL]<br> MAX_PATH =3D 260<br> path =3D ctypes.create_unicode_buffer(MAX_PATH)<br> for i in range(0, 60): #[CSIDL_STARTMENU, CSIDL_PROGRAMS]:<br> =A0 =A0try:<br> =A0 =A0 =A0 =A0SHGetSpecialFolderPath( 0, =A0path, i, 0)<br> =A0 =A0 =A0 =A0if len(path.value)>0:<br> =A0 =A0 =A0 =A0 =A0 =A0print i, path.value<br> =A0 =A0 =A0 =A0else:<br> =A0 =A0 =A0 =A0 =A0 =A0print i, 'not supported'<br> =A0 =A0except Exception, e:<br> =A0 =A0 =A0 =A0print i, 'exception', e<br> sleep(5)<br> <div><div></div><div class=3D"h5"><br> <br> Cheers rodi.<br> _______________________________________________<br> PythonCE mailing list<br> <a href=3D"mailto:[email protected]">[email protected]</a><br> <a href=3D"http://mail.python.org/mailman/listinfo/pythonce" target=3D"_bla= nk">http://mail.python.org/mailman/listinfo/pythonce</a><br> </div></div></blockquote></div><br> --0015175884f68ce9a40482f85fbb-- --===============2078627374== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ PythonCE mailing list [email protected] http://mail.python.org/mailman/listinfo/pythonce --===============2078627374==--