Waitrud Weber’s blog

things and reminders for memories

3d: WindowsAPI: Windows-make: How do we face memories problem: ASCII can't be casted to the LPSTR:

We cast LPSTR buffer  to LPWSTR and cannnot cast ASCII to LPSATR:

So, we may use wsprintf or like that.

 

f:id:Waitrud_Weber:20200530152241p:plain

---

 

.\wButton.cpp  Sat May 30 15:17:17 2020

 78 :
 79 :	Rectangle( hdc, rect.left, rect.top, rect.right, rect.bottom );
 80 ://	DrawText( hdc, (LPWSTR)( this->button_name ), -1, &rect, DT_NOCLIP);
 81 ://	qualified: DrawText( hdc, TEXT( "Const Character" ), -1, &rect, DT_NOCLIP);
 82 ://	DrawText( hdc, this->button_name, -1, &rect, DT_NOCLIP);
 83 :	DrawText( hdc, text(this->button_name), -1, &rect, DT_NOCLIP ) ; // x
 84 :
 85 :	//  LPWSTR -> wchar_t: 
 86 :	//	DrawText doesn't matter.
 87 :
 88 :	return 1;
 89 :}
 90 :
 91 :LPWSTR text(char* msg) {
 92 :	LPWSTR result = (LPWSTR)"default";
 93 :	LPSTR result_001[255];
 94 :
 95 :	// CHAR -> char
 96 :	result_001[0] = (LPSTR) 'm';
 97 :	result_001[1] = (LPSTR) '\0';
 98 :
 99 :	return (LPWSTR)result_001;
100 :}
101 :