Hello .... first of all many many thanks for your advice !
Regarding this ...i did some changes but now I have some problems with scrollbars .... Will appear but are not working ... can you tell me where is the mistake ?
<pre>#ifndef UNICODE
#define UNICODE
#endif
#include <windows.h>
#include <iostream>
#include <fstream>
#include <string>
int X_Coordinate = 215;
int Y_Coordinate = 415;
int Width = 400;
int Height = 380;
char Text[] = {"this is a comment"};
HBITMAP bitmap;
LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, PWSTR pCmdLine, int nCmdShow)
{
const wchar_t CLASS_NAME[] = L"Sample Window Class";
WNDCLASS wc = { };
wc.lpfnWndProc = WindowProc;
wc.hInstance = hInstance;
wc.lpszClassName = CLASS_NAME;
RegisterClass(&wc);
HWND hwnd = CreateWindowEx(
0, CLASS_NAME, L"My first window", WS_OVERLAPPEDWINDOW | WS_VSCROLL | WS_HSCROLL ,
X_Coordinate, Y_Coordinate, Width, Height,
NULL, NULL, hInstance, NULL );
if (hwnd == NULL)
{
return 0;
}
ShowWindow(hwnd, nCmdShow);
MSG msg = { };
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}
LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_DESTROY:
PostQuitMessage(0);
return 0;
case WM_PAINT:
{
bitmap=(HBITMAP)LoadImage(NULL,TEXT("D:\\bitmap1.bmp"),IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwnd, &ps);
int index = sizeof(Text);
wchar_t wtext[sizeof(Text)];
memset(wtext,1,sizeof(wtext));
mbstowcs(wtext,Text,strlen(Text)+1);
LPWSTR a = wtext;
index = index + 100;
HDC hMemDC=CreateCompatibleDC(hdc);
::SelectObject(hMemDC,bitmap);
BitBlt(hdc,0,index,700,980,hMemDC,0,0,SRCCOPY);
long retval;
retval=SetTextAlign(hdc,TA_TOP);
for (int x = 0; x < sizeof(Text); x++)
{
TextOut (hdc, 5, 5, a, sizeof(Text));
}
EndPaint(hwnd, &ps);
}
return 0;
}
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}