Click here to Skip to main content
16,016,789 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Update the Window.. Pin
SandipG 13-Nov-08 1:12
SandipG 13-Nov-08 1:12 
GeneralRe: Update the Window.. Pin
gothic_coder13-Nov-08 3:23
gothic_coder13-Nov-08 3:23 
QuestionRe: Update the Window.. Pin
bob1697213-Nov-08 16:35
bob1697213-Nov-08 16:35 
AnswerRe: Update the Window.. [modified] Pin
gothic_coder13-Nov-08 19:04
gothic_coder13-Nov-08 19:04 
QuestionRe: Update the Window.. Pin
bob1697214-Nov-08 4:18
bob1697214-Nov-08 4:18 
AnswerRe: Update the Window.. Pin
gothic_coder14-Nov-08 20:32
gothic_coder14-Nov-08 20:32 
GeneralRe: Update the Window.. Pin
bob1697215-Nov-08 8:36
bob1697215-Nov-08 8:36 
GeneralRe: Update the Window.. Pin
gothic_coder16-Nov-08 20:41
gothic_coder16-Nov-08 20:41 
Well i tried with WX_EX_LAYERED and SetLayeredWindowAttributes with opacity 0. But that makes my whole window transparent including that PNG.. Anyways here's my whole code.. Please take a look..

#define _WIN32_WINNT 0x0501
#include <windows.h>
#include "..\cximage600_full\CxImage\ximage.h"
#include ".\resource.h"

LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;
HINSTANCE hGlobalInst = NULL;

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
                    PSTR szCmdLine, int iCmdShow)
{
	hGlobalInst = hInstance;
	HWND         hwnd ;
        MSG          msg ;
        WNDCLASSEX     wndclass ;
	 
	ZeroMemory(&wndclass,sizeof(WNDCLASSEX));

        wndclass.cbSize = sizeof(WNDCLASSEX);
	wndclass.style         = CS_HREDRAW | CS_VREDRAW ;
        wndclass.lpfnWndProc   = WndProc ;
        wndclass.cbClsExtra    = 0 ;
        wndclass.cbWndExtra    = 0 ;
        wndclass.hInstance     = hInstance ;
        wndclass.hIcon         = LoadIcon (NULL, IDI_APPLICATION) ;
        wndclass.hCursor       = LoadCursor (NULL, IDC_ARROW) ;
        wndclass.hbrBackground = (HBRUSH) GetStockObject (NULL_BRUSH) ;
	//wndclass.hbrBackground = (HBRUSH)   CreateSolidBrush(RGB(255,255,255));
        wndclass.lpszMenuName  = NULL ;
        wndclass.lpszClassName = "WndProc";
     
	 if (!RegisterClassEx (&wndclass))
        {
	      MessageBox (NULL, "Registration Fails","Error", MB_ICONERROR) ;
          return 0 ;
        }
     
     hwnd = CreateWindowEx(WS_EX_TOPMOST | WS_EX_TRANSPARENT | WS_EX_TOOLWINDOW | WS_EX_LAYERED,
"WndProc",  						
NULL,							WS_POPUP,						1,													   1,													   170,													   45,							
NULL,							
NULL,
hInstance,
NULL) ;							

	 if(!hwnd)
	 {
		 MessageBox (NULL, "Window Creation Fails","Error", MB_ICONERROR) ;
         return 0 ;
	 }
	 DWORD eRR1 = GetLastError();

     ShowWindow (hwnd, iCmdShow) ;
     //UpdateWindow(hwnd);
     //SetLayeredWindowAttributes(hwnd, RGB(255,255,255), 100, LWA_COLORKEY|LWA_ALPHA);

     while (GetMessage (&msg, NULL, 0, 0))
     {
          TranslateMessage (&msg) ;
          DispatchMessage (&msg) ;
     }

	 //DialogBox(hGlobalInst, MAKEINTRESOURCE(IDD_PNGBOX), NULL, (DLGPROC)WndProc);
     return msg.lParam;
}

LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	PAINTSTRUCT    ps ;
	RECT		   rect;
	GetWindowRect(hWnd, &rect);
	switch (message)
    {
	case WM_PAINT:
	{
		// To draw PNG on window
		/*HDC hdc = BeginPaint (hWnd  , &ps) ;
				
		CxImage* image = new CxImage();
			 image->LoadResource(FindResource(NULL,MAKEINTRESOURCE(IDR_PNG1),"PNG"),CXIMAGE_FORMAT_PNG);
			BOOL iReturn = image->Draw(hdc, 1, 1);
			
		EndPaint (hWnd  , &ps) ;*/

		//To draw PNG on Desktop screen
		HDC hdc = GetDC(NULL);
		hdc = BeginPaint (NULL, &ps) ;
			
		CxImage* image = new CxImage();
		image->LoadResource(FindResource(NULL,MAKEINTRESOURCE(IDR_PNG1),"PNG"),CXIMAGE_FORMAT_PNG);
			BOOL iReturn = image->Draw(hdc, 1, 1);
			
		EndPaint (NULL , &ps) ;
		break;
	}
		
		default: return DefWindowProc(hWnd, message, wParam, lParam);
	}
	return 0;
}
</windows.h>

GeneralRe: Update the Window.. Pin
gothic_coder17-Nov-08 2:40
gothic_coder17-Nov-08 2:40 
QuestionCheckBox and Static control problem Pin
Dhiraj kumar Saini12-Nov-08 23:48
Dhiraj kumar Saini12-Nov-08 23:48 
AnswerRe: CheckBox and Static control problem Pin
gothic_coder13-Nov-08 0:02
gothic_coder13-Nov-08 0:02 
GeneralRe: CheckBox and Static control problem Pin
Dhiraj kumar Saini13-Nov-08 0:05
Dhiraj kumar Saini13-Nov-08 0:05 
GeneralRe: CheckBox and Static control problem Pin
gothic_coder13-Nov-08 0:42
gothic_coder13-Nov-08 0:42 
GeneralRe: CheckBox and Static control problem Pin
Dhiraj kumar Saini13-Nov-08 1:58
Dhiraj kumar Saini13-Nov-08 1:58 
GeneralRe: CheckBox and Static control problem Pin
Iain Clarke, Warrior Programmer13-Nov-08 2:57
Iain Clarke, Warrior Programmer13-Nov-08 2:57 
GeneralRe: CheckBox and Static control problem Pin
gothic_coder13-Nov-08 3:12
gothic_coder13-Nov-08 3:12 
AnswerRe: CheckBox and Static control problem Pin
AtomAnt13-Nov-08 0:04
AtomAnt13-Nov-08 0:04 
QuestionHow can i Get Hard Drive Modal details? Pin
Le@rner12-Nov-08 21:58
Le@rner12-Nov-08 21:58 
AnswerRe: How can i Get Hard Drive Modal details? Pin
SandipG 12-Nov-08 22:24
SandipG 12-Nov-08 22:24 
AnswerRe: How can i Get Hard Drive Modal details? Pin
_AnsHUMAN_ 12-Nov-08 22:26
_AnsHUMAN_ 12-Nov-08 22:26 
AnswerRe: How can i Get Hard Drive Modal details? [modified] Pin
User 21559712-Nov-08 22:26
User 21559712-Nov-08 22:26 
QuestionHow to get disk's capacitance of remote computer with ip? Pin
ZhiLiangLin12-Nov-08 20:00
ZhiLiangLin12-Nov-08 20:00 
AnswerRe: How to get disk's capacitance of remote computer with ip? [modified] Pin
User 21559712-Nov-08 22:18
User 21559712-Nov-08 22:18 
QuestionRe: How to get disk's capacitance of remote computer with ip? Pin
David Crow13-Nov-08 3:13
David Crow13-Nov-08 3:13 
QuestionOnDragOver/OnDropEx cannot used in CStatic? [modified] Pin
kaviniswell12-Nov-08 19:44
kaviniswell12-Nov-08 19:44 

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.