Jo tu zprávu jsem tam měl, akorát jako podmínku k message. Teď mám problém, že mi to spadne, když použiju SendMessage()
// Skyrim_Crystal_Editor.cpp : Defines the entry point for the application.
//
#include "stdafx.h"
#include "Skyrim_Crystal_Editor.h"
#define MAX_LOADSTRING 100
// Global Variables:
HINSTANCE hInst; // current instance
HINSTANCE hTreeInst;
HINSTANCE hLoadPluginsInst;
TCHAR szTitle[MAX_LOADSTRING]; // The title bar text
TCHAR szWindowClass[MAX_LOADSTRING]; // the main window class name
TCHAR lpWindowClass[MAX_LOADSTRING];
HWND hWndLoadPlugins;
HWND hWndLoadPluginsDir;
HWND hWndListOfPlugins;
HWND hWndListOfParents;
HWND hWndDescription;
HWND hWndSetAsActive;
HWND hWndLoadButton;
// Forward declarations of functions included in this code module:
ATOM MyRegisterClass(HINSTANCE hInstance);
ATOM MyRegisterLoadPlugin(HINSTANCE hInstance);
BOOL InitInstance(HINSTANCE, int);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK WndLPProc(HWND, UINT, WPARAM, LPARAM);
INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM);
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
// TODO: Place code here.
MSG msg;
HACCEL hAccelTable;
// Initialize global strings
LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
LoadString(hInstance, IDC_SKYRIM_CRYSTAL_EDITOR, szWindowClass, MAX_LOADSTRING);
MyRegisterClass(hInstance);
// Perform application initialization:
if (!InitInstance (hInstance, nCmdShow))
{
return FALSE;
}
hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_SKYRIM_CRYSTAL_EDITOR));
// Main message loop:
while (GetMessage(&msg, NULL, 0, 0))
{
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return (int) msg.wParam;
}
//
// FUNCTION: MyRegisterClass()
//
// PURPOSE: Registers the window class.
//
// COMMENTS:
//
// This function and its usage are only necessary if you want this code
// to be compatible with Win32 systems prior to the 'RegisterClassEx'
// function that was added to Windows 95. It is important to call this function
// so that the application will get 'well formed' small icons associated
// with it.
//
ATOM MyRegisterClass(HINSTANCE hInstance)
{
WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_SKYRIM_CRYSTAL_EDITOR));
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = MAKEINTRESOURCE(IDC_SKYRIM_CRYSTAL_EDITOR);
wcex.lpszClassName = szWindowClass;
wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));
return RegisterClassEx(&wcex);
}
ATOM MyRegisterLoadPlugin(HINSTANCE hInstance)
{
WNDCLASSEX wloadp;
wloadp.cbSize = sizeof(WNDCLASSEX);
wloadp.style = CS_HREDRAW | CS_VREDRAW;
wloadp.lpfnWndProc = WndLPProc;
wloadp.cbClsExtra = 0;
wloadp.cbWndExtra = 0;
wloadp.hInstance = hInstance;
wloadp.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_SKYRIM_CRYSTAL_EDITOR));
wloadp.hCursor = LoadCursor(NULL, IDC_ARROW);
wloadp.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wloadp.lpszMenuName = MAKEINTRESOURCE(IDC_LOAD_PLUGINS);
wloadp.lpszClassName = lpWindowClass;
wloadp.hIconSm = LoadIcon(wloadp.hInstance, MAKEINTRESOURCE(IDI_SMALL));
return RegisterClassEx(&wloadp);
}
//
// FUNCTION: InitInstance(HINSTANCE, int)
//
// PURPOSE: Saves instance handle and creates main window
//
// COMMENTS:
//
// In this function, we save the instance handle in a global variable and
// create and display the main program window.
//
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
HWND hWnd;
hInst = hInstance; // Store instance handle in our global variable
hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, 0 , 0, 256, 768, NULL, NULL, hInstance, NULL);
HWND hwndTree;
hwndTree = CreateWindowEx(0,WC_TREEVIEW, TEXT("Tree View"), WS_VISIBLE | WS_CHILD | WS_BORDER | TVS_HASLINES, 12, 12, 216, 682, hWnd, (HMENU)ID_TREEVIEW, hTreeInst, NULL);
if (!hWnd)
{
return FALSE;
}
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
return TRUE;
}
//
// FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM)
//
// PURPOSE: Processes messages for the main window.
//
// WM_COMMAND - process the application menu
// WM_PAINT - Paint the main window
// WM_DESTROY - post a quit message and return
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
PAINTSTRUCT ps;
HDC hdc;
switch (message)
{
case WM_COMMAND:
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
// Parse the menu selections:
switch (wmId)
{
case IDM_ABOUT:
DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
break;
case IDM_EXIT:
DestroyWindow(hWnd);
break;
/*case IDM_LOADDIR:
SetWindowText( hWndLoadPluginsDir, L"ahojghgnhyj vkjml,ploj,o;,njo,jv,bkl,j;lnb.b,jl;l.l;.kkmhnjgbhgbchjnjmkm" );
break;*/
case IDM_LOADPLUGINS:
hLoadPluginsInst = (HINSTANCE)GetStdHandle(STD_INPUT_HANDLE);
LoadString(hLoadPluginsInst, IDC_LOAD_PLUGINS, lpWindowClass, MAX_LOADSTRING);
MyRegisterLoadPlugin(hLoadPluginsInst);
hWndLoadPlugins = CreateWindow(lpWindowClass, TEXT("Load Plugins"), WS_VISIBLE | WS_BORDER | WS_OVERLAPPEDWINDOW, 100 , 100, 512, 768, hWnd, NULL, hLoadPluginsInst, NULL);
hWndLoadPluginsDir = CreateWindowEx(0,L"EDIT", TEXT(""), WS_VISIBLE | WS_CHILD | WS_BORDER, 16, 32, 322, 24, hWndLoadPlugins, (HMENU)IDM_LOADDIR, hLoadPluginsInst, NULL);
hWndListOfPlugins = CreateWindowEx(0,L"LISTBOX", TEXT(""), WS_VISIBLE | WS_CHILD | WS_BORDER| LVS_EX_CHECKBOXES, 16, 72, 175, 575, hWndLoadPlugins, (HMENU)IDM_LOADLIST, hLoadPluginsInst, NULL);
hWndListOfParents = CreateWindowEx(0,L"LISTBOX", TEXT(""), WS_VISIBLE | WS_CHILD | WS_BORDER, 210, 72, 128, 175, hWndLoadPlugins, (HMENU)IDM_LOADPARENTS, hLoadPluginsInst, NULL);
hWndDescription = CreateWindowEx(0,L"STATIC", TEXT(""), WS_VISIBLE | WS_CHILD | WS_BORDER, 210, 253, 265, 384, hWndLoadPlugins, (HMENU)IDM_LOADDESCRIP, hLoadPluginsInst, NULL);
hWndSetAsActive = CreateWindowEx(0,L"BUTTON", TEXT("Set as Active"), WS_VISIBLE | WS_CHILD | WS_BORDER, 16, 675, 128, 24, hWndLoadPlugins, (HMENU)IDM_LOADSETASACT, hLoadPluginsInst, NULL);
hWndLoadButton = CreateWindowEx(0,L"BUTTON", TEXT("Load Plugins"), WS_VISIBLE | WS_CHILD | WS_BORDER, 210, 675, 128, 24, hWndLoadPlugins, (HMENU)IDM_LOADBUTTON, hLoadPluginsInst, NULL);
ShowWindow(hWndLoadPlugins, SW_SHOW);
UpdateWindow(hWndLoadPlugins);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
break;
case WM_CREATE:
break;
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
// TODO: Add any drawing code here...
EndPaint(hWnd, &ps);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
LRESULT CALLBACK WndLPProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
PAINTSTRUCT ps;
HDC hdc;
switch (message)
{
case WM_COMMAND:
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
// Parse the menu selections:
switch (wmId)
{
case IDM_LOADDIR:
if (wmEvent == EN_CHANGE)
{
SendMessage( hWndLoadPluginsDir, WM_SETTEXT, 0, (LPARAM)L"gghghhhjhjghjhghj");
}
break;
/*default:
return DefWindowProc(hWnd, message, wParam, lParam);*/
}
break;
case WM_CREATE:
break;
case WM_INITDIALOG:
break;
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
// TODO: Add any drawing code here...
EndPaint(hWnd, &ps);
break;
case WM_DESTROY:
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
// Message handler for about box.
INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
UNREFERENCED_PARAMETER(lParam);
switch (message)
{
case WM_INITDIALOG:
return (INT_PTR)TRUE;
case WM_COMMAND:
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
{
EndDialog(hDlg, LOWORD(wParam));
return (INT_PTR)TRUE;
}
break;
}
return (INT_PTR)FALSE;
}