i'm building the label1 class, but i'm getting bad results... so i ask: how can i use the SetWindowLongPtr() for use a window procedure?
(i can show the label and change it's properties... but i'm getting problems for active it's own window procedure :( )
see the entire code\class:
#include <windows.h>
#include <iostream>
#include <string>
#include <process.h>
using namespace std;
HWND hwnd;
HHOOK _hook;
LRESULT __stdcall HookCallback(int nCode, WPARAM wParam, LPARAM lParam)
{
if (nCode >= 0)
{
// the action is valid: HC_ACTION.
if (wParam == WM_LBUTTONUP)
{
MessageBox(NULL, "hi","hello",MB_OK);
}
}
return CallNextHookEx(NULL, nCode, wParam, lParam);
}
class label
{
private:
public:
label(HWND value)
{
hwnd = CreateWindowEx(
WS_EX_LEFT| WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR,
"STATIC",
"hello world",
SS_LEFT|WS_CHILD|WS_VISIBLE,
0, 0, 100, 100,
value,
NULL,
GetModuleHandle(NULL),
NULL);
SetWindowsHookEx(WH_CALLWNDPROC, HookCallback, NULL, 0);
ShowWindow(hwnd,SW_SHOW);
UpdateWindow(hwnd);
}
COORD GetSize()
{
RECT LabelSize;
GetWindowRect(hwnd,&LabelSize);
COORD crdSize={LabelSize.right-LabelSize.left,LabelSize.bottom-LabelSize.top};
return crdSize;
}
void SetText(string text)
{
char* chrText=(char*)text.c_str();
SetWindowText(hwnd, chrText);
}
};
i'm trying connect the STATIC class with my own window procedure....
please some one give me more info
anotherthing: why i can't put the window procedure inside of the class?