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. Why not?

Why not?

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelp
7 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.
  • L Offline
    L Offline
    Larsson
    wrote on last edited by
    #1

    I get this error when i compile, cannot convert from 'CWnd *' to 'HWND' here is the code: HWND hwndNotepad; // A handle to the Notepad window hwndNotepad = FindWindow("Notepad", NULL); How can I get this to work?

    M H 2 Replies Last reply
    0
    • L Larsson

      I get this error when i compile, cannot convert from 'CWnd *' to 'HWND' here is the code: HWND hwndNotepad; // A handle to the Notepad window hwndNotepad = FindWindow("Notepad", NULL); How can I get this to work?

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      try HWND hwndNotepad; // A handle to the Notepad window hwndNotepad = ::FindWindow("Notepad", NULL);

      L 1 Reply Last reply
      0
      • M Mark Salsbery

        try HWND hwndNotepad; // A handle to the Notepad window hwndNotepad = ::FindWindow("Notepad", NULL);

        L Offline
        L Offline
        Larsson
        wrote on last edited by
        #3

        Thanks that helpt me. But when I try to send to that windows I cant use this way? hwndEdit = ::FindWindowEx(hwndNotepad, NULL, "Edit", NULL); SendMessage(hwndEdit, WM_CHAR, lpszText[i]); This is the error I get, cannot convert parameter 1 from 'HWND' to 'UINT'

        M D 2 Replies Last reply
        0
        • L Larsson

          Thanks that helpt me. But when I try to send to that windows I cant use this way? hwndEdit = ::FindWindowEx(hwndNotepad, NULL, "Edit", NULL); SendMessage(hwndEdit, WM_CHAR, lpszText[i]); This is the error I get, cannot convert parameter 1 from 'HWND' to 'UINT'

          M Offline
          M Offline
          Mark Salsbery
          wrote on last edited by
          #4

          Same thing. You are using Windows APIs in MFC class member functions so the compiler sees the MFC version. Use ::SendMessage(...) Edit - reword that :) Same thing. You are using Windows APIs in CWnd-derived class member functions so the compiler sees the CWnd version. Use ::SendMessage(...)

          L 1 Reply Last reply
          0
          • M Mark Salsbery

            Same thing. You are using Windows APIs in MFC class member functions so the compiler sees the MFC version. Use ::SendMessage(...) Edit - reword that :) Same thing. You are using Windows APIs in CWnd-derived class member functions so the compiler sees the CWnd version. Use ::SendMessage(...)

            L Offline
            L Offline
            Larsson
            wrote on last edited by
            #5

            You are the king! It work, thanks.

            1 Reply Last reply
            0
            • L Larsson

              Thanks that helpt me. But when I try to send to that windows I cant use this way? hwndEdit = ::FindWindowEx(hwndNotepad, NULL, "Edit", NULL); SendMessage(hwndEdit, WM_CHAR, lpszText[i]); This is the error I get, cannot convert parameter 1 from 'HWND' to 'UINT'

              D Offline
              D Offline
              Dominik Reichl
              wrote on last edited by
              #6

              Try this:

              HWND hwndEdit = ::FindWindowEx(hwndNotepad, NULL, "Edit", NULL);
              ::SendMessage(hwndEdit, WM_CHAR, lpszText[i], 0);
              

              _outp(0x64, 0xAD); and __asm mov al, 0xAD __asm out 0x64, al do the same... but what do they do?? ;) (doesn't work on NT)

              1 Reply Last reply
              0
              • L Larsson

                I get this error when i compile, cannot convert from 'CWnd *' to 'HWND' here is the code: HWND hwndNotepad; // A handle to the Notepad window hwndNotepad = FindWindow("Notepad", NULL); How can I get this to work?

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

                char *MY="Hello"; HWND hWnd = ::FindWindow("Notepad", NULL); CWnd *hWndEdit=FindWindowEx(hWnd,NULL,"Edit",NULL); ::SendMessage(hWndEdit->m_hWnd,WM_SETTEXT,0,(long)MY);


                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