<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[[Warning] passing NULL used for non-pointer converting 1 of &#96;HWND__* CreateWindowExA...]]></title><description><![CDATA[<p>Ich glaub', ich mach dazu mal direkt einen neuen topic auf.</p>
<p>Ich habe folgenden code, wo ein edit control<br />
ins hauptfenster gesetzt wird.<br />
wird das fenster gestreckt/gezerrt, soll das edit control von der breite und<br />
Größe her mitwachsen</p>
<p>Hier mein source</p>
<p><strong>main.cpp</strong></p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;

LPCSTR MainClassName = &quot;Texteditor&quot;;

// Zum Empfangen und Auswerten der messages
LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam);

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
{
	// Generelle Fensterstruktur registrieren
	WNDCLASSEX wc;
	wc.cbSize = sizeof(WNDCLASSEX);
	wc.style = 0;
	wc.lpfnWndProc = WndProc;
	wc.cbClsExtra = 0;
	wc.cbWndExtra = 0;
	wc.hInstance = hInstance;
	wc.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(0));
	wc.hCursor = LoadCursor(NULL, IDC_ARROW);
	wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
	wc.lpszMenuName = MAKEINTRESOURCE(1);
	wc.lpszClassName = MainClassName;
	wc.hIconSm = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(0), IMAGE_ICON, 16, 16, 0);

	if(!RegisterClassEx(&amp;wc))
	{
		MessageBox(NULL, &quot;Konnte das Hauptfenster nicht registrieren!&quot;, &quot;Fehler!&quot;, MB_ICONEXCLAMATION | MB_OK);
		return 0;
	}

	// Fenster erstellen
	HWND hWnd = CreateWindowEx(
		WS_EX_CLIENTEDGE,
		MainClassName,
		&quot;Texteditor&quot;,
		WS_OVERLAPPEDWINDOW | WS_VSCROLL | WS_HSCROLL,
		CW_USEDEFAULT, CW_USEDEFAULT, 400, 300,
		NULL,
		NULL,
		hInstance,
		NULL
	);

	// Textbox ins Fenster setzen
	HWND hEdit = CreateWindowEx(
		NULL,
		&quot;EDIT&quot;,
		&quot;Gib was ein&quot;,
		WS_CHILD | WS_VISIBLE | ES_MULTILINE | ES_AUTOHSCROLL | ES_AUTOVSCROLL,
		3, 3, 400, 300,
		hWnd,
		NULL,
		NULL,
		NULL
	);

	// Fenster anzeigen
	ShowWindow(hWnd, iCmdShow);

	// Auf Messages reagieren
	MSG wmsg;
	while( GetMessage(&amp;wmsg, NULL, 0, 0) )
	{
		TranslateMessage(&amp;wmsg);
		DispatchMessage(&amp;wmsg);
	}

	return wmsg.wParam;
}

LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
{
	char string[255];

	switch (iMsg)
	{
		case WM_SIZE:
			HWND hEdit = GetTopWindow(hWnd, GW_CHILD | GW_HWNDLAST);
			MoveWindow(hEdit, 3, 3, wParam, lParam, true);
		break;
		case WM_CLOSE:
			DestroyWindow(hWnd);
		break;
		case WM_DESTROY:
			PostQuitMessage(0);
			return 0;
		case WM_COMMAND:
			switch(LOWORD(wParam))
			{
				case 11:
					LoadString(GetModuleHandle(NULL), 21, string, sizeof(string));
					MessageBox(hWnd, string, &quot;Öffnen&quot;, MB_ICONINFORMATION);
				break;
				case 12:
					LoadString(GetModuleHandle(NULL), 22, string, sizeof(string));
					MessageBox(hWnd, string, &quot;Speichern&quot;, MB_ICONINFORMATION);
				break;
				case 13:
					DestroyWindow(hWnd);
				break;
			}
		break;
	}

	// An Windows weitergeben und dessen Antwort als Rückgabewert zurück
	return DefWindowProc(hWnd, iMsg, wParam, lParam);
}
</code></pre>
<p><strong>Projekt1_private.rc</strong></p>
<pre><code class="language-cpp">//Ressourcen-Skriptedatei *.rc

#include &lt;windows.h&gt;

/////////////////////////////////////////////////////////////////
//
//Icon
//
0	ICON	&quot;goofy.ico&quot;

/////////////////////////////////////////////////////////////////
//
// Menü
//

1 MENU
BEGIN
	POPUP &quot;Datei&quot;
	BEGIN
		MENUITEM &quot;Öffnen&quot;,		11
		MENUITEM &quot;Speichern&quot;,	12
		MENUITEM &quot;Beenden&quot;,		13
	END
END

/////////////////////////////////////////////////////////////////
//
//Stringtabelle
//
STRINGTABLE
BEGIN
	21,	&quot;Funktioniert noch nicht!&quot;
	22,	&quot;Funktioniert noch nicht!&quot;
END
</code></pre>
<p>Hier der compile error</p>
<pre><code>[Warning] passing NULL used for non-pointer converting 1 of `HWND__* CreateWindowExA(DWORD, const CHAR*, const CHAR*, DWORD, int, int, int, int, HWND__*, HMENU__*, HINSTANCE__*, void*)'
</code></pre>
<p>Mit</p>
<pre><code class="language-cpp">HWND hEdit = GetTopWindow(hWnd, GW_CHILD | GW_HWNDLAST);
</code></pre>
<p>versuche ich ein handle zum edit control abzurufen.<br />
Aber es kommt durch diese Anweisung zu einem compile error<br />
in Zeile 55, wobei sie damit ja eigentlich nichts zutun hat.</p>
<p>Kommentiere ich das ganze aus</p>
<pre><code class="language-cpp">case WM_SIZE:
			//HWND hEdit = GetTopWindow(hWnd, GW_CHILD | GW_HWNDLAST);
			//MoveWindow(hEdit, 3, 3, wParam, lParam, true);
		break;
</code></pre>
<p>Lässt es sich compilieren. Nur brauche ich doch aber die Skallierung...<br />
Was mache ich falsch?</p>
<p>// edit<br />
Jetzt habe ich versucht, das handle zum edit control global zu definieren</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;

LPCSTR MainClassName = &quot;Texteditor&quot;;

HWND hEdit;

// Zum Empfangen und Auswerten der messages
LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam);

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
{
	// Generelle Fensterstruktur registrieren
	WNDCLASSEX wc;
	wc.cbSize = sizeof(WNDCLASSEX);
	wc.style = 0;
	wc.lpfnWndProc = WndProc;
	wc.cbClsExtra = 0;
	wc.cbWndExtra = 0;
	wc.hInstance = hInstance;
	wc.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(0));
	wc.hCursor = LoadCursor(NULL, IDC_ARROW);
	wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
	wc.lpszMenuName = MAKEINTRESOURCE(1);
	wc.lpszClassName = MainClassName;
	wc.hIconSm = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(0), IMAGE_ICON, 16, 16, 0);

	if(!RegisterClassEx(&amp;wc))
	{
		MessageBox(NULL, &quot;Konnte das Hauptfenster nicht registrieren!&quot;, &quot;Fehler!&quot;, MB_ICONEXCLAMATION | MB_OK);
		return 0;
	}

	// Fenster erstellen
	HWND hWnd = CreateWindowEx(
		WS_EX_CLIENTEDGE,
		MainClassName,
		&quot;Texteditor&quot;,
		WS_OVERLAPPEDWINDOW | WS_VSCROLL | WS_HSCROLL,
		CW_USEDEFAULT, CW_USEDEFAULT, 400, 300,
		NULL,
		NULL,
		hInstance,
		NULL
	);

	// Textbox ins Fenster setzen
	hEdit = CreateWindowEx(
		NULL,
		&quot;EDIT&quot;,
		&quot;Gib was ein&quot;,
		WS_CHILD | WS_VISIBLE | ES_MULTILINE | ES_AUTOHSCROLL | ES_AUTOVSCROLL,
		0, 0, 400, 300,
		hWnd,
		NULL,
		NULL,
		NULL
	);

	// Fenster anzeigen
	ShowWindow(hWnd, iCmdShow);

	// Auf Messages reagieren
	MSG wmsg;
	while( GetMessage(&amp;wmsg, NULL, 0, 0) )
	{
		TranslateMessage(&amp;wmsg);
		DispatchMessage(&amp;wmsg);
	}

	return wmsg.wParam;
}

LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
{
	char string[255];

	switch (iMsg)
	{
		case WM_SIZE:
			MoveWindow(hEdit, 0, 0, wParam, lParam, true);
		break;
		case WM_CLOSE:
			DestroyWindow(hWnd);
		break;
		case WM_DESTROY:
			PostQuitMessage(0);
			return 0;
		case WM_COMMAND:
			switch(LOWORD(wParam))
			{
				case 11:
					LoadString(GetModuleHandle(NULL), 21, string, sizeof(string));
					MessageBox(hWnd, string, &quot;Öffnen&quot;, MB_ICONINFORMATION);
				break;
				case 12:
					LoadString(GetModuleHandle(NULL), 22, string, sizeof(string));
					MessageBox(hWnd, string, &quot;Speichern&quot;, MB_ICONINFORMATION);
				break;
				case 13:
					DestroyWindow(hWnd);
				break;
			}
		break;
	}

	// An Windows weitergeben und dessen Antwort als Rückgabewert zurück
	return DefWindowProc(hWnd, iMsg, wParam, lParam);
}
</code></pre>
<p>Es compiliert, stockt aber wie sau.<br />
Das edit control ist auch nicht zu sehen.</p>
<p>Jetzt habe ich schon recharchiert und recharchier, probier und probiert.<br />
Es muss doch wohl möglich sein, ein mehrzeiliges Eingabefeld als child<br />
des Hauptfensters zu skalieren!? Und woran liegt dieser VERF!xX73<br />
compile error!!!!!!!!????ßßß <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f621.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--pouting_face"
      title=":rage:"
      alt="😡"
    /> <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f621.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--pouting_face"
      title=":rage:"
      alt="😡"
    /> <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f621.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--pouting_face"
      title=":rage:"
      alt="😡"
    /></p>
<p>// edit 2<br />
Habe jetzt auch versucht, das edit control als Hauptfenster zu nehmen<br />
und das vorherige Hauptfenster zu entfernen.</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;

LPCSTR MainClassName = &quot;Texteditor&quot;;

// Zum Empfangen und Auswerten der messages
LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam);

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
{
	// Generelle Fensterstruktur registrieren
	WNDCLASSEX wc;
	wc.cbSize = sizeof(WNDCLASSEX);
	wc.style = 0;
	wc.lpfnWndProc = WndProc;
	wc.cbClsExtra = 0;
	wc.cbWndExtra = 0;
	wc.hInstance = hInstance;
	wc.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(0));
	wc.hCursor = LoadCursor(NULL, IDC_ARROW);
	wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
	wc.lpszMenuName = MAKEINTRESOURCE(1);
	wc.lpszClassName = MainClassName;
	wc.hIconSm = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(0), IMAGE_ICON, 16, 16, 0);

	if(!RegisterClassEx(&amp;wc))
	{
		MessageBox(NULL, &quot;Konnte das Hauptfenster nicht registrieren!&quot;, &quot;Fehler!&quot;, MB_ICONEXCLAMATION | MB_OK);
		return 0;
	}

	// Edit-Fenster erstellen
	HWND hWnd = CreateWindowEx(
		WS_EX_CLIENTEDGE | WS_EX_APPWINDOW,
		&quot;EDIT&quot;,
		&quot;Texteditor&quot;,
		WS_OVERLAPPEDWINDOW | ES_MULTILINE | WS_VSCROLL | WS_HSCROLL | ES_AUTOHSCROLL | ES_AUTOVSCROLL,
		CW_USEDEFAULT, CW_USEDEFAULT, 400, 300,
		NULL,
		NULL,
		hInstance,
		NULL
	);

	// Fenster anzeigen
	ShowWindow(hWnd, iCmdShow);

	// Auf Messages reagieren
	MSG wmsg;
	while( GetMessage(&amp;wmsg, NULL, 0, 0) )
	{
		TranslateMessage(&amp;wmsg);
		DispatchMessage(&amp;wmsg);
	}

	return wmsg.wParam;
}

LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
{
	char string[255];

	switch (iMsg)
	{
		case WM_CLOSE:
			// Problemchen
			MessageBox(hWnd, &quot;Kommt nie!&quot;, &quot;Problem!&quot;, MB_OK);

			DestroyWindow(hWnd);
		break;
		case WM_DESTROY:
			PostQuitMessage(0);
			return 0;
		case WM_COMMAND:
			switch(LOWORD(wParam))
			{
				case 11:
					LoadString(GetModuleHandle(NULL), 21, string, sizeof(string));
					MessageBox(hWnd, string, &quot;Öffnen&quot;, MB_ICONINFORMATION);
				break;
				case 12:
					LoadString(GetModuleHandle(NULL), 22, string, sizeof(string));
					MessageBox(hWnd, string, &quot;Speichern&quot;, MB_ICONINFORMATION);
				break;
				case 13:
					DestroyWindow(hWnd);
				break;
			}
		break;
	}

	// An Windows weitergeben und dessen Antwort als Rückgabewert zurück
	return DefWindowProc(hWnd, iMsg, wParam, lParam);
}
</code></pre>
<p>Mehrzeiliges Eingabefeld mit Skrollbalken al Hauptfenster mit<br />
clientedge flag und der titleleiste halt.</p>
<p>Problem: Icons werden aus der resource scheinbar nicht beachtet<br />
und die WM_CLOSE message tritt nicht ein...<br />
Hilfe, ich verzweifle langsam!</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/197869/warning-passing-null-used-for-non-pointer-converting-1-of-hwnd__-createwindowexa</link><generator>RSS for Node</generator><lastBuildDate>Fri, 01 May 2026 14:52:32 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/197869.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 15 Nov 2007 15:55:17 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to [Warning] passing NULL used for non-pointer converting 1 of &#96;HWND__* CreateWindowExA... on Thu, 15 Nov 2007 18:40:42 GMT]]></title><description><![CDATA[<p>Ich glaub', ich mach dazu mal direkt einen neuen topic auf.</p>
<p>Ich habe folgenden code, wo ein edit control<br />
ins hauptfenster gesetzt wird.<br />
wird das fenster gestreckt/gezerrt, soll das edit control von der breite und<br />
Größe her mitwachsen</p>
<p>Hier mein source</p>
<p><strong>main.cpp</strong></p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;

LPCSTR MainClassName = &quot;Texteditor&quot;;

// Zum Empfangen und Auswerten der messages
LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam);

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
{
	// Generelle Fensterstruktur registrieren
	WNDCLASSEX wc;
	wc.cbSize = sizeof(WNDCLASSEX);
	wc.style = 0;
	wc.lpfnWndProc = WndProc;
	wc.cbClsExtra = 0;
	wc.cbWndExtra = 0;
	wc.hInstance = hInstance;
	wc.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(0));
	wc.hCursor = LoadCursor(NULL, IDC_ARROW);
	wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
	wc.lpszMenuName = MAKEINTRESOURCE(1);
	wc.lpszClassName = MainClassName;
	wc.hIconSm = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(0), IMAGE_ICON, 16, 16, 0);

	if(!RegisterClassEx(&amp;wc))
	{
		MessageBox(NULL, &quot;Konnte das Hauptfenster nicht registrieren!&quot;, &quot;Fehler!&quot;, MB_ICONEXCLAMATION | MB_OK);
		return 0;
	}

	// Fenster erstellen
	HWND hWnd = CreateWindowEx(
		WS_EX_CLIENTEDGE,
		MainClassName,
		&quot;Texteditor&quot;,
		WS_OVERLAPPEDWINDOW | WS_VSCROLL | WS_HSCROLL,
		CW_USEDEFAULT, CW_USEDEFAULT, 400, 300,
		NULL,
		NULL,
		hInstance,
		NULL
	);

	// Textbox ins Fenster setzen
	HWND hEdit = CreateWindowEx(
		NULL,
		&quot;EDIT&quot;,
		&quot;Gib was ein&quot;,
		WS_CHILD | WS_VISIBLE | ES_MULTILINE | ES_AUTOHSCROLL | ES_AUTOVSCROLL,
		3, 3, 400, 300,
		hWnd,
		NULL,
		NULL,
		NULL
	);

	// Fenster anzeigen
	ShowWindow(hWnd, iCmdShow);

	// Auf Messages reagieren
	MSG wmsg;
	while( GetMessage(&amp;wmsg, NULL, 0, 0) )
	{
		TranslateMessage(&amp;wmsg);
		DispatchMessage(&amp;wmsg);
	}

	return wmsg.wParam;
}

LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
{
	char string[255];

	switch (iMsg)
	{
		case WM_SIZE:
			HWND hEdit = GetTopWindow(hWnd, GW_CHILD | GW_HWNDLAST);
			MoveWindow(hEdit, 3, 3, wParam, lParam, true);
		break;
		case WM_CLOSE:
			DestroyWindow(hWnd);
		break;
		case WM_DESTROY:
			PostQuitMessage(0);
			return 0;
		case WM_COMMAND:
			switch(LOWORD(wParam))
			{
				case 11:
					LoadString(GetModuleHandle(NULL), 21, string, sizeof(string));
					MessageBox(hWnd, string, &quot;Öffnen&quot;, MB_ICONINFORMATION);
				break;
				case 12:
					LoadString(GetModuleHandle(NULL), 22, string, sizeof(string));
					MessageBox(hWnd, string, &quot;Speichern&quot;, MB_ICONINFORMATION);
				break;
				case 13:
					DestroyWindow(hWnd);
				break;
			}
		break;
	}

	// An Windows weitergeben und dessen Antwort als Rückgabewert zurück
	return DefWindowProc(hWnd, iMsg, wParam, lParam);
}
</code></pre>
<p><strong>Projekt1_private.rc</strong></p>
<pre><code class="language-cpp">//Ressourcen-Skriptedatei *.rc

#include &lt;windows.h&gt;

/////////////////////////////////////////////////////////////////
//
//Icon
//
0	ICON	&quot;goofy.ico&quot;

/////////////////////////////////////////////////////////////////
//
// Menü
//

1 MENU
BEGIN
	POPUP &quot;Datei&quot;
	BEGIN
		MENUITEM &quot;Öffnen&quot;,		11
		MENUITEM &quot;Speichern&quot;,	12
		MENUITEM &quot;Beenden&quot;,		13
	END
END

/////////////////////////////////////////////////////////////////
//
//Stringtabelle
//
STRINGTABLE
BEGIN
	21,	&quot;Funktioniert noch nicht!&quot;
	22,	&quot;Funktioniert noch nicht!&quot;
END
</code></pre>
<p>Hier der compile error</p>
<pre><code>[Warning] passing NULL used for non-pointer converting 1 of `HWND__* CreateWindowExA(DWORD, const CHAR*, const CHAR*, DWORD, int, int, int, int, HWND__*, HMENU__*, HINSTANCE__*, void*)'
</code></pre>
<p>Mit</p>
<pre><code class="language-cpp">HWND hEdit = GetTopWindow(hWnd, GW_CHILD | GW_HWNDLAST);
</code></pre>
<p>versuche ich ein handle zum edit control abzurufen.<br />
Aber es kommt durch diese Anweisung zu einem compile error<br />
in Zeile 55, wobei sie damit ja eigentlich nichts zutun hat.</p>
<p>Kommentiere ich das ganze aus</p>
<pre><code class="language-cpp">case WM_SIZE:
			//HWND hEdit = GetTopWindow(hWnd, GW_CHILD | GW_HWNDLAST);
			//MoveWindow(hEdit, 3, 3, wParam, lParam, true);
		break;
</code></pre>
<p>Lässt es sich compilieren. Nur brauche ich doch aber die Skallierung...<br />
Was mache ich falsch?</p>
<p>// edit<br />
Jetzt habe ich versucht, das handle zum edit control global zu definieren</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;

LPCSTR MainClassName = &quot;Texteditor&quot;;

HWND hEdit;

// Zum Empfangen und Auswerten der messages
LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam);

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
{
	// Generelle Fensterstruktur registrieren
	WNDCLASSEX wc;
	wc.cbSize = sizeof(WNDCLASSEX);
	wc.style = 0;
	wc.lpfnWndProc = WndProc;
	wc.cbClsExtra = 0;
	wc.cbWndExtra = 0;
	wc.hInstance = hInstance;
	wc.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(0));
	wc.hCursor = LoadCursor(NULL, IDC_ARROW);
	wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
	wc.lpszMenuName = MAKEINTRESOURCE(1);
	wc.lpszClassName = MainClassName;
	wc.hIconSm = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(0), IMAGE_ICON, 16, 16, 0);

	if(!RegisterClassEx(&amp;wc))
	{
		MessageBox(NULL, &quot;Konnte das Hauptfenster nicht registrieren!&quot;, &quot;Fehler!&quot;, MB_ICONEXCLAMATION | MB_OK);
		return 0;
	}

	// Fenster erstellen
	HWND hWnd = CreateWindowEx(
		WS_EX_CLIENTEDGE,
		MainClassName,
		&quot;Texteditor&quot;,
		WS_OVERLAPPEDWINDOW | WS_VSCROLL | WS_HSCROLL,
		CW_USEDEFAULT, CW_USEDEFAULT, 400, 300,
		NULL,
		NULL,
		hInstance,
		NULL
	);

	// Textbox ins Fenster setzen
	hEdit = CreateWindowEx(
		NULL,
		&quot;EDIT&quot;,
		&quot;Gib was ein&quot;,
		WS_CHILD | WS_VISIBLE | ES_MULTILINE | ES_AUTOHSCROLL | ES_AUTOVSCROLL,
		0, 0, 400, 300,
		hWnd,
		NULL,
		NULL,
		NULL
	);

	// Fenster anzeigen
	ShowWindow(hWnd, iCmdShow);

	// Auf Messages reagieren
	MSG wmsg;
	while( GetMessage(&amp;wmsg, NULL, 0, 0) )
	{
		TranslateMessage(&amp;wmsg);
		DispatchMessage(&amp;wmsg);
	}

	return wmsg.wParam;
}

LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
{
	char string[255];

	switch (iMsg)
	{
		case WM_SIZE:
			MoveWindow(hEdit, 0, 0, wParam, lParam, true);
		break;
		case WM_CLOSE:
			DestroyWindow(hWnd);
		break;
		case WM_DESTROY:
			PostQuitMessage(0);
			return 0;
		case WM_COMMAND:
			switch(LOWORD(wParam))
			{
				case 11:
					LoadString(GetModuleHandle(NULL), 21, string, sizeof(string));
					MessageBox(hWnd, string, &quot;Öffnen&quot;, MB_ICONINFORMATION);
				break;
				case 12:
					LoadString(GetModuleHandle(NULL), 22, string, sizeof(string));
					MessageBox(hWnd, string, &quot;Speichern&quot;, MB_ICONINFORMATION);
				break;
				case 13:
					DestroyWindow(hWnd);
				break;
			}
		break;
	}

	// An Windows weitergeben und dessen Antwort als Rückgabewert zurück
	return DefWindowProc(hWnd, iMsg, wParam, lParam);
}
</code></pre>
<p>Es compiliert, stockt aber wie sau.<br />
Das edit control ist auch nicht zu sehen.</p>
<p>Jetzt habe ich schon recharchiert und recharchier, probier und probiert.<br />
Es muss doch wohl möglich sein, ein mehrzeiliges Eingabefeld als child<br />
des Hauptfensters zu skalieren!? Und woran liegt dieser VERF!xX73<br />
compile error!!!!!!!!????ßßß <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f621.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--pouting_face"
      title=":rage:"
      alt="😡"
    /> <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f621.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--pouting_face"
      title=":rage:"
      alt="😡"
    /> <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f621.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--pouting_face"
      title=":rage:"
      alt="😡"
    /></p>
