IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

MFC Discussion :

fonction GetWindowsDirectory pour Pocket PC


Sujet :

MFC

  1. #1
    Membre éclairé
    Inscrit en
    Janvier 2005
    Messages
    460
    Détails du profil
    Informations personnelles :
    Âge : 39

    Informations forums :
    Inscription : Janvier 2005
    Messages : 460
    Par défaut fonction GetWindowsDirectory pour Pocket PC
    bonjour,
    j'utilise la fonction GetWindowsDirectory pour obtenir le chemin du répertoire windows sur Windows mais cette fonction ne fonctionne pas sous Pocket PC, quel est l'équivalent ?

    merci,


  2. #2
    Rédacteur
    Avatar de nico-pyright(c)
    Profil pro
    Inscrit en
    Octobre 2003
    Messages
    6 414
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2003
    Messages : 6 414
    Par défaut
    on en parlait justement, t'as testé de charger dynamiquement la dll pour utiliser l'API ?

  3. #3
    Expert éminent
    Avatar de Médinoc
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Septembre 2005
    Messages
    27 391
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Septembre 2005
    Messages : 27 391
    Par défaut
    Sinon, est-ce que les fonctions du shell (genre SHGetSpecialFolderPath() et ses soeurs, qui pourraient t'être utiles) sont présentes ?
    SVP, pas de questions techniques par MP. Surtout si je ne vous ai jamais parlé avant.

    "Aw, come on, who would be so stupid as to insert a cast to make an error go away without actually fixing the error?"
    Apparently everyone.
    -- Raymond Chen.
    Traduction obligatoire: "Oh, voyons, qui serait assez stupide pour mettre un cast pour faire disparaitre un message d'erreur sans vraiment corriger l'erreur?" - Apparemment, tout le monde. -- Raymond Chen.

  4. #4
    Membre éclairé
    Inscrit en
    Janvier 2005
    Messages
    460
    Détails du profil
    Informations personnelles :
    Âge : 39

    Informations forums :
    Inscription : Janvier 2005
    Messages : 460
    Par défaut
    charger dynamiquement quelle DLL Nico ?

  5. #5
    Rédacteur
    Avatar de nico-pyright(c)
    Profil pro
    Inscrit en
    Octobre 2003
    Messages
    6 414
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2003
    Messages : 6 414
    Par défaut
    tente voir un truc comme ca :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
     
    typedef UINT (WINAPI *fGetWindowsDirectory)(LPTSTR, UINT);
     
    int main()
    {
    	HINSTANCE instance_kernel32 = NULL;
    	fGetWindowsDirectory pGetWindowsDirectory = NULL;
     
    	instance_kernel32 = LoadLibrary(L"kernel32.dll");
    	if (instance_kernel32)
    	{       
    		pGetWindowsDirectory = (fGetWindowsDirectory) GetProcAddress (instance_kernel32, "GetWindowsDirectoryW");
    		if (pGetWindowsDirectory)
    		{
    			TCHAR windowsDirectory[MAX_PATH];
    			pGetWindowsDirectory(windowsDirectory, MAX_PATH);
    		}
        }
    }

  6. #6
    Membre éclairé
    Inscrit en
    Janvier 2005
    Messages
    460
    Détails du profil
    Informations personnelles :
    Âge : 39

    Informations forums :
    Inscription : Janvier 2005
    Messages : 460
    Par défaut
    C'est quoi comme type de projet ?

  7. #7
    Rédacteur
    Avatar de nico-pyright(c)
    Profil pro
    Inscrit en
    Octobre 2003
    Messages
    6 414
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2003
    Messages : 6 414
    Par défaut
    euh là, en l'occurence, c'est un projet console, mais c'est pour le principe

    tu définis le typedef

    et ensuite tu mets ce que j'ai mis dans le main à l'endroit où tu veux récupérer le répertoire
    et ensuite tu regardes ce qu'il y a dans la variable windowsDirectory

  8. #8
    Membre éclairé
    Inscrit en
    Janvier 2005
    Messages
    460
    Détails du profil
    Informations personnelles :
    Âge : 39

    Informations forums :
    Inscription : Janvier 2005
    Messages : 460
    Par défaut
    en tout cas dans un projet embedded ou visual C++ ca ne compile pas =).
    Ca sert à quoi ton truc ?

  9. #9
    Rédacteur
    Avatar de nico-pyright(c)
    Profil pro
    Inscrit en
    Octobre 2003
    Messages
    6 414
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2003
    Messages : 6 414
    Par défaut
    qu'est-ce qui ne compile pas ? quelle erreur ? montre le code

  10. #10
    Membre éclairé
    Inscrit en
    Janvier 2005
    Messages
    460
    Détails du profil
    Informations personnelles :
    Âge : 39

    Informations forums :
    Inscription : Janvier 2005
    Messages : 460
    Par défaut
    Ou alors quel est le chemin Windows par défaut sur Pocket PC ?

  11. #11
    Expert éminent
    Avatar de Médinoc
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Septembre 2005
    Messages
    27 391
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Septembre 2005
    Messages : 27 391
    Par défaut
    Citation Envoyé par Médinoc
    Sinon, est-ce que les fonctions du shell (genre SHGetSpecialFolderPath() et ses soeurs, qui pourraient t'être utiles) sont présentes ?
    SVP, pas de questions techniques par MP. Surtout si je ne vous ai jamais parlé avant.

    "Aw, come on, who would be so stupid as to insert a cast to make an error go away without actually fixing the error?"
    Apparently everyone.
    -- Raymond Chen.
    Traduction obligatoire: "Oh, voyons, qui serait assez stupide pour mettre un cast pour faire disparaitre un message d'erreur sans vraiment corriger l'erreur?" - Apparemment, tout le monde. -- Raymond Chen.

  12. #12
    Rédacteur
    Avatar de farscape
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Novembre 2003
    Messages
    9 055
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Alpes Maritimes (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Novembre 2003
    Messages : 9 055
    Par défaut
    oui cette fonction est disponible a partir de wince 2.12.

  13. #13
    Rédacteur
    Avatar de nico-pyright(c)
    Profil pro
    Inscrit en
    Octobre 2003
    Messages
    6 414
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2003
    Messages : 6 414
    Par défaut
    bon, personne ne veut tester la solution avec loadlibrary ? comment est-ce que je satisfais ma curiosité moi ?

  14. #14
    Rédacteur
    Avatar de farscape
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Novembre 2003
    Messages
    9 055
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Alpes Maritimes (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Novembre 2003
    Messages : 9 055
    Par défaut
    j'ai essayé rapidement ce matin,
    LoadLibrary renvoie NULL , j'ai pas trop le temps d'aller plus loin l'instant.
    des que j'ai du neuf je ferais signe.

  15. #15
    Membre éclairé
    Inscrit en
    Janvier 2005
    Messages
    460
    Détails du profil
    Informations personnelles :
    Âge : 39

    Informations forums :
    Inscription : Janvier 2005
    Messages : 460
    Par défaut
    char mesDocumentsPath[MAX_PATH];
    SHGetSpecialFolderPath(0,mesDocumentsPath,CSIDL_PERSONAL,0);

    char applicationData[MAX_PATH];
    SHGetSpecialFolderPath(0,applicationData,CSIDL_COMMON_APPDATA,0);

    char bureau[MAX_PATH];
    SHGetSpecialFolderPath(0,bureau,CSIDL_DESKTOPDIRECTORY,0);

    char favoris[MAX_PATH];
    SHGetSpecialFolderPath(0,favoris,CSIDL_FAVORITES,0);

    char maMusique[MAX_PATH];
    SHGetSpecialFolderPath(0,maMusique,CSIDL_MYMUSIC,0);

    char mesImages[MAX_PATH];
    SHGetSpecialFolderPath(0,mesImages,CSIDL_MYPICTURES,0);

    char profile[MAX_PATH];
    SHGetSpecialFolderPath(0,profile,CSIDL_PROFILE,0);

    char programFiles[MAX_PATH];
    SHGetSpecialFolderPath(0,programFiles,CSIDL_PROGRAM_FILES,0);

    char sendTo[MAX_PATH];
    SHGetSpecialFolderPath(0,sendTo,CSIDL_SENDTO,0);


    Voilà les répertoires trouvés dans la FAQ C de Developpez.com, mais pas notre ami le répertoire Windows

  16. #16
    Membre éclairé
    Inscrit en
    Janvier 2005
    Messages
    460
    Détails du profil
    Informations personnelles :
    Âge : 39

    Informations forums :
    Inscription : Janvier 2005
    Messages : 460
    Par défaut
    char windows[MAX_PATH];
    SHGetSpecialFolderPath(0,windows,CSIDL_WINDOWS,0);

  17. #17
    Rédacteur
    Avatar de nico-pyright(c)
    Profil pro
    Inscrit en
    Octobre 2003
    Messages
    6 414
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2003
    Messages : 6 414
    Par défaut
    ce n'était pas exhaustif, la msdn t'aurait dit d'utiliser CSIDL_WINDOWS

  18. #18
    Membre éclairé
    Inscrit en
    Janvier 2005
    Messages
    460
    Détails du profil
    Informations personnelles :
    Âge : 39

    Informations forums :
    Inscription : Janvier 2005
    Messages : 460
    Par défaut
    Problème on ne peut pas avoir le répertoire Windows pour Pocket PC, voici la liste :
    CSIDL_BITBUCKET File system directory that contains file objects in the user's Recycle Bin. The location of this directory is not in the registry; it is marked with the hidden and system attributes to prevent the user from moving or deleting it.
    CSIDL_CONTROLS Virtual folder containing icons for Control Panel applications.
    CSIDL_DESKTOP Windows CE Desktop, which is a virtual folder at the root of the namespace.
    CSIDL_DESKTOPDIRECTORY File system directory used to physically store file objects on the desktop, which is not to be confused with the desktop folder itself.
    CSIDL_DRIVES My Computer, which is a virtual folder that contains everything on the local computer: storage devices, printers, and Control Panel. The folder can also contain mapped network drives.
    CSIDL_FAVORITES File system directory that serves as a common repository for the user's favorite items.
    CSIDL_FONTS Virtual folder containing fonts.
    CSIDL_NETHOOD File system directory containing objects that appear in the network neighborhood.
    CSIDL_NETWORK Network Neighborhood Folder, which is a virtual folder that represents the top level of the network hierarchy.
    CSIDL_PERSONAL File system directory that serves as a common repository for documents.
    CSIDL_PRINTERS Virtual folder containing installed printers.
    CSIDL_PROFILE Folder that contains the profile of the user.
    CSIDL_PROGRAMS File system directory that contains the user's program groups, which are also file system directories.
    CSIDL_RECENT File system directory that contains the user's most recently used documents.
    CSIDL_SENDTO File system directory that contains Send To menu items.
    CSIDL_STARTMENU File system directory containing Start menu items.
    CSIDL_STARTUP File system directory that corresponds to the user's Startup program group. The system starts these programs when a device is powered on.
    CSIDL_TEMPLATES File system directory that serves as a common repository for document templates.

  19. #19
    Expert éminent
    Avatar de Médinoc
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Septembre 2005
    Messages
    27 391
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Septembre 2005
    Messages : 27 391
    Par défaut
    Ben, quelle est ta version?
    Dans celle-ci (/wceshellui5) j'ai CSIDL_WINDOWS :
    http://msdn.microsoft.com/library/de...FolderPath.asp

    Dans /wceui40 aussi:
    http://msdn.microsoft.com/library/de...folderpath.asp

    Et je n'en vois pas d'autre sur MSDN (à part celle du Windows normal).
    SVP, pas de questions techniques par MP. Surtout si je ne vous ai jamais parlé avant.

    "Aw, come on, who would be so stupid as to insert a cast to make an error go away without actually fixing the error?"
    Apparently everyone.
    -- Raymond Chen.
    Traduction obligatoire: "Oh, voyons, qui serait assez stupide pour mettre un cast pour faire disparaitre un message d'erreur sans vraiment corriger l'erreur?" - Apparemment, tout le monde. -- Raymond Chen.

  20. #20
    Membre éclairé
    Inscrit en
    Janvier 2005
    Messages
    460
    Détails du profil
    Informations personnelles :
    Âge : 39

    Informations forums :
    Inscription : Janvier 2005
    Messages : 460
    Par défaut
    Je Développe avec Embedded Visual C++ SP4 pour Pocket PC 2003 ( après je passerai mon code en mobile 5.0).
    L'erreur que j'ai :
    error C2664: 'SHGetSpecialFolderPath' : cannot convert parameter 2 from 'char [260]' to 'unsigned short *'
    Code :
    static char windows[MAX_PATH];
    bool a=SHGetSpecialFolderPath(0,windows,CSIDL_WINDOWS,0);

+ Répondre à la discussion
Cette discussion est résolue.
Page 1 sur 2 12 DernièreDernière

Discussions similaires

  1. fonction c pour manipuler la structure date
    Par thomas_b dans le forum Windows
    Réponses: 4
    Dernier message: 28/07/2004, 16h28
  2. [winsock.h] Fonction recv() pour un socket en C
    Par Hikaru dans le forum Windows
    Réponses: 5
    Dernier message: 22/05/2004, 07h43
  3. Des fonctions OGL pour les images de format usuel ?
    Par jamal24 dans le forum OpenGL
    Réponses: 3
    Dernier message: 31/05/2003, 21h59
  4. Fonction/méthode pour obtenir l'IP de la machine
    Par sirex007 dans le forum Web & réseau
    Réponses: 3
    Dernier message: 10/04/2003, 14h36
  5. Réponses: 3
    Dernier message: 02/09/2002, 18h49

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo