944,162 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 4424
  • C++ RSS
Nov 11th, 2006
0

edit C++ window

Expand Post »
ok here is window
C++ Syntax (Toggle Plain Text)
  1. #include <windows.h>
  2.  
  3. /* Declare Windows procedure */
  4. LRESULT CALLBACK WindowProcedure(HWND, UINT, WPARAM, LPARAM);
  5. /* Make the class name into a global variable */
  6. char szClassName[ ] = "jan birsa";
  7. int WINAPI WinMain(HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nFunsterStil)
  8.  
  9. {
  10. HWND hwnd; /* This is the handle for our window */
  11. MSG messages; /* Here messages to the application are saved */
  12. WNDCLASSEX wincl; /* Data structure for the windowclass */
  13.  
  14. /* The Window structure */
  15. wincl.hInstance = hThisInstance;
  16. wincl.lpszClassName = szClassName;
  17. wincl.lpfnWndProc = WindowProcedure; /* This function is called by windows */
  18. wincl.style = CS_DBLCLKS; /* Catch double-clicks */
  19. wincl.cbSize = sizeof(WNDCLASSEX);
  20.  
  21. /* Use default icon and mouse-pointer */
  22. wincl.hIcon = LoadIcon(NULL, IDI_APPLICATION);
  23. wincl.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
  24. wincl.hCursor = LoadCursor(NULL, IDC_ARROW);
  25. wincl.lpszMenuName = NULL; /* No menu */
  26. wincl.cbClsExtra = 0; /* No extra bytes after the window class */
  27. wincl.cbWndExtra = 0; /* structure or the window instance */
  28. /* Use light-gray as the background of the window */
  29. wincl.hbrBackground = (HBRUSH) GetStockObject(LTGRAY_BRUSH);
  30.  
  31. /* Register the window class, if fail quit the program */
  32. if(!RegisterClassEx(&wincl)) return 0;
  33.  
  34. /* The class is registered, let's create the program*/
  35. hwnd = CreateWindowEx(
  36. 0, /* Extended possibilites for variation */
  37. szClassName, /* Classname */
  38. "jan birsa", /* Title Text */
  39. WS_OVERLAPPEDWINDOW, /* default window */
  40. CW_USEDEFAULT, /* Windows decides the position */
  41. CW_USEDEFAULT, /* where the window ends up on the screen */
  42. 700, /* The programs width */
  43. 500, /* and height in pixels */
  44. HWND_DESKTOP, /* The window is a child-window to desktop */
  45. NULL, /* No menu */
  46. hThisInstance, /* Program Instance handler */
  47. NULL /* No Window Creation data */
  48. );
  49.  
  50. /* Make the window visible on the screen */
  51. ShowWindow(hwnd, nFunsterStil);
  52. /* Run the message loop. It will run until GetMessage( ) returns 0 */
  53. while(GetMessage(&messages, NULL, 0, 0))
  54. {
  55.  
  56. /* Translate virtual-key messages into character messages */
  57. TranslateMessage(&messages);
  58. /* Send message to WindowProcedure */
  59. DispatchMessage(&messages);
  60. }
  61.  
  62. /* The program return-value is 0 - The value that PostQuitMessage( ) gave */
  63. return messages.wParam;
  64. }
  65.  
  66. /* This function is called by the Windows function DispatchMessage( ) */
  67. LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
  68. {
  69. switch (message) /* handle the messages */
  70. {
  71. case WM_DESTROY:
  72. PostQuitMessage(0); /* send a WM_QUIT to the message queue */
  73. break;
  74. default: /* for messages that we don't deal with */
  75. return DefWindowProc(hwnd, message, wParam, lParam);
  76. }
  77. return 0;
  78. }

but i want to insert some text in it......how to do that?
Similar Threads
Reputation Points: 27
Solved Threads: 2
Posting Whiz in Training
jan1024188 is offline Offline
254 posts
since Aug 2006
Nov 11th, 2006
0

Re: edit C++ window

Almost everything related to WinAPI can be found here:
http://www.winprog.org/tutorial/

Here you will find the answer to your question in the 9th chapter.

Hope it helped, bye.
Super Moderator
Featured Poster
Reputation Points: 3241
Solved Threads: 719
Failure as a human
~s.o.s~ is offline Offline
8,873 posts
since Jun 2006
Nov 11th, 2006
0

Re: edit C++ window

Click to Expand / Collapse  Quote originally posted by ~s.o.s~ ...
Almost everything related to WinAPI can be found here:
http://www.winprog.org/tutorial/

Here you will find the answer to your question in the 9th chapter.

Hope it helped, bye.

hey thanks for link....
Reputation Points: 27
Solved Threads: 2
Posting Whiz in Training
jan1024188 is offline Offline
254 posts
since Aug 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: If Else: Logic Jam?
Next Thread in C++ Forum Timeline: [Win32/C++] Listview question





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC