Fehler im Code



  • Nuance schrieb:

    13:22 D:\Dokumente und Einstellungen\Nuance\Desktop\Drop\res.h [Warning] no newline at end of file
    

    in res.h einfach ein enter nach 104

    Nuance schrieb:

    D:\Dokumente und Einstellungen\Nuance\Desktop\Drop\Main.cpp In function `int WinMain(HINSTANCE__*, HINSTANCE__*, CHAR*, int)': 
    80 D:\Dokumente und Einstellungen\Nuance\Desktop\Drop\Main.cpp cannot convert `HINSTANCE__*' to `HWND__*' for argument `1' to `HINSTANCE__* ShellExecuteA(HWND__*, const CHAR*, const CHAR*, const CHAR*, const CHAR*, INT)' 
    83 D:\Dokumente und Einstellungen\Nuance\Desktop\Drop\Main.cpp cannot convert `HINSTANCE__*' to `HWND__*' for argument `1' to `HINSTANCE__* ShellExecuteA(HWND__*, const CHAR*, const CHAR*, const CHAR*, const CHAR*, INT)' 
    86 D:\Dokumente und Einstellungen\Nuance\Desktop\Drop\Main.cpp cannot convert `HINSTANCE__*' to `HWND__*' for argument `1' to `HINSTANCE__* ShellExecuteA(HWND__*, const CHAR*, const CHAR*, const CHAR*, const CHAR*, INT)'
    

    das du kein fenster hast benutz null
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/functions/shellexecute.asp

    Nuance schrieb:

    90 D:\Dokumente und Einstellungen\Nuance\Desktop\Drop\Main.cpp `SystemPfad' undeclared (first use this function)
    

    er findet keine variable SystemPfad 😉 wobei SystemPfad == ShellPfad
    ist

    noch einige "schönheitsfehler" das #define WIN32_LEAN_AND_MEAN sollte vor
    dem #include <windows.h> stehen sonst macht es keinen sinn.
    die functions.h sollte includeguards besitzen. einem namespace in einem
    header öffnen könnte man auch als fehler ansehen, ...
    so jetzt höre ich aber auf 😃



  • danke schonmal,

    ein paar fehler konnte ich mit hilfe deiner Tipps beseitigen
    jedoch hab ich jetzt noch diese fehler:

    D:\Dokumente und Einstellungen\Nuance\Desktop\Drop\Main.cpp In function `int WinMain(HINSTANCE__*, HINSTANCE__*, CHAR*, int)': 
    79 D:\Dokumente und Einstellungen\Nuance\Desktop\Drop\Main.cpp `ShellExecute' undeclared (first use this function)
    

    vllt. kannst du da nochmal deine Hilfe beisteuern ? 😉



  • Header: shellapi.h
    Import library: shell32.lib



  • #define WIN32_LEAN_AND_MEAN entfernen oder #include <shellapi.h>

    generell steht in msdn immer unten was du benötigst (header, libs)

    [edit]
    mal richtig langsam, ich habe ne schöne page für lean_and_mean gesucht aber keine gefunden, kennt jemand eine? was es bewirkt weis ich schon, wollt nur noch nen link dazu hinknallen 😉



  • wenn ich shellapi.h einbinde, kommen mehr fehler als vorher, wenn ich
    #define WIN32_LEAN_AND_MEAN entferne ebenfalls



  • Nuance schrieb:

    wenn ich shellapi.h einbinde, kommen mehr fehler als vorher, wenn ich
    #define WIN32_LEAN_AND_MEAN entferne ebenfalls

    welche fehler, meine glaskugel ist in der werkstatt 😃

    sieht es so aus?

    #define WIN32_LEAN_AND_MEAN
    
    #include <windows.h>
    #include <shellapi.h>
    // weitere includes
    


  • stimmt, es sieht so aus:

    /* define for microsoft compiler */
    
    #define WIN32_LEAN_AND_MEAN
    
    #include <windows.h>
    #include <shellapi.h> 
    #include <stdlib.h>
    #include "res.h"
    #include "functions.h"
    

    das sind die fehler:

    D:\Dokumente und Einstellungen\Nuance\Desktop\Drop\Main.cpp In function `int WinMain(HINSTANCE__*, HINSTANCE__*, CHAR*, int)': 
    82 D:\Dokumente und Einstellungen\Nuance\Desktop\Drop\Main.cpp cannot convert `HINSTANCE__*' to `HWND__*' for argument `1' to `HINSTANCE__* ShellExecuteA(HWND__*, const CHAR*, const CHAR*, const CHAR*, const CHAR*, INT)' 
    85 D:\Dokumente und Einstellungen\Nuance\Desktop\Drop\Main.cpp cannot convert `HINSTANCE__*' to `HWND__*' for argument `1' to `HINSTANCE__* ShellExecuteA(HWND__*, const CHAR*, const CHAR*, const CHAR*, const CHAR*, INT)' 
    88 D:\Dokumente und Einstellungen\Nuance\Desktop\Drop\Main.cpp cannot convert `HINSTANCE__*' to `HWND__*' for argument `1' to `HINSTANCE__* ShellExecuteA(HWND__*, const CHAR*, const CHAR*, const CHAR*, const CHAR*, INT)'
    

    vorher waren es weniger fehler, siehe oben die letze fehlerangabe



  • miller_m schrieb:

    Nuance schrieb:

    D:\Dokumente und Einstellungen\Nuance\Desktop\Drop\Main.cpp In function `int WinMain(HINSTANCE__*, HINSTANCE__*, CHAR*, int)': 
    80 D:\Dokumente und Einstellungen\Nuance\Desktop\Drop\Main.cpp cannot convert `HINSTANCE__*' to `HWND__*' for argument `1' to `HINSTANCE__* ShellExecuteA(HWND__*, const CHAR*, const CHAR*, const CHAR*, const CHAR*, INT)' 
    83 D:\Dokumente und Einstellungen\Nuance\Desktop\Drop\Main.cpp cannot convert `HINSTANCE__*' to `HWND__*' for argument `1' to `HINSTANCE__* ShellExecuteA(HWND__*, const CHAR*, const CHAR*, const CHAR*, const CHAR*, INT)' 
    86 D:\Dokumente und Einstellungen\Nuance\Desktop\Drop\Main.cpp cannot convert `HINSTANCE__*' to `HWND__*' for argument `1' to `HINSTANCE__* ShellExecuteA(HWND__*, const CHAR*, const CHAR*, const CHAR*, const CHAR*, INT)'
    

    da du kein fenster hast benutz null
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/functions/shellexecute.asp

    habe ich schon erklärt, erster post von mir.



  • wenn ich das so mache wie du es gesagt hast, müsste die Funktion so aussehen:

    //Config
      ShellExecute(hInst,"open","regedit.exe", "-s config.reg", NULL, NULL);
    

    das bringt aber die gleichen fehler!



  • erster parameter ist das fensterhandle, da du keins hast (fenster) ➡ NULL
    [cpp]ShellExecute(NULL,"open","regedit.exe", "-s config.reg", NULL, NULL);[/cpp]



  • viele danke euch beiden, es hat funktioniert!!!!

    Mfg


Anmelden zum Antworten