edit C++ window

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Aug 2006
Posts: 254
Reputation: jan1024188 is an unknown quantity at this point 
Solved Threads: 2
jan1024188's Avatar
jan1024188 jan1024188 is offline Offline
Posting Whiz in Training

edit C++ window

 
0
  #1
Nov 11th, 2006
ok here is window
  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?
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 7,610
Reputation: ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of 
Solved Threads: 464
Super Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Failure as a human

Re: edit C++ window

 
0
  #2
Nov 11th, 2006
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.
I don't accept change; I don't deserve to live.
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 254
Reputation: jan1024188 is an unknown quantity at this point 
Solved Threads: 2
jan1024188's Avatar
jan1024188 jan1024188 is offline Offline
Posting Whiz in Training

Re: edit C++ window

 
0
  #3
Nov 11th, 2006
Originally Posted by ~s.o.s~ View Post
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....
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC