|
|
Dear friends
Is it possible to add a WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) or a DefWindowProc( HWND hWnd,UINT Msg, WPARAM wParam, LPARAM lParam) function inside a DLL, The reason is My application wants to handle WM_USER messages but only when the DLL is loaded, So I need to have the function there in the DLL, If my Main application recieves the event it will use this handler to process this.
Is this possible...if so ..How....?
please Help
Ranojay
|
|
|
|
|
|
Thanks a lot friend,
I did add a DefWndProc function but , the control does'nt reach there, I mean how do I make this function understand that this belongs to this particular window. In case of writing program with WinMain we explicitrly specify this, but how to do that in this case..
and also regarding the "WM_USER + nuber" type of messages, I use SenMessage with HWND_BROADCAST option, but for some reason The event handler doesnt seem to respond
please help
Ranojay
|
|
|
|
|
Hi Ranojay,
I have some questions:
Did you check the return value of SetWindowLongPtr? Did your process create the window you are trying to subclass? Could you show me the code where you call SetWindowLongPtr?
It is almost never a good idea to use HWND_BROADCAST. Why do you need to broadcast a window message? Could you describe why you need to broadcast a message to all top level windows?
Best Wishes,
-David Delaune
|
|
|
|
|
Dear David
Actually the project I am working on is Quite complicated and is made with Qt. But whatever the GUI mechanism be I should be able to intercept windows events right ?
I havent used SetWindowLongPtr, as I do not know how to use it.
I want to broadcast a particular WM_USER event and I need to have the handler only in my application..So even if all the top level windows recieve it, but Only my dll will be able to process it.
Please help me with WM_USER and HWND_BROADCAST mechanism...
with lots of thanks
Ranojay
|
|
|
|
|
Ranojay wrote: But whatever the GUI mechanism be I should be able to intercept windows events right ?
Absolutely.
Ranojay wrote: I havent used SetWindowLongPtr, as I do not know how to use it.
Well, that explains why your not successfully hooking/subclassing the window. Have I not given you enough information? Here are a few more links regarding subclassing:
Windows subclassing and hooking with C++ classes[^]
Simple mapping of WndProc to your specific class' WndProc - Part 1[^]
Ranojay wrote: Please help me with WM_USER and HWND_BROADCAST mechanism...
Ranojay, WM_USER ranged messages should *never* be broadcast to all top level windows. This type of behavior is every programmers worst nightmare. Please read this MSDN documentation:
WM_APP Notification[^]
As you see WM_USER through 0x7FFF are reserved for an applications internal messages. You need to call the RegisterWindowMessage Function[^] which uses 0xC000 through 0xFFFF to avoid causing problems with other applications.
Best Wishes,
-David Delaune
|
|
|
|
|
Hi All,
I am using PropertySheet, On 3rd page I have Finish button but I do not want to close the window on OnWizardFinish button. How could I do that?
|
|
|
|
|
I believe it is mentioned in the documentation of CPropertyPage::OnWizardFinish[^].
Here is an excerpt from the documentation -
You can override this member function to specify some action the user must take when the Finish button is pressed. When overriding this function, return FALSE to prevent the property sheet from being destroyed.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Hi
i have an Extended ClistCtrl, in which i want to insert a button at the bottom right. i can able to create the button using the nelwo code ,
lButton=new CButton();
lButton->Create(_T("Select All & Next"), WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON |BS_MULTILINE, CRect(520,280,600,320), this, IDC_BUTTON1);
lButton->ShowWindow(SW_SHOWNORMAL);
but when i am scrolling the list control the button image also getting painted in various places and flickering . how to handle this?
Thanks
Gokul
|
|
|
|
|
Why on Earth do you want to put a button in the corner of a list control? Anyways, i doubt there is a simple and easy way to do it, is the parent of the button the same as the parent of the list control or is it the list control itself? The simplest thing you could try is to set the WS_CLIPCHILDREN style (if the list is the parent of the buttton) or WS_CLIPSIBLINGS style (if the parent of the list is the parent of the button), but i doubt it will work and setting the WS_CLIPCHILDREN style causes redraw animalies in the header control if you have one.
You could try decreasing the client area of the list control and put the button on it, this works only if the list is not the parent of the button, you have to make the list not draw onto the button or at least make the button get drawn when the list's nonclient area is drawn, there's a simple way to do this, but i can't remember what now, i think you would need to set WS_TRANSPARENT on the list and ensure that the button is under the list in the Z-order, but i am not sure. The drawback here is that you can't have list items in the non-client area so if you insist on having the button sitting among list items, this won't do for you.
Another thing you could maybe try is to overwrite the scroll-message handlers in the list, disable the redrawing of the list (SetRedraw[^]), calling the base scroll method, then re-enabling redrawing and have the list redraw it self, you might need to explicitly clip the button from the invalidated area.
These are just vague ideas, dunno if any of these would work of suit your needs.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
|
CFile::GetLength throw an exception when processing the file which one's size is bigger than 0xFFFE!
so, How can I get the file size of a very big file which one's size is bigger than 0xFFFE?
|
|
|
|
|
Try GetFileAttributesEx[^].
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
You can use GetFileAttributes() as suggested below but I'd be more concerned about the exception. CFile::GetLength shouldn't have a problem with files > 64K
If you're using VC6 then you should avoid CFile::GetLength since it only supports files < 4G.
A universal function I always use:
__int64 FileSize(CString csFile)
{
WIN32_FIND_DATA fd;
__int64 iSize = -1;
HANDLE hFind = FindFirstFile((LPCTSTR)csFile, &fd);
if (hFind != INVALID_HANDLE_VALUE)
iSize = (((__int64)fd.nFileSizeHigh) << 32) + (__int64)fd.nFileSizeLow;
FindClose(hFind);
return iSize;
}
The default return value (-1) indicates a problem, use GetLastError() in that case.
|
|
|
|
|
adroitadroit20 wrote: CFile::GetLength throw an exception when processing the file which one's size is bigger than 0xFFFE!
0xFFFE == 63 kilobytes, CFile::GetLength should not throw an exception here. Try wrapping your function call in a try/catch block and check what the CFileException Class reports[^].
Best Wishes,
-David Delaune
|
|
|
|
|
sorry, that is a mis type.
The Value should be 0xFFFFFFFE
|
|
|
|
|
adroitadroit20 wrote: The Value should be 0xFFFFFFFE
Then you must be using Visual Studio 6 with MFC 6.0 as your development tools. You could use the previously mentioned API calls or you can use the GetFileSizeEx Function[^] which accepts a pointer to a LARGE_INTEGER structure.
Best Wishes,
-David Delaune
|
|
|
|
|
I'm opening a pdf document in IE.
I would like to have a feedback to me when the pdf has finish loading completely.
I've tried DocumentComplete, but it seems that the event is fired off when it starts to load, and NOT when it has loaded completed.
Does anyone has any suggestions to this?
(I'm using c++)
|
|
|
|
|
Have you checked that the document doesn't have any frames. DocumentComplete gets fired for each frame.
see: http://msdn.microsoft.com/en-us/library/aa768282(VS.85).aspx[^]
...cmk
The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying.
- John Carmack
|
|
|
|
|
Hi cmk
Thank you for your reply.
There isn't any frames in the document as it is an ordinary pdf document.
That's the puzzling problem, because i had thought that the DocumentComplete would get fired AFTER the pdf is loaded and NOT when IE starts to load it.
Here, I'm just wondering if DocumentComplete would refer only to HTML page, or any document that IE loads.
Anyone out there knows?
|
|
|
|
|
I draw a round button.
pDC->RoundRect(left,top,right,bottom,x,y);
Now, i want to set region for button. I use:
CRgn rgn;
rgn.CreateRoundRectRgn(left,top,right + 1, bottom + 1, x1, y1);
How to calculate value for x1, y1? I don't know which value of x1, y1 are logical.
|
|
|
|
|
x and y I suppose. What's the problem exactly ?
BTW, why right+1 and bottom+1 ?
|
|
|
|
|
if i use right and bottom, it doesn't bound all Rectangle. I want to calculate value of x1, y1 to fit round rectangle that i draw.
|
|
|
|
|
http://www.buckrogers.demon.co.uk/software/typecase_vc.zip (source code included) is a program that I wrote: it is like Windows Character Map but displays much bigger and clearer and can select any of the 256 Unicode character planes. It seems to work OK, except:
http://www.buckrogers.demon.co.uk/temp/typecase_bug00.gif is a screen capture of a run of Typecase.
The bug is: some characters (e.g. most characters in the top 4 rows in the image linked to here) do not display in the default font, but they do display in the font '@Arial Unicode MS' - with each character rotated 90 degrees anticlockwise. Please what is causing this?
Only certain groups of characters are affected. But character 2122 (trademark) displays the right way up in the default font and rotated 90deg anticlockwise in the font '@Arial Unicode MS'.
|
|
|
|