<p>// edit 2<br />
Habe jetzt auch versucht, das edit control als Hauptfenster zu nehmen<br />
und das vorherige Hauptfenster zu entfernen.</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;

LPCSTR MainClassName = &quot;Texteditor&quot;;

// Zum Empfangen und Auswerten der messages
LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam);

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
{
	// Generelle Fensterstruktur registrieren
	WNDCLASSEX wc;
	wc.cbSize = sizeof(WNDCLASSEX);
	wc.style = 0;
	wc.lpfnWndProc = WndProc;
	wc.cbClsExtra = 0;
	wc.cbWndExtra = 0;
	wc.hInstance = hInstance;
	wc.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(0));
	wc.hCursor = LoadCursor(NULL, IDC_ARROW);
	wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
	wc.lpszMenuName = MAKEINTRESOURCE(1);
	wc.lpszClassName = MainClassName;
	wc.hIconSm = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(0), IMAGE_ICON, 16, 16, 0);

	if(!RegisterClassEx(&amp;wc))
	{
		MessageBox(NULL, &quot;Konnte das Hauptfenster nicht registrieren!&quot;, &quot;Fehler!&quot;, MB_ICONEXCLAMATION | MB_OK);
		return 0;
	}

	// Edit-Fenster erstellen
	HWND hWnd = CreateWindowEx(
		WS_EX_CLIENTEDGE | WS_EX_APPWINDOW,
		&quot;EDIT&quot;,
		&quot;Texteditor&quot;,
		WS_OVERLAPPEDWINDOW | ES_MULTILINE | WS_VSCROLL | WS_HSCROLL | ES_AUTOHSCROLL | ES_AUTOVSCROLL,
		CW_USEDEFAULT, CW_USEDEFAULT, 400, 300,
		NULL,
		NULL,
		hInstance,
		NULL
	);

	// Fenster anzeigen
	ShowWindow(hWnd, iCmdShow);

	// Auf Messages reagieren
	MSG wmsg;
	while( GetMessage(&amp;wmsg, NULL, 0, 0) )
	{
		TranslateMessage(&amp;wmsg);
		DispatchMessage(&amp;wmsg);
	}

	return wmsg.wParam;
}

LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
{
	char string[255];

	switch (iMsg)
	{
		case WM_CLOSE:
			// Problemchen
			MessageBox(hWnd, &quot;Kommt nie!&quot;, &quot;Problem!&quot;, MB_OK);

			DestroyWindow(hWnd);
		break;
		case WM_DESTROY:
			PostQuitMessage(0);
			return 0;
		case WM_COMMAND:
			switch(LOWORD(wParam))
			{
				case 11:
					LoadString(GetModuleHandle(NULL), 21, string, sizeof(string));
					MessageBox(hWnd, string, &quot;Öffnen&quot;, MB_ICONINFORMATION);
				break;
				case 12:
					LoadString(GetModuleHandle(NULL), 22, string, sizeof(string));
					MessageBox(hWnd, string, &quot;Speichern&quot;, MB_ICONINFORMATION);
				break;
				case 13:
					DestroyWindow(hWnd);
				break;
			}
		break;
	}

	// An Windows weitergeben und dessen Antwort als Rückgabewert zurück
	return DefWindowProc(hWnd, iMsg, wParam, lParam);
}
</code></pre>
<p>Mehrzeiliges Eingabefeld mit Skrollbalken al Hauptfenster mit<br />
clientedge flag und der titleleiste halt.</p>
<p>Problem: Icons werden aus der resource scheinbar nicht beachtet<br />
und die WM_CLOSE message tritt nicht ein...<br />
Hilfe, ich verzweifle langsam!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1403798</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1403798</guid><dc:creator><![CDATA[sjBlack]]></dc:creator><pubDate>Thu, 15 Nov 2007 18:40:42 GMT</pubDate></item><item><title><![CDATA[Reply to [Warning] passing NULL used for non-pointer converting 1 of &#96;HWND__* CreateWindowExA... on Thu, 15 Nov 2007 22:23:38 GMT]]></title><description><![CDATA[<p>Ich hab zwar jetzt nicht alles durchgelesen, aber wenn du eine Nachricht behandelst solltest du DefWindowProc() eigentlich nicht mehr aufrufen.</p>
<p>Bei deiner zweiten Variante wundert mich nicht das WM_CLOSE nicht kommt - Das Edit-Control hat seine eigene WindowProc und wird deine daher nicht benutzen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1404035</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1404035</guid><dc:creator><![CDATA[geeky]]></dc:creator><pubDate>Thu, 15 Nov 2007 22:23:38 GMT</pubDate></item><item><title><![CDATA[Reply to [Warning] passing NULL used for non-pointer converting 1 of &#96;HWND__* CreateWindowExA... on Fri, 16 Nov 2007 15:30:54 GMT]]></title><description><![CDATA[<p>Wird</p>
<pre><code class="language-cpp">DestroyWindow(hWnd);
</code></pre>
<p>in WinDef() etwa schon ausgeführt oder was meinst du?<br />
Die MessageBox ist ja nur zum Verdeutlichen, dass sie nicht aufgerufen wird.</p>
<p>Ich habe der Fensterklasse doch auch hier wieder WndProc<br />
als Callback-Funktion zugewiesen. Ich habe im 2ten<br />
source doch nur die edit box als Hauptfenstr genommen,</p>
<p>geeky schrieb:</p>
<blockquote>
<p>Das Edit-Control hat seine eigene WindowProc und wird deine daher nicht benutzen.</p>
</blockquote>
<p>Also kann ich das Edit control nicht als Hauptfenster nehmen,<br />
sondenr es muss ein Dialog sein. Ich bekomm die Skallierung<br />
ja nichtmal compiliert!</p>
<p>// edit<br />
Das vorher compilierte Prog lief noch im Hintergrund... (acces denied)</p>
<p>jetzt compiliert dev c++ das hier schonmal</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;

LPCSTR MainClassName = &quot;Texteditor&quot;;

// Zum Empfangen und Auswerten der messages
LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam);

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
{
    // Generelle Fensterstruktur registrieren
    WNDCLASSEX wc;
    wc.cbSize = sizeof(WNDCLASSEX);
    wc.style = 0;
    wc.lpfnWndProc = WndProc;
    wc.cbClsExtra = 0;
    wc.cbWndExtra = 0;
    wc.hInstance = hInstance;
    wc.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(0));
    wc.hCursor = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
    wc.lpszMenuName = MAKEINTRESOURCE(1);
    wc.lpszClassName = MainClassName;
    wc.hIconSm = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(0), IMAGE_ICON, 16, 16, 0);

    if(!RegisterClassEx(&amp;wc))
    {
        MessageBox(NULL, &quot;Konnte das Hauptfenster nicht registrieren!&quot;, &quot;Fehler!&quot;, MB_ICONEXCLAMATION | MB_OK);
        return 0;
    }

    // Fenster erstellen
    HWND hWnd = CreateWindowEx(
        WS_EX_OVERLAPPEDWINDOW,
        MainClassName,
        &quot;Titletext&quot;,
        WS_OVERLAPPEDWINDOW | WS_VSCROLL | WS_HSCROLL,
        CW_USEDEFAULT, CW_USEDEFAULT, 400, 300,
        NULL,
        NULL,
        hInstance,
        NULL
    );

    // Textbox ins Fenster setzen
    HWND hEdit = CreateWindowEx(
        NULL,
        &quot;EDIT&quot;,
        &quot;Gib was ein&quot;,
        WS_CHILD | WS_VISIBLE | ES_MULTILINE | ES_AUTOHSCROLL | ES_AUTOVSCROLL,
        0, 0, 400, 300,
        hWnd,
        NULL,
        NULL,
        NULL
    );

    // Fenster anzeigen
    ShowWindow(hWnd, iCmdShow);

    // Auf Messages reagieren
    MSG wmsg;
    while( GetMessage(&amp;wmsg, NULL, 0, 0) )
    {
        TranslateMessage(&amp;wmsg);
        DispatchMessage(&amp;wmsg);
    }

    return wmsg.wParam;
}

HWND hEdit;

LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
{
    char string[255];

    switch (iMsg)
    {
		case WM_SIZE:
			MessageBox(NULL, &quot;noch siehst du das edit control&quot;, &quot;noch zu sehen&quot;, MB_OK);
			hEdit = GetTopWindow(hWnd);
			MoveWindow(hEdit, 0, 0, wParam, lParam, true);
			MessageBox(NULL, &quot;und weg ist es&quot;, &quot;jetzt nicht mehr&quot;, MB_OK);
        break;
        case WM_CLOSE:
            DestroyWindow(hWnd);
        break;
        case WM_DESTROY:
            PostQuitMessage(0);
            return 0;
        case WM_COMMAND:
            switch(LOWORD(wParam))
            {
                case 11:
                    LoadString(GetModuleHandle(NULL), 21, string, sizeof(string));
                    MessageBox(hWnd, string, &quot;Öffnen&quot;, MB_ICONINFORMATION);
                break;
                case 12:
                    LoadString(GetModuleHandle(NULL), 22, string, sizeof(string));
                    MessageBox(hWnd, string, &quot;Speichern&quot;, MB_ICONINFORMATION);
                break;
                case 13:
                    DestroyWindow(hWnd);
                break;
            }
        break;
    }

    // An Windows weitergeben und dessen Antwort als Rückgabewert zurück
    return DefWindowProc(hWnd, iMsg, wParam, lParam);
}
</code></pre>
<p>Aber wie man den letzten 2 MessageBoxes folgen kann, lässt MoveWindow<br />
das edit control verschinden. Anstatt die Größe anzupassen.<br />
Enthält wParam also doch nicht die neue Breite des Fensters oder<br />
woran liegt das?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1404367</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1404367</guid><dc:creator><![CDATA[sjBlack]]></dc:creator><pubDate>Fri, 16 Nov 2007 15:30:54 GMT</pubDate></item><item><title><![CDATA[Reply to [Warning] passing NULL used for non-pointer converting 1 of &#96;HWND__* CreateWindowExA... on Fri, 16 Nov 2007 17:37:41 GMT]]></title><description><![CDATA[<p>Laut msdn stehen in lParam sowohl Höhe als auch Breite!</p>
<pre><code class="language-cpp">MoveWindow(hEdit, 0, 0, LOWORD(lParam), HIWORD(lParam), true);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1404591</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1404591</guid><dc:creator><![CDATA[geeky]]></dc:creator><pubDate>Fri, 16 Nov 2007 17:37:41 GMT</pubDate></item><item><title><![CDATA[Reply to [Warning] passing NULL used for non-pointer converting 1 of &#96;HWND__* CreateWindowExA... on Fri, 16 Nov 2007 18:42:02 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">#include &lt;windows.h&gt;

LPCSTR MainClassName = &quot;Texteditor&quot;;

// Zum Empfangen und Auswerten der messages
LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam);

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
{
    // Generelle Fensterstruktur registrieren
    WNDCLASSEX wc;
    wc.cbSize = sizeof(WNDCLASSEX);
    wc.style = 0;
    wc.lpfnWndProc = WndProc;
    wc.cbClsExtra = 0;
    wc.cbWndExtra = 0;
    wc.hInstance = hInstance;
    wc.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(0));
    wc.hCursor = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
    wc.lpszMenuName = MAKEINTRESOURCE(1);
    wc.lpszClassName = MainClassName;
    wc.hIconSm = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(0), IMAGE_ICON, 16, 16, 0);

    if(!RegisterClassEx(&amp;wc))
    {
        MessageBox(NULL, &quot;Konnte das Hauptfenster nicht registrieren!&quot;, &quot;Fehler!&quot;, MB_ICONEXCLAMATION | MB_OK);
        return 0;
    }

    // Fenster erstellen
    HWND hWnd = CreateWindowEx(
        WS_EX_OVERLAPPEDWINDOW,
        MainClassName,
        &quot;Titletext&quot;,
        WS_OVERLAPPEDWINDOW | WS_VSCROLL | WS_HSCROLL,
        CW_USEDEFAULT, CW_USEDEFAULT, 400, 300,
        NULL,
        NULL,
        hInstance,
        NULL
    );

    // Textbox ins Fenster setzen
    HWND hEdit = CreateWindowEx(
        NULL,
        &quot;EDIT&quot;,
        &quot;Gib was ein&quot;,
        WS_CHILD | WS_VISIBLE | ES_MULTILINE | ES_AUTOHSCROLL | ES_AUTOVSCROLL,
        0, 0, 400, 300,
        hWnd,
        NULL,
        NULL,
        NULL
    );

    // Fenster anzeigen
    ShowWindow(hWnd, iCmdShow);

    // Auf Messages reagieren
    MSG wmsg;
    while( GetMessage(&amp;wmsg, NULL, 0, 0) )
    {
        TranslateMessage(&amp;wmsg);
        DispatchMessage(&amp;wmsg);
    }

    return wmsg.wParam;
}

HWND hEdit;

LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
{
    char string[255];

    switch (iMsg)
    {
		case WM_SIZE:
			MessageBox(NULL, &quot;noch siehst du das edit control&quot;, &quot;noch zu sehen&quot;, MB_OK);
			hEdit = GetTopWindow(hWnd);
			MoveWindow(hEdit, 0, 0, LOWORD(wParam), HIWORD(lParam), true);
			MessageBox(NULL, &quot;und weg ist es&quot;, &quot;jetzt nicht mehr&quot;, MB_OK);
        break;
        case WM_CLOSE:
            DestroyWindow(hWnd);
        break;
        case WM_DESTROY:
            PostQuitMessage(0);
            return 0;
        case WM_COMMAND:
            switch(LOWORD(wParam))
            {
                case 11:
                    LoadString(GetModuleHandle(NULL), 21, string, sizeof(string));
                    MessageBox(hWnd, string, &quot;Öffnen&quot;, MB_ICONINFORMATION);
                break;
                case 12:
                    LoadString(GetModuleHandle(NULL), 22, string, sizeof(string));
                    MessageBox(hWnd, string, &quot;Speichern&quot;, MB_ICONINFORMATION);
                break;
                case 13:
                    DestroyWindow(hWnd);
                break;
            }
        break;
    }

    // An Windows weitergeben und dessen Antwort als Rückgabewert zurück
    return DefWindowProc(hWnd, iMsg, wParam, lParam);
}
</code></pre>
<p>Selbes Problem. Verändert sich nichts.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1404620</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1404620</guid><dc:creator><![CDATA[sjBlack]]></dc:creator><pubDate>Fri, 16 Nov 2007 18:42:02 GMT</pubDate></item><item><title><![CDATA[Reply to [Warning] passing NULL used for non-pointer converting 1 of &#96;HWND__* CreateWindowExA... on Fri, 16 Nov 2007 18:56:29 GMT]]></title><description><![CDATA[<p>Guck nochmal was geeky als letztes gepostet hat.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1404629</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1404629</guid><dc:creator><![CDATA[LOWORD(lParam)]]></dc:creator><pubDate>Fri, 16 Nov 2007 18:56:29 GMT</pubDate></item><item><title><![CDATA[Reply to [Warning] passing NULL used for non-pointer converting 1 of &#96;HWND__* CreateWindowExA... on Fri, 16 Nov 2007 20:41:34 GMT]]></title><description><![CDATA[<p>Au mann! Die breite und Höhe wird als eine einzige Long übergeben!<br />
LOWORD() spaltet die long und gibt die WORD, die sich aus den<br />
linken bytes ergibt, während HIWORD() eine WORD aus den rechten<br />
bytes holt. So, wie er geantwortet hat, funktioniert es immerhin.</p>
<p>Anders kann ich es mir ja nicht erklären...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1404682</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1404682</guid><dc:creator><![CDATA[sjBlack]]></dc:creator><pubDate>Fri, 16 Nov 2007 20:41:34 GMT</pubDate></item></channel></rss>