|
Hi again,
Can you send your source code for me ? that was about indicate records in a FlexGrid ?
Can you ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
I'll try to dig up a code backup CD and see what I can find for you.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
Anyone how to transfer color to gray like XP shutdown interface. However, only the window is color, others is gray.
What I needed maybe you have, so let's help each other.
|
|
|
|
|
No need to barter
To make colour into gray scale, you need to take the red, green abd blue values ( actually windows uses BGR ) and then use the formula
x = .299 * red + .587 * green + .114 * blue
to get the value to pass back in to all three values ( gray pixels having equal values in all three channels ). You can take an average of the three, but that doesn't take in to account the way the human eye percieves colour.
Now, to change the whole screen to gray ( I assume that's what XP does, hey, maybe you DO have something I want....), you need to grab the screen ( which is easy - CWindowDC dc(NULL); gives you a DC to the screen, you can Blt off it ). Then you need to create a DIBSection the same size ( because you can get direct access to the bits ), copy the CWindowDC onto it ( it needs to be selected in to a DC, obviously ) and traverse the bits using this formula. Then copy the DIBSection back over the WindowDC. If you're doing it IN XP, or don't mind depending on the GDI+ dll, then you'll find the job easier because you can use a GDI+ bitmap to traverse the bits. I'll be writing a tutorial on how to do this shortly ( i.e. when I find time ).
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
Is there any sample?
What I needed maybe you have, so let's help each other.
|
|
|
|
|
I have a sample around here somewhere that shows how to use a DIBSection to get access to the bits of a bitmap, but it's going to appear in next months Windows Developers Journal, so I'm not sure if I'm allowed to post it. What part of the explanation I gave do you need help with ? To get access to the screen bitmap, you'd do something like:
CWindowDC window(NULL);
CDC dc(NULL); // Does two different things, NULL in the first case creates a DC of the screen, the second creates one *compatible* with the screen.
dc.SelectObject(dib); // Assumes it's already created to the screen size
dc.BitBlt(0,0, width, height, &window, 0, 0); // viola.
You might actually find if you download Paintlib (ww.paintlib.de ) it has stacks of examples of direct pixel access, and a nice wrapper for DIBsection. Also, if you want it, I've written a Targa saver, and filters including a 3x3 spatial with smooth, sharpen, emboss, etc., and gamma, colour, and I'm sure others, but I can't recall. Nothing too cool, no hot wax or swirl ( yet... )
LMK if you need more help, but that should get you started. Just post some code to show me where you get stuck.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
I wrote the following code, but it give me a red screen, everything become red-like, not gray.
CWindowDC dc(NULL);
for ( int i=0; i<1024; i++)
for ( int j=0; j<768; j++)
{
COLORREF clr = dc.GetPixel(i, j);
int R = GetRValue(clr);
int G = GetGValue(clr);
int B = GetBValue(clr);
clr = (54 * R + 183 * G + 19 * B)/256;
//clr = 0.299 * B + 0.587 * G + 0.114 * R;
//.299 * red + .587 * green + .114 * blue
dc.SetPixel(i, j, clr);
}
What I needed maybe you have, so let's help each other.
|
|
|
|
|
You need to write something like this:
int newclr = (54 * R + 183 * G + 19 * B)/256;
clr = RGB(newclr, newclr, newclr)
to put data in all three channels.
|
|
|
|
|
Thanks, I have correctted it.
But there still has a problem:
some area also is colourful, not gray, such as title bar, part of task bar.
What I needed maybe you have, so let's help each other.
|
|
|
|
|
Please stop saying
What I needed maybe you have, so let's help each other
it sounds so mercenary. I help people to help them, I'm sure others here do the same and it is a given that you will probably help me if you can later on.
Anyhow, these areas are drawn by windows, you won't be able to draw on them using this method. The mouse pointer is the same. What is happen is that GDI allows you to draw out of bounds without a crash it just ignores the call. BTW you should add code to check the screen size to your loop - use GetSystemMetrics to do that.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
I should also mention that the reason I suggested copying to a DIBSection is that GetPixel is painfully slow compared to iterating through the bits using the pointer a DIBSection's constructor gives you.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
Is there is any who can help me to remove the scroll bars from the Html View Window?...;)
|
|
|
|
|
I can't tell you the script off hand, but add the JavaScript to your document which tells the window to hide the scrollbars. That will work.
David Wulff
dwulff@battleaxesoftware.com
|
|
|
|
|
Sir,
I am using Visual C++ and then I have created the HTML view on the Dialog , in which i have forced the HTML window to display my own HTML text. but there is one problem when we load the text in the window if the text is more than the length of the window then Scrolling is visible i want to disable that scroll bar...
![Wink | ;)](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_wink.gif)
|
|
|
|
|
Hey all!!
You know when you right click on the CD Drive icon in my computer, you have the option of ejecting the cd? How do I do this in my MFC dialog app?
Thanks
Ashman
|
|
|
|
|
Search in MSDN for thread Q81871. There's a link to a sample application. Perhaps it will help you.
Gero Gerber
|
|
|
|
|
I have need to add 2 radio buttons to the print dialog and/or the Print setup dialog. I have no problem supplying my own template for the Print dialog and then passing the additional data back to the print function.
However when it comes to the Print Setup the template does not work, the dialog does not come up.
Also if the printers properties are changed I need to have these controls informed of that.
I'm trying to get out of having to write the entire thing myself.
Happy programming!!
|
|
|
|
|
I've always found this to be a disaster. I got around it by rolling my own dialog which has a preview, controls for choosing page layout and a button that brings up the traditional printer to choose if you want to change printers. I bring it up in OnPrint.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
Hi there,
Please help me, I have been so frustrated. I am working on a Win32 DLL. Inside the dll, I am trying to create a popup window which is hidden and covers the entire desktop so I can process mouse message across the screen and do rubber banding. I am doing this because of the restriction of SetCapture(HWND hwnd) API.
What I can do now is that as soon as the client loads the DLL, a hidden window will be created and mouse messages will be processed in GrabProc Callback function. Instead of creating the hidden window when the dll is first loaded, I am hoping to create a hidden window when the mouse is down and destroy it when the mouse it up.
I am a newbie on Windows Programming. Would someone please give me some pointers and show me how to accomplish what I need. Thank you very much for your help.
BOOL APIENTRY DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
if (dwReason == DLL_PROCESS_ATTACH)
{
CreateHiddenWindow();
}
}
BOOL CreateHiddenWindow()
{
static TCHAR szAppName[] = TEXT ("Test") ;
HWND hwnd ;
MSG msg ;
WNDCLASS wndclass ;
wndclass.style = CS_HREDRAW | CS_VREDRAW ;
wndclass.lpfnWndProc = GrabProc ;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = g_hInstance ;
wndclass.hIcon = NULL;
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW);
wndclass.hbrBackground = NULL;
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = szAppName ;
if (!RegisterClass (&wndclass))
{
MessageBox (NULL, TEXT ("This program requires Windows NT!"),
szAppName, MB_ICONERROR) ;
return 0 ;
}
hwnd = CreateWindowEx(WS_EX_TRANSPARENT,
szAppName, NULL,
WS_POPUP, 0, 0,
GetSystemMetrics(SM_CXSCREEN),
GetSystemMetrics(SM_CYSCREEN),
NULL, NULL, g_hInstance, NULL);
ShowWindow(hwnd, SW_SHOW);
UpdateWindow (hwnd) ;
while (GetMessage (&msg, NULL, 0, 0))
{
TranslateMessage (&msg) ;
DispatchMessage (&msg) ;
}
return msg.wParam ;
}
LRESULT CALLBACK GrabProc(HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam)
{
// Handle mouse down, move, up messages for entire screen
// rubber banding
switch (message)
{
case WM_LBUTTONDOWN:
// Create hidden window
break;
case WM_MOUSEMOVE:
break;
case WM_LBUTTONUP:
// Destroy hidden window
break;
}
};) ![Laugh | :laugh:](https://www.codeproject.com/script/Forums/Images/smiley_laugh.gif)
|
|
|
|
|
Is it possible to specify a non Windows' control when deriving a class from CCtrlView? Ideally I would like to specify the class name of my CWnd derived class. I have tried, but it always fails.
Cheers,
James Millson
|
|
|
|
|
What do you mean by "it fails"? It doesn't compile? It crashes?
--Mike--
http://home.inreach.com/mdunn/
We've secretly replaced the msdn.microsoft.com servers with Atari 800XLs. Let's see if anyone notices....
|
|
|
|
|
I get the "Cannot create blank document" message.
Cheers,
James Millson
|
|
|
|
|
subj.
I try:
void CTest::OnPaint()
{
CPaintDC dc(this);
CMemDC memdc(&dc);
CRect clip;
memdc.GetClipBox(&clip);
memdc.FillSolidRect(clip, GetSysColor (COLOR_3DLIGHT));
DefWindowProc(WM_PAINT, (WPARAM)memdc->m_hDC, (LPARAM)0);
}
BOOL CTestDlg::OnEraseBkgnd(CDC* pDC)
{
return FALSE;
}
but anyway my *picture control* flickering and after max/min window's size flicks too. Even more when I open any file by CFileDialog my controls aren't repainted.
What's wrong?
|
|
|
|
|
For a start, handle WM_ERASEBKGND, not WM_PAINT.
--Mike--
http://home.inreach.com/mdunn/
We've secretly replaced the msdn.microsoft.com servers with Atari 800XLs. Let's see if anyone notices....
|
|
|
|
|
Move all WM_PAINT code to WM_ERASEBKGND? or what?
|
|
|
|
|