in wm_ctlcolorstatic i used lparam in another compiler and the handle of that control to make a wm_colorstatic color for each control difference how can i do that in c++
trying in c++ vc++
HWND hCtl = CreateWindowEx(0,L"static",L"Label1" , WS_CHILD|WS_VISIBLE,40,40,80,30,hWnd,(HMENU)IDC_LABEL1,hIns,0);
// cl JMorgan2.cpp user32.lib gdi32.lib
#ifndef UNICODE
#define UNICODE
#endif
#ifndef _UNICODE
#define _UNICODE
#endif
#include <windows.h>
#define IDC_LABEL1 2000
#define IDC_LABEL2 2002
HWND hCTL;
HWND lParam;
//HBRUSH hBrush;
const COLORREF rgbRed = 0X000000FF;
const COLORREF rgbGreen = 0x0000FF00;
const COLORREF rgbBlue = 0x00FF0000;
const COLORREF rgbBlack = 0x00000000;
const COLORREF rgbWhite = 0x00FFFFFF;
LRESULT CALLBACK fnWndProc(HWND hWnd, unsigned int msg, WPARAM wParam, LPARAM lParam)
{
HWND hCtl;
switch(msg)
{
case WM_CREATE:
{
HINSTANCE hIns = ((LPCREATESTRUCT)lParam)->hInstance;
HBRUSH hBrush = CreateSolidBrush(RGB(255,255,100)); // Create a non-standard color HBRUSH for main window
HWND hCtl = CreateWindowEx(0,L"static",L"Label1" , WS_CHILD|WS_VISIBLE,40,40,80,30,hWnd,(HMENU)IDC_LABEL1,hIns,0);
HWND hCtl1 = CreateWindowEx(0, L"static", L"Label2", WS_CHILD | WS_VISIBLE,40,60, 80, 30, hWnd, (HMENU)IDC_LABEL2, hIns, 0);
SetWindowLongPtr(hWnd,0*sizeof(void*),(LONG_PTR)hBrush); // Store HBRUSH as part of Window Class Structure
return 0;
}
case WM_CTLCOLORSTATIC: // Do not allow DefWindowProc() to process this message!
if(lParam ( hCtl))
{ // When a WM_CTLCOLORSTATIC message comes through, return
SetBkMode((HDC)wParam,TRANSPARENT);
SetTextColor((HDC)wParam, rgbRed); // RGB(20, 20, 240));
//' SetTextColor((HDC)wParam , COLORREF(0xFF, 0x00, 0x00));
// from the Window Procedure call without a DefWindowProc()
return GetWindowLongPtr(hWnd,0*sizeof(void*)); // call. Instead return the HBRUSH stored as an instance
} // variable as part of the WNDCLASSEX object.
case WM_DESTROY:
{
HBRUSH hBrush=(HBRUSH)GetWindowLongPtr(hWnd,0*sizeof(void*));
DeleteObject(hBrush); // Delete dynamically allocated GDI resource stored in
PostQuitMessage(0); // Window Class Structure
return 0;
}
}
return (DefWindowProc(hWnd, msg, wParam, lParam));
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevIns, LPSTR lpszArgument, int iShow)
{
wchar_t szClassName[]=L"Form1";
WNDCLASSEX wc;
MSG messages;
HWND hWnd;
memset(&wc,0,sizeof(WNDCLASSEX));
wc.lpszClassName = szClassName;
wc.lpfnWndProc = fnWndProc;
wc.cbSize = sizeof(WNDCLASSEX);
wc.hbrBackground = CreateSolidBrush(RGB(255, 255, 100)); //hBrush//(HBRUSH)COLOR_WINDOW;
wc.hInstance = hInstance;
wc.cbWndExtra = sizeof(void*);
RegisterClassEx(&wc);
hWnd=CreateWindowEx(0,szClassName,szClassName,WS_OVERLAPPEDWINDOW,200,175,320,200,HWND_DESKTOP,0,hInstance,0);
ShowWindow(hWnd,iShow);
while(GetMessage(&messages,NULL,0,0))
{
TranslateMessage(&messages);
DispatchMessage(&messages);
}
return (int)messages.wParam;
}
#if 0
Note that the 'Build Model' of C or C++ is totally and completely different from PowerBASIC.By
'Build Model' I mean the steps involved in reading in text source files and creating an executable
binary.
In C or C++ the building of an executable or binary has two steps both of which are completely under
the full control of the programmer.These two steps are compilation as done by cl.exe and linking
as done by link.exe.
In PowerBASIC compilation and linking are done by the compiler in one step which the coder has no
control over.
Declare Function SetBkMode Lib "GDI32.DLL" Alias "SetBkMode" (Byval hdc As Dword, Byval nBkMode As Long) As Long
#endif
thanks