Jump to content

  • Log In with Google      Sign In   
  • Create Account

SteveHatcher

Member Since 27 Nov 2013
Offline Last Active Today, 12:22 AM

Posts I've Made

In Topic: Order of winapi functions at compile time and runtime, and message loop

16 December 2014 - 01:51 AM

...

 

Great, thanks for your very informative response. That table lookup was interesting too. I guess when I was learning console based C++ I was in control of absolutely everything which made me feel more comfortable with whats going on. But now delving into winapi there are all these functions firing off at random times, calling and doing things which I have NFI about. Like I resize the window... it fires of a WM_SIZE.. I had no idea about that until I found it was making text disappear. It probably fires off some other things too which I wont know unless I step through a debugger. So it seems just going through the msdn code examples is the best way to learn this winapi stuff.

 

 

uMsg = 36 -> WM_GETMINMAXINFO (addendum)

uMsg = 129 -> WM_NCCREATE

uMsg = 131 -> WM_NCCALCSIZE

uMsg = 1 -> WM_CREATE

uMsg = 24 -> WM_SHOWWINDOW

uMsg = 70 -> WM_WINDOWPOSCHANGING

uMsg = 70 -> WM_WINDOWPOSCHANGING

uMsg = 28 -> WM_ACTIVATEAPP

uMsg = 134 -> WM_NCACTIVATE

uMsg = 127 -> WM_GETICON

uMsg = 127 -> WM_GETICON

uMsg = 127 -> WM_GETICON

uMsg = 6 -> WM_ACTIVATE

uMsg = 641 -> WM_IME_SETCONTEXT

uMsg = 642 -> WM_IME_NOTIFY

uMsg = 7 -> WM_SETFOCUS

uMsg = 133 -> WM_NCPAINT

uMsg = 20 -> WM_ERASEBKGND

uMsg = 71 -> WM_WINDOWPOSCHANGED

uMsg = 5 -> WM_SIZE

uMsg = 3 -> WM_MOVE

 

As I said, most of the time you just want Windows to handle these for you.

 

 

I guess most of this is windows 'initializing' the window? Since it runs the same time every time I run the program, which is a minimum win32 example, I guess this is the barebones code which windows does to create the window. I had no idea it was messages which actually create the window.

 

Thanks again


In Topic: Question about win32 window templates

27 November 2014 - 09:02 AM

Thanks for the answer SmkViper. I still cant quite understand the purpose of these CRTP's, doing some reading now to figure it out.


In Topic: Text dissapearing when resizing or minimizing window.

20 November 2014 - 12:08 AM

Thanks guys,

 

I understand now why it is wiping. I have also a text input demo using this code:

 

http://msdn.microsoft.com/en-us/library/windows/desktop/ms646268%28v=vs.85%29.aspx

 

and it does not wipe the text on a resize. They both process input in quite different ways (I think the caret code is based on older C style code). But the caret code has more functionality such as processing a backspace, where as this new one does not. So I will try to adapt this new one with full functionality. It is very hard because there are very few examples of this stuff, just whats on the mdsn mainly... Thanks for all your help


In Topic: Text dissapearing when resizing or minimizing window.

18 November 2014 - 09:36 AM

 



Prototype, on 18 Nov 2014 - 4:09 PM, said:
You should do all your drawing inside the WM_PAINT handler, otherwise it will be overwritten when the client area is redrawn.
 
Hi, I have found a few other posts mention this too, but I am not sure how to implement it. How should I structure the code to work like this?


It's already there in your code: 'case WM_PAINT', which is the section called when the OS wants to draw part of your window. That's where you put your drawing commands.

 

 

Hi,

 

Is this not already happening as the TextOut() function in the WM_PAINT case as below? Thanks.

	case WM_PAINT:
		// Draw all the characters in the buffer, line by line. 

		hdc = BeginPaint(hwnd, &ps);

		SelectObject(hdc,
			GetStockObject(SYSTEM_FIXED_FONT));

		for (y = 0; y < nWindowCharsY; y++)
			TextOut(hdc, 0, y * nCharY, &TEXTMATRIX(0, y),
			nWindowCharsX);

		EndPaint(hwnd, &ps);

In Topic: Text dissapearing when resizing or minimizing window.

18 November 2014 - 09:14 AM

In WndProc you have a switch(msg), one possible value for msg is "WM_SIZE", which is fired when the window is resized...

 

Hi, I think I understand, and commented out those 2 lines of code, but the text still disappears. Thanks

 

 

You should do all your drawing inside the WM_PAINT handler, otherwise it will be overwritten when the client area is redrawn.

 

Hi, I have found a few other posts mention this too, but I am not sure how to implement it. How should I structure the code to work like this?

 

Thanks


PARTNERS