Click here to Skip to main content
15,900,521 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Helpppppppp Pin
toxcct4-May-07 11:25
toxcct4-May-07 11:25 
JokeRe: Helpppppppp Pin
Moak4-May-07 11:43
Moak4-May-07 11:43 
JokeRe: Helpppppppp Pin
Mark Salsbery4-May-07 11:47
Mark Salsbery4-May-07 11:47 
GeneralRe: Helpppppppp Pin
Roger Stoltz4-May-07 11:59
Roger Stoltz4-May-07 11:59 
GeneralRe: Helpppppppp Pin
Mark Salsbery4-May-07 12:44
Mark Salsbery4-May-07 12:44 
GeneralRe: Helpppppppp Pin
Rajesh R Subramanian4-May-07 21:39
professionalRajesh R Subramanian4-May-07 21:39 
GeneralRe: Helpppppppp Pin
Mark Salsbery5-May-07 6:00
Mark Salsbery5-May-07 6:00 
QuestionHelpppppp Pin
HassanKU4-May-07 9:34
HassanKU4-May-07 9:34 
// Hassancap.cpp : Defines the entry point for the application.
//

#include "stdafx.h"
#include "Hassancap.h"

#define MAX_LOADSTRING 100

// Global Variables:
HINSTANCE hInst; // current instance
TCHAR szTitle[MAX_LOADSTRING]; // The title bar text
TCHAR szWindowClass[MAX_LOADSTRING]; // the main window class name


// Forward declarations of functions included in this code module:
ATOM MyRegisterClass(HINSTANCE hInstance);
BOOL InitInstance(HINSTANCE, int);
LRESULT CALLBACK WndProc(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_HASSANCAP, szWindowClass, MAX_LOADSTRING);
MyRegisterClass(hInstance);

// Perform application initialization:
if (!InitInstance (hInstance, nCmdShow))
{
return FALSE;
}

hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_HASSANCAP));

// 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_HASSANCAP));
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = MAKEINTRESOURCE(IDC_HASSANCAP);
wcex.lpszClassName = szWindowClass;
wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));

return RegisterClassEx(&wcex);
}

//
//
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
HWND hWnd;

hInst = hInstance; // Store instance handle in our global variable

hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
// hWnd = CreateWindow(szWindowClass, szTitle, WS_POPUPWINDOW|WS_CAPTION|WS_VISIBLE,
//480, 400, 320, 240, NULL, NULL, hInstance, 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)
{
HDC hdc ;
PAINTSTRUCT ps ;
RECT rect ;
HDC hdcWindow;



static int nScreenWidth, nScreenHeight;

switch (message)
{
case WM_CREATE:
nScreenWidth = GetSystemMetrics(SM_CXSCREEN);
nScreenHeight = GetSystemMetrics(SM_CYSCREEN);
SetTimer( hwnd,0,2000,NULL);


return 0 ;

case WM_LBUTTONDOWN:
{
HWND tBarHandle= NULL;
return 0;
}
case WM_PAINT:
{
hdc = BeginPaint (hwnd, &ps) ;
hdcWindow = GetWindowDC( hwnd);


HWND hDesktopWnd = GetDesktopWindow();
HDC Source = GetDC(hDesktopWnd);
HDC Destination = CreateCompatibleDC(Source);
HBITMAP hCaptureBitmap =CreateCompatibleBitmap(Source, nScreenWidth, nScreenHeight);
SelectObject(Destination,hCaptureBitmap);
BitBlt(Destination,0,0,nScreenWidth,nScreenHeight, Source, 0, 0, SRCCOPY);
BitBlt(hdc,0,0 , nScreenWidth, nScreenHeight, Source, 0,0, SRCCOPY);



ReleaseDC(hDesktopWnd,Destination);
DeleteDC(Source);
DeleteObject(hCaptureBitmap);

EndPaint (hwnd, &ps) ;
}
return 0 ;
case WM_TIMER:
GetClientRect(hwnd,&rect);
InvalidateRect( hwnd, &rect, true);
return 0;
case WM_DESTROY:
PostQuitMessage (0) ;
return 0 ;
}
return DefWindowProc (hwnd, message, wParam, lParam) ;
}

How to convert DDB format to DIB format using GETDIBits() function ...
GeneralRe: Helpppppp Pin
toxcct4-May-07 9:39
toxcct4-May-07 9:39 
GeneralRe: Helpppppp Pin
HassanKU4-May-07 9:48
HassanKU4-May-07 9:48 
GeneralRe: Helpppppp Pin
toxcct4-May-07 9:55
toxcct4-May-07 9:55 
GeneralRe: Helpppppp Pin
Hamid_RT4-May-07 18:02
Hamid_RT4-May-07 18:02 
GeneralRe: Helpppppp Pin
toxcct5-May-07 0:45
toxcct5-May-07 0:45 
GeneralRe: Helpppppp Pin
Hamid_RT5-May-07 4:54
Hamid_RT5-May-07 4:54 
GeneralRe: Helpppppp Pin
Paul Conrad4-May-07 13:49
professionalPaul Conrad4-May-07 13:49 
GeneralRe: Helpppppp Pin
ThatsAlok16-May-07 18:43
ThatsAlok16-May-07 18:43 
AnswerRe: Helpppppp Pin
ThatsAlok16-May-07 18:43
ThatsAlok16-May-07 18:43 
QuestionQuestion about writing to hardrive Pin
godspeed1234-May-07 8:37
godspeed1234-May-07 8:37 
AnswerRe: Question about writing to hardrive Pin
Ahmed Charfeddine4-May-07 21:25
Ahmed Charfeddine4-May-07 21:25 
AnswerRe: Question about writing to hardrive Pin
Sam_c5-May-07 12:29
Sam_c5-May-07 12:29 
AnswerRe: Question about writing to hardrive Pin
ThatsAlok16-May-07 18:42
ThatsAlok16-May-07 18:42 
GeneralRe: Question about writing to hardrive Pin
godspeed12316-May-07 18:45
godspeed12316-May-07 18:45 
GeneralRe: Question about writing to hardrive Pin
ThatsAlok16-May-07 19:34
ThatsAlok16-May-07 19:34 
GeneralRe: Question about writing to hardrive Pin
godspeed12316-May-07 19:37
godspeed12316-May-07 19:37 
QuestionAssistance with 0xC0000005: Access Violation Pin
Reagan Conservative4-May-07 6:46
Reagan Conservative4-May-07 6:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.