|
The reason that you cannot tell that the WM_PAINT message has ended in Spy++ is because it is ALWAYS posted.
Is there something that you are trying to accomplish and maybe we can help you that way?
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
In the form designer for Visual Studio you can put a number of buttons on top of each other. In fact you can completely cover one with another. But when you select all the buttons on the form every button’s selection rectangle is displayed - even the one that is completely covered. (You can see bottom button’s selection rectangle drawn OVER the top most button even though the bottom button is completely hidden below the top most button.)
I need to know when all the controls (buttons) on a form are done painting so I can then paint my selection rectangles to the screen (and over any covering control).
Here’s the kicker: I’m doing this in C# and there does not seem to be anyway to do this in a straightforward way. (I have a couple other ideas/suggestions that involve overriding each control’s Paint event or using a window atop the main form.) But I’m hoping that there is someway to do this from a low-level windows perspective. Thus my foray into windows messages and my post here in this forum.
I’ve seen the message WM_QUERYUISTATE pop up in Spy++ for a number of windows but there isn’t much documentation for this message. I’m wonder if I can use it or some other message to determine when the form is finished painted so I can go ahead and paint the selection rectangles over the top of the entire form.
|
|
|
|
|
Actually I want to capture the screen whenever it is updated. I know how to capture the screen and store it as bitmap file but I don't know when to capture...I mean how can my program can know about the screen change. Please help me......
C.R.Naik
|
|
|
|
|
If any program on your desktop recieves WM_PAINT then the screen has changed. If you're hoping to capture video, you're better off to go for 15 fps, I mean, if it only captures on change, the end result will be rather jerky....
Christian
We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum )
Cats, and most other animals apart from mad cows can write fully functional vb code. - Simon Walton - 6-Aug-2002
|
|
|
|
|
you get a strange error message when you post as 'Anonymous'. Instead, a message telling you need to choose a nick would be better?
|
|
|
|
|
This problem has been fixed.
cheers,
Chris Maunder
|
|
|
|
|
I have a frame window with a menu. when i click one menu item, dialog is created. Now after entering some values into the dialog, i click "OK". here i have a problem. That is, I want to get a field value of the dialog into my frame window. This is the code for the command handler.
void MyCFrameWnd::OnDialog1(){
userDialog1 dlg1;
dlg1.DoModal();
// In this handler i want to get a value from
// the dialog
}
Please help me asap
Thanking you
|
|
|
|
|
Use the DDX features to capture data for your dialog.
Basically this will allow you to assign the edit fields and other controls of your dialog to a member variable that you create in the userDialog1 class.
Then after you call DoModal, you will be able to access the member variables of that class and grab the data that you need.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
In your userDialog1 you make control variables for each control to be visible. That is eg. for a Edit-field you have a variable of type CEdit.
Class Wizard can help you with this.
Then, after DoModal() returned with IDOK, you can access the contents of the Edit-field.
Hope this helps
P.S. DDX is evil...
|
|
|
|
|
hi,
I'ld like to create a CListCtrl object using Create(...) in my CView class.
The function declaration for Create is:
BOOL CListCtrl::Create(DWORD dwStyle,const RECT& rect,CWnd* pParentWnd,UINT nID)
Can someone tell me what's meant by nID (fourth argument) and how to set that value??
Thanx in advance...
|
|
|
|
|
just what it sounds like - it's a number you can use to identify the control by, for instance when using GetDlgItem() or identifying it as the source of notification messages. It can be whatever number you feel like using, although if you plan on actually making use of it then it should be unique amoung the other controls on your form.
---
Shog9
Actually I use to find learning in bars when drinking really useful.
It sort of makes a language liquid. - Colin Davies, Thinking in English?
|
|
|
|
|
Hi,
thanx for that info...
now, i created a CListCtrl using the following code:
<br />
CListCtrl* m_ctrlMesgList = new CListCtrl();<br />
CRect rect(0,650,800,800);<br />
<br />
m_ctrlMesgList->Create(LVS_ALIGNLEFT | LVS_REPORT, rect, this, 1);<br />
m_ctrlMesgList->InsertColumn(0,"Date",LVCFMT_LEFT,-1,-1);<br />
m_ctrlMesgList->InsertColumn(1,"Time",LVCFMT_LEFT,-1,-1);<br />
The problem is, no listctrl is created. This piece of code is in CView::OnInitialUpdate()
Thanx in advance...
|
|
|
|
|
tulc_kris wrote:
m_ctrlMesgList->Create(LVS_ALIGNLEFT | LVS_REPORT, rect, this, 1);
Did you check the return value? What was it?
Anyway, you'll probably want a few other styles. Definately add WS_CHILD|WS_VISIBLE . You may also want WS_BORDER .
---
Shog9
Actually I use to find learning in bars when drinking really useful.
It sort of makes a language liquid. - Colin Davies, Thinking in English?
|
|
|
|
|
Hi All,
I have 2 separate applications say X1 and X2,
X1 receives all the data and stores it in a file now this file should be opened through X2
Consider for example,
GetLogic() fn. in X1 gets the logic from the device and stores it into a file and immidiately this file should be opened through X2
This should happen at run time
User intervention will come only once when he selects GetLogic()
I beleive that DDE should be made used but anyone can explain me the procedure or if there is any other method??
Thanks
Uday
|
|
|
|
|
DDE is somewhat of an outdated technology, there are better ways to do interprocess communication in Win32. You could do a number of things to signal your app X2 that the file has been written by X1 including the following:
1. X1 can find a windows handle to your X2 app and send that window a message when it completes its task.
2. Both apps would register a custom message with the function "RegisterWindowMessage". Both apps would pass in a special string that hopefully only your app will register, and when X1 completes its task, it can broadcast the message that is returned from the api and X2 should handle that message.
3. Create a named event in both applications, and X2 will user WaitForSingleObject or some other wait function and wait for the event that you create.
I think I would choose solution 3. There are other possibilities as far as application synchronization, these are just a few that I thought of off the top of my head.
Good Luck
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
How to automatically close the view after clicking print button on (file print)preview window?
After calling OnEndPrinting(), the frame will call OnDraw() automatically so that I write pChild->PostMessage(WM_CLOSE) in it.
When printing job is little(a few pages) is OK, but if printing hundreds pages, the problems occur (MFC42D.dll violation). The problem I suppose is because CDC* pDC of OnPrint(CDC* pDC, CPrintInfo* pInfo) is sent to printer very slowly(I can read page number from print dialog), when OnDraw() is executed, view is destroyed, so that pDC is no more existed.
if I delete pChild->PostMessage(WM_CLOSE) from OnDraw(),
no problem at all but blank view will show(no code in OnDraw()).I can close view by clicking close button(upper right corner of window) but this is not allowed.
I also try to hide this view but it doesn't work if program run dozens time(memory leak).
I try to solve this problem for weeks but ...
Please give me your advice. Thanks a lot
YJ
|
|
|
|
|
|
Im having trouble putting icons or other pics such as bmp's or such, for they can display as the output.
I appreciate it, thanx.
-Masta G-
|
|
|
|
|
Output where ? Screen or printer ?
Christian
We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum )
Cats, and most other animals apart from mad cows can write fully functional vb code. - Simon Walton - 6-Aug-2002
|
|
|
|
|
|
Yup, on the screen.
-Masta G-
|
|
|
|
|
Use ::LoadImage ( or GDI+ ) then in WM_PAINT, BitBlt them to the screen.
Christian
We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum )
Cats, and most other animals apart from mad cows can write fully functional vb code. - Simon Walton - 6-Aug-2002
|
|
|
|
|
Tomasz Sowinski,Thank you for your reply.
I write the code according to you:
...
#define _WIN32_WINNT 0x0500
#include "winuser.h"
...
but it report the same error "undeclared identifier".
is there other reason?
Thanks again!
Hi
|
|
|
|
|
You will probably need the latest SDK header files. If you do now want to download the Win32 SDK, you can simply include this definition in order to define the function:
UINT WINAPI SendInput(
UINT nInputs,
LPINPUT pInputs,
int cbSize
);
If you include this declaration, and you are not using any other functions that use the version 0x500 headers, then you can set WINVER back to 0x400.
Just incase you didnt know this, by using this function your program will not run on windows 95.
Good Luck
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
I remember reading somewhere (can't find it now ) that when you call WaitForSingleObject on an handle the thread already owns (a MUTEX for instance), the function returns with WAIT_OBJECT_0 .
If this is true, do I have to call ReleaseMutex the same amount of times, or is once enough to give up ownership?
Also, is there a way to know if we own a given resource (HANDLE)?
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|