Click here to Skip to main content
15,889,877 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Coders

I have created a window using Win32 API,c++ with single menu option Services. I have programmed the working of Service option.
Problem:- When I display the services on the window, it displays contents but paints the Window actually.

But I want that when I click the menu option it should display all the services as they are displayed on the Task Manager and can be copied too.
Please answer me regarding this problem only.

Thank you in Anticipation

[Update]
The code for creating a Edit control is here.

C++
case WM_CREATE:

hWndEdit=CreateWindow(_T("EDIT"), // We are creating an Edit control
                                NULL,
                                WS_CHILD | WS_VISIBLE | WS_HSCROLL |
                                    WS_VSCROLL | ES_LEFT | ES_MULTILINE |
                                    ES_AUTOHSCROLL | ES_AUTOVSCROLL | ES_MULTILINE|ES_USER_PRESENT,
                                0, 0, 0, 0, // Let the WM_SIZE messge below take care of the size
                                hwnd,
                                0,
                                hInst,
                                NULL);


then to display on window I used

C++
case WM_PAINT:
case WM_PAINT:
              PAINTSTRUCT ps;
SendMessage(hwnd, WM_SETTEXT, 100, (LPARAM) e1[m].lpstring1);
                TextOut (hDC,
                     10,
                     10,
                     // Text to print
                     (LPSTR)"hello coders",
                     10);
            EndPaint (hwnd, &ps);


I think it is enough to answer.
I think there should be something change in the third argument in the create Window. Is it?

What I have tried:

I actually tried many changes to program for edit control but still not lucky.
Now I have No where to go.
Posted
Updated 9-Apr-16 9:39am
v2
Comments
Richard MacCutchan 9-Apr-16 11:00am    
Nor do we, since you have not shown any of your code or explained where the problem lies.
Suryakant Turing 9-Apr-16 11:28am    
The code for creating a Edit control is here.

case WM_CREATE:

hWndEdit=CreateWindow(_T("EDIT"), // We are creating an Edit control
NULL,
WS_CHILD | WS_VISIBLE | WS_HSCROLL |
WS_VSCROLL | ES_LEFT | ES_MULTILINE |
ES_AUTOHSCROLL | ES_AUTOVSCROLL | ES_MULTILINE|ES_USER_PRESENT,
0, 0, 0, 0, // Let the WM_SIZE messge below take care of the size
hwnd,
0,
hInst,
NULL);

then to display on window I used

case WM_PAINT:
case WM_PAINT:
PAINTSTRUCT ps;
SendMessage(hwnd, WM_SETTEXT, 100, (LPARAM) e1[m].lpstring1);
TextOut (hDC,
10,
10,
// Text to print
(LPSTR)"hello coders",
10);
EndPaint (hwnd, &ps);

I think it is enough to answer.
I think there should be something change in the third argument in the create Window. Is it?
enhzflep 9-Apr-16 11:43am    
What you're interested in doing still isn't clear. I've read what you've said and would get a better idea of what you're asking if it were to phrased a different way.

Also, the control used on the 'Services' tab of the Task Manager is known as a list-view - it's the same one used by Explorer to display folders as lists,icons or details. It most certainly is not a Edit control.

See more here: List View
and here: About List-View Controls1
Suryakant Turing 10-Apr-16 11:30am    
Yes man I want the same thing as u said, the list view. Can I use this in my code (on my window to display )through the link, so that I can copy from the list too.
enhzflep 10-Apr-16 18:26pm    
Yeah, that's a control that's available to you.
You'll also have to look into using the ClipBoard. If you just want to copy text, it's just a matter of handling clicks on the listview control and then getting a copy of the text at the point of clicking (or from the current selection) before copying the text to the clipboard. You can also copy more detailed information, like the ability to copy formatted text or pictures or sound between windows programs. To do that, you'll have to define your own clipboard format and also have a program that can consume data from the clipboard in this format.

From memory, you'll also have to write a some code to detect and handle either/both Ctrl-C to copy the text. Perhaps you'd like to use a popup menu, like is normal when right-clicking stuff.

1 solution

Obviously, your own code is like a blackbox to you. It don't do what you expect, and you don't understand why.
What follow is not directly a solution to your problem, but a key that will help you to understand by yourself what is wrong.
The debugger is your friend. It will show you what your code is really doing.
Follow the execution, inspect variables and you will see that there is a point where it stop doing what you expect.
Mastering Debugging in Visual Studio 2010 - A Beginner's Guide[^]
Debugger - Wikipedia, the free encyclopedia[^]

Quote:
I actually tried many changes to program for edit control but still not lucky.

Random changes and getting lucky are bad habits. The debugger will show you what your code is doing, it is a first class lead to the problem and solution.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900