Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Get problem with FindWindow(). Pls help! [modified]

Get problem with FindWindow(). Pls help! [modified]

Scheduled Pinned Locked Moved C / C++ / MFC
helpworkspacec++visual-studiodebugging
11 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    aluisdo
    wrote on last edited by
    #1

    Pls help me solve it... I got this error when I compile with VS 2005, pls help me.

    ------ Build started: Project: VLTKLib, Configuration: Debug Win32 ------
    Compiling...
    pHandle.cpp
    Linking...
    pHandle.obj : error LNK2028: unresolved token (0A000299) "extern "C" struct HWND__ * __stdcall FindWindowW(wchar_t const *,wchar_t const *)" (?FindWindowW@@$$J18YGPAUHWND__@@PB_W0@Z) referenced in function "public: void __thiscall VLTKLib::pHandle::setHandle(char *,char *)" (?setHandle@pHandle@VLTKLib@@$$FQAEXPAD0@Z)
    pHandle.obj : error LNK2028: unresolved token (0A00029B) "extern "C" unsigned long __stdcall GetWindowThreadProcessId(struct HWND__ *,unsigned long *)" (?GetWindowThreadProcessId@@$$J18YGKPAUHWND__@@PAK@Z) referenced in function "public: void __thiscall VLTKLib::pHandle::setHandle(struct HWND__ *)" (?setHandle@pHandle@VLTKLib@@$$FQAEXPAUHWND__@@@Z)
    pHandle.obj : error LNK2019: unresolved external symbol "extern "C" unsigned long __stdcall GetWindowThreadProcessId(struct HWND__ *,unsigned long *)" (?GetWindowThreadProcessId@@$$J18YGKPAUHWND__@@PAK@Z) referenced in function "public: void __thiscall VLTKLib::pHandle::setHandle(struct HWND__ *)" (?setHandle@pHandle@VLTKLib@@$$FQAEXPAUHWND__@@@Z)
    pHandle.obj : error LNK2019: unresolved external symbol "extern "C" struct HWND__ * __stdcall FindWindowW(wchar_t const *,wchar_t const *)" (?FindWindowW@@$$J18YGPAUHWND__@@PB_W0@Z) referenced in function "public: void __thiscall VLTKLib::pHandle::setHandle(char *,char *)" (?setHandle@pHandle@VLTKLib@@$$FQAEXPAD0@Z)
    d:\workspace\VLTK\Debug\VLTKLib.dll : fatal error LNK1120: 4 unresolved externals
    Build log was saved at "file://d:\workspace\VLTK\VLTKLib\Debug\BuildLog.htm"
    VLTKLib - 5 error(s), 0 warning(s)
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

    My class: pHandle.h

    #pragma once

    #include #include #include namespace VLTKLib
    {
    public class pHandle
    {
    private:
    HANDLE hProcess;

    public:
        pHandle(void);
        pHandle(HWND curWin);
        pHandle(char \*winClass, char \*winTitle);
        ~pHandle(void);
    
        void setHandle(HWND curWin);
        void setHandle(char \*winClass, char \*winTitle);
        void closeHandle();
        
        long ReadInt(LPBYTE lpAddress); //Read 4 bytes
        short ReadWord(LPBYTE lpAddress); //Read 2 bytes
        char ReadChar(LPBYTE lpAddress); //Read 1 byte
        char \*ReadString(LPBYTE lpAddress, int szChar);
    };
    

    }

    P H M 3 Replies Last reply
    0
    • A aluisdo

      Pls help me solve it... I got this error when I compile with VS 2005, pls help me.

      ------ Build started: Project: VLTKLib, Configuration: Debug Win32 ------
      Compiling...
      pHandle.cpp
      Linking...
      pHandle.obj : error LNK2028: unresolved token (0A000299) "extern "C" struct HWND__ * __stdcall FindWindowW(wchar_t const *,wchar_t const *)" (?FindWindowW@@$$J18YGPAUHWND__@@PB_W0@Z) referenced in function "public: void __thiscall VLTKLib::pHandle::setHandle(char *,char *)" (?setHandle@pHandle@VLTKLib@@$$FQAEXPAD0@Z)
      pHandle.obj : error LNK2028: unresolved token (0A00029B) "extern "C" unsigned long __stdcall GetWindowThreadProcessId(struct HWND__ *,unsigned long *)" (?GetWindowThreadProcessId@@$$J18YGKPAUHWND__@@PAK@Z) referenced in function "public: void __thiscall VLTKLib::pHandle::setHandle(struct HWND__ *)" (?setHandle@pHandle@VLTKLib@@$$FQAEXPAUHWND__@@@Z)
      pHandle.obj : error LNK2019: unresolved external symbol "extern "C" unsigned long __stdcall GetWindowThreadProcessId(struct HWND__ *,unsigned long *)" (?GetWindowThreadProcessId@@$$J18YGKPAUHWND__@@PAK@Z) referenced in function "public: void __thiscall VLTKLib::pHandle::setHandle(struct HWND__ *)" (?setHandle@pHandle@VLTKLib@@$$FQAEXPAUHWND__@@@Z)
      pHandle.obj : error LNK2019: unresolved external symbol "extern "C" struct HWND__ * __stdcall FindWindowW(wchar_t const *,wchar_t const *)" (?FindWindowW@@$$J18YGPAUHWND__@@PB_W0@Z) referenced in function "public: void __thiscall VLTKLib::pHandle::setHandle(char *,char *)" (?setHandle@pHandle@VLTKLib@@$$FQAEXPAD0@Z)
      d:\workspace\VLTK\Debug\VLTKLib.dll : fatal error LNK1120: 4 unresolved externals
      Build log was saved at "file://d:\workspace\VLTK\VLTKLib\Debug\BuildLog.htm"
      VLTKLib - 5 error(s), 0 warning(s)
      ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

      My class: pHandle.h

      #pragma once

      #include #include #include namespace VLTKLib
      {
      public class pHandle
      {
      private:
      HANDLE hProcess;

      public:
          pHandle(void);
          pHandle(HWND curWin);
          pHandle(char \*winClass, char \*winTitle);
          ~pHandle(void);
      
          void setHandle(HWND curWin);
          void setHandle(char \*winClass, char \*winTitle);
          void closeHandle();
          
          long ReadInt(LPBYTE lpAddress); //Read 4 bytes
          short ReadWord(LPBYTE lpAddress); //Read 2 bytes
          char ReadChar(LPBYTE lpAddress); //Read 1 byte
          char \*ReadString(LPBYTE lpAddress, int szChar);
      };
      

      }

      P Offline
      P Offline
      prasad_som
      wrote on last edited by
      #2

      Have you used /NODEFAULTLIB linker option , by accident ?


      Prasad MS MVP -  VC++

      A 1 Reply Last reply
      0
      • A aluisdo

        Pls help me solve it... I got this error when I compile with VS 2005, pls help me.

        ------ Build started: Project: VLTKLib, Configuration: Debug Win32 ------
        Compiling...
        pHandle.cpp
        Linking...
        pHandle.obj : error LNK2028: unresolved token (0A000299) "extern "C" struct HWND__ * __stdcall FindWindowW(wchar_t const *,wchar_t const *)" (?FindWindowW@@$$J18YGPAUHWND__@@PB_W0@Z) referenced in function "public: void __thiscall VLTKLib::pHandle::setHandle(char *,char *)" (?setHandle@pHandle@VLTKLib@@$$FQAEXPAD0@Z)
        pHandle.obj : error LNK2028: unresolved token (0A00029B) "extern "C" unsigned long __stdcall GetWindowThreadProcessId(struct HWND__ *,unsigned long *)" (?GetWindowThreadProcessId@@$$J18YGKPAUHWND__@@PAK@Z) referenced in function "public: void __thiscall VLTKLib::pHandle::setHandle(struct HWND__ *)" (?setHandle@pHandle@VLTKLib@@$$FQAEXPAUHWND__@@@Z)
        pHandle.obj : error LNK2019: unresolved external symbol "extern "C" unsigned long __stdcall GetWindowThreadProcessId(struct HWND__ *,unsigned long *)" (?GetWindowThreadProcessId@@$$J18YGKPAUHWND__@@PAK@Z) referenced in function "public: void __thiscall VLTKLib::pHandle::setHandle(struct HWND__ *)" (?setHandle@pHandle@VLTKLib@@$$FQAEXPAUHWND__@@@Z)
        pHandle.obj : error LNK2019: unresolved external symbol "extern "C" struct HWND__ * __stdcall FindWindowW(wchar_t const *,wchar_t const *)" (?FindWindowW@@$$J18YGPAUHWND__@@PB_W0@Z) referenced in function "public: void __thiscall VLTKLib::pHandle::setHandle(char *,char *)" (?setHandle@pHandle@VLTKLib@@$$FQAEXPAD0@Z)
        d:\workspace\VLTK\Debug\VLTKLib.dll : fatal error LNK1120: 4 unresolved externals
        Build log was saved at "file://d:\workspace\VLTK\VLTKLib\Debug\BuildLog.htm"
        VLTKLib - 5 error(s), 0 warning(s)
        ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

        My class: pHandle.h

        #pragma once

        #include #include #include namespace VLTKLib
        {
        public class pHandle
        {
        private:
        HANDLE hProcess;

        public:
            pHandle(void);
            pHandle(HWND curWin);
            pHandle(char \*winClass, char \*winTitle);
            ~pHandle(void);
        
            void setHandle(HWND curWin);
            void setHandle(char \*winClass, char \*winTitle);
            void closeHandle();
            
            long ReadInt(LPBYTE lpAddress); //Read 4 bytes
            short ReadWord(LPBYTE lpAddress); //Read 2 bytes
            char ReadChar(LPBYTE lpAddress); //Read 1 byte
            char \*ReadString(LPBYTE lpAddress, int szChar);
        };
        

        }

        H Offline
        H Offline
        Hamid Taebi
        wrote on last edited by
        #3

        Did you import User32.lib?


        WhiteSky


        A 1 Reply Last reply
        0
        • H Hamid Taebi

          Did you import User32.lib?


          WhiteSky


          A Offline
          A Offline
          aluisdo
          wrote on last edited by
          #4

          How to import User32.lib? Tks for your help.

          H 1 Reply Last reply
          0
          • P prasad_som

            Have you used /NODEFAULTLIB linker option , by accident ?


            Prasad MS MVP -  VC++

            A Offline
            A Offline
            aluisdo
            wrote on last edited by
            #5

            How to check it? I did not change any thing. Tks for your help.

            P 1 Reply Last reply
            0
            • A aluisdo

              How to check it? I did not change any thing. Tks for your help.

              P Offline
              P Offline
              prasad_som
              wrote on last edited by
              #6

              Check Project setting-->configuration properties-->Input-->Ignore All default lib. set it to No if, if it is yes.


              Prasad MS MVP -  VC++

              1 Reply Last reply
              0
              • A aluisdo

                Pls help me solve it... I got this error when I compile with VS 2005, pls help me.

                ------ Build started: Project: VLTKLib, Configuration: Debug Win32 ------
                Compiling...
                pHandle.cpp
                Linking...
                pHandle.obj : error LNK2028: unresolved token (0A000299) "extern "C" struct HWND__ * __stdcall FindWindowW(wchar_t const *,wchar_t const *)" (?FindWindowW@@$$J18YGPAUHWND__@@PB_W0@Z) referenced in function "public: void __thiscall VLTKLib::pHandle::setHandle(char *,char *)" (?setHandle@pHandle@VLTKLib@@$$FQAEXPAD0@Z)
                pHandle.obj : error LNK2028: unresolved token (0A00029B) "extern "C" unsigned long __stdcall GetWindowThreadProcessId(struct HWND__ *,unsigned long *)" (?GetWindowThreadProcessId@@$$J18YGKPAUHWND__@@PAK@Z) referenced in function "public: void __thiscall VLTKLib::pHandle::setHandle(struct HWND__ *)" (?setHandle@pHandle@VLTKLib@@$$FQAEXPAUHWND__@@@Z)
                pHandle.obj : error LNK2019: unresolved external symbol "extern "C" unsigned long __stdcall GetWindowThreadProcessId(struct HWND__ *,unsigned long *)" (?GetWindowThreadProcessId@@$$J18YGKPAUHWND__@@PAK@Z) referenced in function "public: void __thiscall VLTKLib::pHandle::setHandle(struct HWND__ *)" (?setHandle@pHandle@VLTKLib@@$$FQAEXPAUHWND__@@@Z)
                pHandle.obj : error LNK2019: unresolved external symbol "extern "C" struct HWND__ * __stdcall FindWindowW(wchar_t const *,wchar_t const *)" (?FindWindowW@@$$J18YGPAUHWND__@@PB_W0@Z) referenced in function "public: void __thiscall VLTKLib::pHandle::setHandle(char *,char *)" (?setHandle@pHandle@VLTKLib@@$$FQAEXPAD0@Z)
                d:\workspace\VLTK\Debug\VLTKLib.dll : fatal error LNK1120: 4 unresolved externals
                Build log was saved at "file://d:\workspace\VLTK\VLTKLib\Debug\BuildLog.htm"
                VLTKLib - 5 error(s), 0 warning(s)
                ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

                My class: pHandle.h

                #pragma once

                #include #include #include namespace VLTKLib
                {
                public class pHandle
                {
                private:
                HANDLE hProcess;

                public:
                    pHandle(void);
                    pHandle(HWND curWin);
                    pHandle(char \*winClass, char \*winTitle);
                    ~pHandle(void);
                
                    void setHandle(HWND curWin);
                    void setHandle(char \*winClass, char \*winTitle);
                    void closeHandle();
                    
                    long ReadInt(LPBYTE lpAddress); //Read 4 bytes
                    short ReadWord(LPBYTE lpAddress); //Read 2 bytes
                    char ReadChar(LPBYTE lpAddress); //Read 1 byte
                    char \*ReadString(LPBYTE lpAddress, int szChar);
                };
                

                }

                M Offline
                M Offline
                myshketer
                wrote on last edited by
                #7

                HWND curWin = FindWindow((LPCWSTR)winClass,(LPCWSTR)winTitle) - error !!! FindWindowW(wchar_t const *,wchar_t const *) - postfiks 'W' mean that the funktion use wchar_t instead char. And you can convert char* to wchar_t* by using _TEXT("") macros. And look here -> pHandle::setHandle(NULL) - wich of your function will be use?

                A 1 Reply Last reply
                0
                • A aluisdo

                  How to import User32.lib? Tks for your help.

                  H Offline
                  H Offline
                  Hamid Taebi
                  wrote on last edited by
                  #8

                  Right click on your project and select property on the solution window go to linker of tree list on the left panel open it and select input and enter this file at Additional Dependencies.


                  WhiteSky


                  A 1 Reply Last reply
                  0
                  • M myshketer

                    HWND curWin = FindWindow((LPCWSTR)winClass,(LPCWSTR)winTitle) - error !!! FindWindowW(wchar_t const *,wchar_t const *) - postfiks 'W' mean that the funktion use wchar_t instead char. And you can convert char* to wchar_t* by using _TEXT("") macros. And look here -> pHandle::setHandle(NULL) - wich of your function will be use?

                    A Offline
                    A Offline
                    aluisdo
                    wrote on last edited by
                    #9

                    Tks for your reply. I converted all char * to wchar_t const as same as definetion of function, but I still got that errors.

                    void pHandle::setHandle(wchar_t const *winClass, wchar_t const *winTitle)
                    {
                    HWND curWin = FindWindow(winClass,winTitle);
                    setHandle(curWin);
                    }

                    Tks for your help

                    1 Reply Last reply
                    0
                    • H Hamid Taebi

                      Right click on your project and select property on the solution window go to linker of tree list on the left panel open it and select input and enter this file at Additional Dependencies.


                      WhiteSky


                      A Offline
                      A Offline
                      aluisdo
                      wrote on last edited by
                      #10

                      Tks, It solved.

                      H 1 Reply Last reply
                      0
                      • A aluisdo

                        Tks, It solved.

                        H Offline
                        H Offline
                        Hamid Taebi
                        wrote on last edited by
                        #11

                        You're welcome.;)


                        WhiteSky


                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups