problem mit neuem edit fenster
-
hallo liebe api gemeinde,
ich möchte aus einem (in der tray-versenkten) programm ein neues edit-fenster erstellen.
das fenster poppt auch auf, ist aber "durchsichtig" und außerdem ist es keine edit-box.
wo liegt der fehler? wer kann helfen?
hoffentlich bleibt die Formatierung einigermassen erhalten.hier der komplette code:
#include <windows.h>
#include <fstream.h>
#include <windowsx.h>#define IDI_ICON 101
#define NIDAppName "abc"
#define WM_NOTIFYICON WM_USER
NOTIFYICONDATA NID={sizeof(NID),0,0,
NIF_MESSAGE | NIF_ICON | NIF_TIP,WM_NOTIFYICON,
0,
NIDAppName};namespace AppMenus
{
const int QuitApp = 1;
const int filenew = 2;}
HWND hInfoBitMap;
HINSTANCE main_hInst;
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK WndProcEdit (HWND hWnd,UINT iMsg, WPARAM wParam, LPARAM lParam);HWND hEdit[1];
const char *EditClassName = "Edit";
const char *InfoClassName = "Info";
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
int WINAPI WinMain (HINSTANCE hI, HINSTANCE hPrI, PSTR szCmdLine, int iCmdShow)
{
HWND g_hMainWindow;
main_hInst = hI;WNDCLASS wc;
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hI;
wc.hIcon = LoadIcon (NULL, IDI_WINLOGO);
wc.hCursor = 0;
wc.hbrBackground = NULL;//(HBRUSH)(COLOR_3DSHADOW+1);//MyBrush;
wc.lpszMenuName = NULL;
wc.lpszClassName = NIDAppName;
RegisterClass (&wc);
HWND hwnd = CreateWindow (NIDAppName, "abc_neu", WS_OVERLAPPEDWINDOW,
0, 0, 400, 100, NULL, NULL, hI, NULL);NID.hWnd=hwnd;
NID.hIcon=LoadIcon(hI, MAKEINTRESOURCE(IDI_ICON));
Shell_NotifyIcon(NIM_ADD,&NID);
DestroyIcon(NID.hIcon);wc.lpfnWndProc = WndProcEdit;
wc.lpszClassName = EditClassName;
RegisterClass (&wc);ShowWindow(hwnd, SW_HIDE);
UpdateWindow (hwnd);//-----------------------------------------------------------------------------------
MSG msg;
while (GetMessage (&msg, NULL, 0, 0))
{
TranslateMessage (&msg);
DispatchMessage (&msg);
}
return msg.wParam;
}//-----------------------------------------------------------------------------
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HDC hdc;
PAINTSTRUCT ps;
static HWND hwndButton1, hwndEdit2;
HMENU hMyMenu;
POINT MousePos;switch (message)
{
//-----------------------------------------------------------------------------
case WM_DESTROY:
Shell_NotifyIcon(NIM_DELETE,&NID);
PostQuitMessage (0);
return 0; //WM_DESTROY
//-----------------------------------------------------------------------------
case WM_COMMAND:
switch(LOWORD(wParam))
{case AppMenus::QuitApp: {
// Anwendung beenden
PostMessage(hwnd, WM_CLOSE, 0, 0);
break;
} // end AppMenus::QuitAppcase AppMenus::filenew: {
hEdit[0] = CreateWindowEx( WS_EX_CLIENTEDGE,
EditClassName, /* Name der Edit Fenster Klasse /
"message", / Textinhalt */
WS_SYSMENU | ES_MULTILINE | ES_AUTOVSCROLL | WS_THICKFRAME | WS_BORDER,// | WS_POPUP,
20, 10 , 400, 200,
hwnd, // übergeordnetes Fenster
NULL,
NULL,
NULL);break;
}
}
return 0;
//-----------------------------------------------------------------------------case WM_NOTIFYICON:
switch(lParam){case WM_RBUTTONDOWN: {
hMyMenu=CreatePopupMenu();
AppendMenu( hMyMenu, MF_STRING,
AppMenus::QuitApp, "B&eenden");
AppendMenu( hMyMenu, MF_STRING,
AppMenus::filenew, "New");GetCursorPos(&MousePos);
SetForegroundWindow(hwnd);
TrackPopupMenu( hMyMenu, 0,
MousePos.x, MousePos.y,
0, hwnd, 0);
DestroyMenu(hMyMenu);
break;
}}
return 0;
}
return DefWindowProc (hwnd, message, wParam, lParam);
}//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
LRESULT CALLBACK WndProcEdit(HWND hWnd,UINT iMsg,
WPARAM wParam, LPARAM lParam)
{
switch (iMsg)
{
case WM_DESTROY:
PostQuitMessage(0);
return 0;
break;case WM_CREATE:{
ShowWindow(hWnd,SW_SHOW); //Show the window
UpdateWindow(hWnd); //Update it
}
break;
}//end switchreturn DefWindowProc(hWnd,iMsg,wParam,lParam);
}
-
wie ich gerade sehe ist die formatierung doch flöten gegangen,
ausserdem fehlt das icon für den tray neben der windows uhr.
ist i.m. eben eine leere kiste (macht aber nix)ts
-
Benutzt doch bitte Code-Tags! *fleh*
cu
-
So kann das nicht weitergehen: Bitte Fehler eingrenzen. :p