|
Hi,
Right now I'm working on an ActiveX control. We have a very large message map defined with BEGIN_MSG_MAP, a number of MESSAGE_HANDLERs, ended with END_MSG_MAP. For each of the handler functions specified in the MESSAGE_HANDLERs, we return a value. Looking into the macros, it seems that the return value of our handler becomes the value of the lResult reference argument of ProcessWindowMessage function defined by BEGIN_MSG_MAP, and ProcessWindowMessage returns this lResult, to the window procedure.
So now you guys understand the scenario. What I don't understand is what exactly the point of handler return value/lresult is! What does it mean? In our handlers (mostly written by other people) sometimes every path of execution returns 0, sometimes some return 1 and the other/s 0. There is no correlation between whether the handler succeeded or failed. Could someone please explain what these values mean? Thanks.
|
|
|
|
|
In many cases, the windows message handlers originally had the notion that 'return 1 if you processed the message, return 0 if you did NOT process the message'. Then, the idea was that as messages were passed down to child windows or passed through a message handler chain, it could be determined if the function handler 'you' just called processed the message or not. This has changed over time, and now you basically have to read documentation for every message handler to see what the return value might mean and if you are suposed to return one thing or another if you process it.
For example, you can read about WM_INITIDIALOG and it will say something like 'return 0 if you set focus to a control, otherwise return 1', and what that means to the default window procedure is that it will set the focus to first valid control it can find 'unless you already set the focus'.
|
|
|
|
|
|
Hi, every one
There is a message in MSDN about EngModifySurface and EngAssociateSurface:"driver must implement the corresponding function for every bit that it sets in flHooks".
But how to do? I have no idea after searching in MSDN and Internet.
Someone CAN help me?
My E-Mail is :XHZXLQT@163.COM
Thanks Very Much!
__________
\\ //
\\ //
\\ //
\\//
\/
|
|
|
|
|
Are you trying to create a GDI device driver? If so, then you will need to implement the DrvXxx() functions as described in the documentation for EngAssociateSurface() .
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Thanks,DavidCrow.
I'll try to create not a GDI driver,but a Video FILTER driver(In my driver ,I'll hook the functions DrvXXX)
The message for EngAssociateSurface and EngModifySurface means that Coder must implement the corresponding function for each DrvXXX function that be hooked.
The problem is: how to implement the CORRESPONDING FUNCTION? How to name the corresponding function ,use the same name DrvXXX or other? And the system how to known which corresponding function maps the GDI function DrvXXX?
|
|
|
|
|
xhzxlqt wrote:
The problem is: how to implement the CORRESPONDING FUNCTION? How to name the corresponding function...
See here. Click on each of the functions in the second column to see what their signature looks like.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi all,
I have 3 dockable views in my application.
In my Overrided "OnEraseBkgnd" message handler,Depending on some useractions
sometimes,I have to redraw the background,some times not.
BOOL C_View::OnEraseBkgnd(CDC* pDC)
{
if//something;;can be many useractions reqiring no redraw
return FALSE;
else// ;can be many useractions reqiring a redraw
return CScrollView::OnEraseBkgnd(pDC);
}
what would be the best way,I could do that...
Thanks...
|
|
|
|
|
Make the background a view too. That helps allot, since windows keeps your backround image clean. If you realy need to redraw it you only need to call backview.invalidate();. You have to create a OnSize() Function that redraws the whole background in the view.
|
|
|
|
|
|
Hello
I want to use image scanner in my program. how can I start?
please some one tell me where can I start !
Thank you,
Iman Ghasrfakhri
|
|
|
|
|
What kind of scanner? If you mean the technologie that is used to build parsers and compilers and such, a Google[^] search will provide you ample results.
Also the most wonderfull programming community on the world has a large collection of articles that are usefull for you: search here for parsers and scanners[^]
Hope this helps
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
|
|
I have the following declaration:
TCHAR uniChar = _T("\xFEFF");
The problem is, on compile it whines that if TCHAR is 8 bits then I'm trying to put an array of chars into 1 char. How would I keep the above statement but so that if TCHAR is set to 8, it cuts off either FE or FF?
|
|
|
|
|
Hello,
You declare one variable of type TCHAR, but you try to assign an array! Try the following instead:
<br />
const TCHAR* pszUniChar = _T("\xFEFF");<br />
Hope this helps
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
If you want it to be a string, do what Bob says. If you want it to be a single character, you need to surround the Unicode character with single quotes instead of double quotes:
<br />
wchar_t uniChar = L'\xFEFF';<br />
It doesn't make sense to use TCHAR for a single character, as in a non-Unicode build it would equate to a char, which can't handle a value as large as 0xfeff.
Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
|
|
|
|
|
Thx, I also noticed another problem now that my program compiles. When I open unicode files and process them, the output ends up being weird. Then when I opened the file in hex editor and compared to original I noticed that it reads the first three bytes of the unicode file (FEFF tag and the first character, except that it processes them as FF 00 FE 00 3C as opposed to FF FE 3C ) and then instead of all the other text I just see end of line characters: 00 0D 0A repeated over and over again. Any idea where my strings are disappearing to?
|
|
|
|
|
I figured out what was causing this, I needed to use CFile::typeBinary tag when opening files
|
|
|
|
|
I have the following structures and unions defined and I have created a DataHolderUnion object using new.
struct Filler
{
unsigned int f : 16 ;
} ;
struct DataHolder
{
Filler filler1 [42] ;
Filler filler2 [192] ;
Filler filler3 [192] ;
Filler filler4 [384] ;
} ;
typedef union
{
struct DataHolder data_holder ;
} DataHolderUnion ;
What I then have is an array of unsigned chars whose size matches the total size of DataHolder, so I then do:
DataHolderUnionPtr = (DataHolderUnion*) myUCharArr ;
however the data then contained in DataHolderUnionPtr is not what I expect. I have located the problem (*I think*) to the DataHolder structure and in particular to the arrays used (I found this by changing "Filler filler1 [42] ;" to 42 variables declared as:
unsigned int f1 : 16 ;
....
unsigned int f42 : 16 ;
when I did this all of the data I expected to see in each of the 'f' variables was there and correct.
So after this long winded explanation can anyone tell me if its possible to continue using an array (or similar method) in my struct or of anyways around this problem?
many thanks,
|
|
|
|
|
Hello,
I think that you have a problem with the bitfields and alignment. Your struct is aligned at 32bit (if I'm correct) and you have 16 bit sized structures. So what happens with your array is the following: you have a struct with a member of 2 bytes and a size of 4 (the alignment). So your struct is 4 bytes. Your array consist of Filler objects, which are 4 bytes. You want them to be 2 bytes, not?
Assuming that, you can one of the following things: turn off the alignment, or don't use bitfields, but just a short or a WORD instead of your struct:
#pragma pack(push, 1) // store old alignment and set new alignment of 1 byte
#pragma pack(pop) // restore aligmnent.
struct DataHolder
{
WORD filler1 [42] ;
WORD filler2 [192] ;
unsigned __int16 filler3 [192] ;
unsigned short filler4 [384] ;
};
Hope this helps
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
cheers, changing it to be a short did the trick
|
|
|
|
|
You're welcome
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Not sure if this is applicable, however you declared your members as
mcsherry wrote:
unsigned int f : 16
an unsigned int is 32 bits long, so each one takes 4 bytes. Perhaps changing these to
unsigned short f : 16
would solve your problem?
Good luck.
Karl - WK5M
PP-ASEL-IA (N43CS)
<kmedcalf@ev1.net>
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
thanks, changing it to be a short did the trick
|
|
|
|