|
im using the onpaint method; so i guess i should use the double buffered DC; the problem that i dont know what the double buffered DC is !!! :$.
i only use regular DC!
can u plz tell me how to use a double buffered DC ??
thanks alot
|
|
|
|
|
|
I have just spent the last 2 weeks developing a class which is able to monitor all changes within an edit box. I know it sounds like nothing big but trust me it is.
I am able to trap, monitor and change most messages that deal with this and all is working well. Until I tried inserting Unicode text with the aid of an IME. Here is the problem. When the IME window is open, due to the nature of this class it is forced to close. This is preventing the user from changing their compostion.
What I need to do is quite simple, just prevent my class from executing until the composition has been finalised. In theory I just need to check if the compostion window is open, but I am unable to find any such function or message which is able to do this.
Please help, I really need to find an answer to this.
|
|
|
|
|
Not entirely 100% clear on the issue, but assuming you are running windows you can do something like enumerate all the windows and search for a caption or similar. This isn't the best solution, but is about all you can do if you don't have full control of whatever is spawning/closing the window.
In order to enumerate the windows you can take a couple of approaches: If you know what process owns the window, you can call EnumProcessWindows(), otherwise you will need to call EnumWindows() and check for child windows with EnumChildWindows(). I'm a little short on time at the moment so sorry I can't give a good example, perhaps later tonight. Anyway I hope this helps a little.
When I die I'd like to go peacefully in my sleep like my father, not screaming in terror like his passengers!!!
|
|
|
|
|
Assuming you are running windows you can do something like enumerate all the windows and search for a caption or similar. This isn't the best solution, but is about all you can do if you don't have full control of whatever is spawning/closing the window.
In order to enumerate the windows you can take a couple of approaches: If you know what process owns the window, you can call EnumProcessWindows(), otherwise you will need to call EnumWindows() and check for child windows with EnumChildWindows(). I'm a little short on time at the moment so sorry I can't give a good example, perhaps later tonight. Anyway I hope this helps a little.
When I die I'd like to go peacefully in my sleep like my father, not screaming in terror like his passengers!!!
|
|
|
|
|
Assuming you are running windows you can do something like enumerate all the windows and search for a caption or similar. This isn't the best solution, but is about all you can do if you don't have full control of whatever is spawning/closing the window(unless you want to apply some hooks ).
In order to enumerate the windows you can take a couple of approaches: If you know what process owns the window, you can call EnumProcessWindows(), otherwise you will need to call EnumWindows() and check for child windows with EnumChildWindows(). I'm a little short on time at the moment so sorry I can't give a good example, perhaps later tonight. Anyway I hope this helps a little.
When I die I'd like to go peacefully in my sleep like my father, not screaming in terror like his passengers!!!
|
|
|
|
|
I have read what you have said and it does not make since to me. First, stop getting down on yoyrself (A bad habit of mine). When you say "it sounds like nothing", you are correct (for some of us, in part), but that does not mean that it is. That is a matrer of who is reading your post.
I believe your problem is a bit more complecated than that.
What you are looking for is not as simple as you think, when deling with IME. It sounds like you waont to mix the two, which you (theoretcicaly) can not.
INTP
Every thing is relative...
|
|
|
|
|
Like I said the solution is simple, I just need to find the IME window and check if it is open.
Finding the window is not so simple as searching for the window title, since all the IME really is is an edit box which floats around on the screen positioning itself (usually) over the caret. This actually changes from system to system, depending on the IME version, OS and users settings.
the solution was infact very simple, and I blame myself for not seeing it in the hundreds of IME specific messages and commands.
HIMC hImc = ImmGetContext(hEdit);
if(ImmGetOpenStatus(hImc) )
return false;
|
|
|
|
|
Whoa! Major blond moment! Just ignore the stupidity below. I found the problem. I just had to change the property for this file to ignore the precompiled header.
----- stupid question follows ---------------------
I'm using Monty's HTML List Control (a real rockin' control) and I keep running into a problem with the DrawHTML.c file getting the error:
fatal error C1010: unexpected end of file while looking for precompiled header directive
Yesterday I was somehow able to convince the compiler to accept this file, but today I keep getting this error. There must be some sort of compiler parm that's needed, but I couldn't see anything that jumped out at me by inspecting Monty's example program.
What is going on? Can anyone shed some light on this?
Thanks.
-- modified at 1:40 Tuesday 28th March, 2006
|
|
|
|
|
Abu Mami wrote: fatal error C1010: unexpected end of file while looking for precompiled header directive
It is missing the stdafx.h header file. Including this could solve your problem.
Nibu thomas
Software Developer
|
|
|
|
|
Hi Nibu, thanks for responding. However, I had already tried your suggestion and that didn't work. Since, or course, the file is a C file and not a CPP file.
Read my original post again. I found the answer and modified my original post.
Thanks
|
|
|
|
|
Abu Mami wrote: Since, of course, the file is a C file and not a CPP file.
Why do you think it won't work with a C file.
Nibu thomas
Software Developer
|
|
|
|
|
Nibu thomas wrote: Why do you think it won't work with a C file. Because when I tried it, the compiler complained that I couldn't use the precompiled header with a C file. Call me naive
|
|
|
|
|
You can give the option 'Not Using Precompiled Headers' for the file and then try to build it.
Vini
|
|
|
|
|
Thanks Vini - That in fact is what I discovered and it works just fine. Just took me a little while till I stumbled across this option.
|
|
|
|
|
Under VS2005, create a ATL project and add a simple ATL object into it.
Compile it using the x64 Configuration, all are ok! But if i add IContextMenu interface to it: first add--
public IShellExtInit,
public IContextMenu
and then add--
COM_INTERFACE_ENTRY(IShellExtInit)
COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu)
then the functions
STDMETHOD(Initialize)(LPCITEMIDLIST, LPDATAOBJECT, HKEY);
STDMETHOD(GetCommandString)(UINT_PTR, UINT, UINT*, LPSTR, UINT);
STDMETHOD(InvokeCommand)(LPCMINVOKECOMMANDINFO);
STDMETHOD(QueryContextMenu)(HMENU, UINT, UINT, UINT, UINT); and in cpp file write their definitions.
All can be compiled, but the Explorer didn't load the DLL at all. And i tried using regsvr32.exe to register it, it is successful. But explorer is still didn't load the DLL, why??
I wrote nothing but "::MessageBox(NULL,NULL,NULL,MB_OK); return E_INVALIDARG:" in all function, but whenever i right click the mouse, no message box showed.
Enemy down! Go go go!
|
|
|
|
|
This trouble is already fixed, but why couldn't i use the Dll in this project, i mean invoke another dll's function in this project, it will show that:
Linking...
Creating library x64\Debug\PWContext.lib and object x64 Debug\PWContext.exp
Embedding manifest...
Registering output...
Project : error PRJ0050: Failed to register output. Please ensure you have the appropriate permissions to modify the registry.
And i am just logon as administrator and can modify the registry! Who can help me?
|
|
|
|
|
Fixed!
|
|
|
|
|
Hi all,
I am using an activex control which is registered under regsvr32. I created an MFC-dialog based aplication.I added activex control to the dialog box. And created a member-variable for the activex control thru class wizard.The member variable is m_myportcontroller.I called the activex method from a non-static member function of the dialog box using the member-variable as follows and worked fine.
ex:- void CSampleDlg::process(void)
{
m_myportcontroller.Close();
}
But i need to call the portcontroller methods from a static member function of a dialog based application (MFC).
ex:- static void CSampleDlg::process(void)
{
m_myporcontroller.Close(); // Not accessible because static function
}
Please send sample code of how to access the methods from static function. Very urgently needed.Early reply is appreciatable. Awaiting for the reply,
I had a problem in accessing Activex control methods from a static function
|
|
|
|
|
vanip wrote: But i need to call the portcontroller methods from a static member function of a dialog based application (MFC).
ex:- static void CSampleDlg::process(void)
{
m_myporcontroller.Close(); // Not accessible because static function
}
You have to create an instance of portcontroller inside the static method. That is how static methods work since they are not instance methods but class methods.
For eg:
static void CSampleDlg::process(void)
{
portcontroller pc;
pc.Close();
}
or
static void CSampleDlg::process(portcontroller& pc)
{
pc.Close();
}
vanip wrote: Please send sample code of how to access the methods from static function. Very urgently needed.
No.
Nibu thomas
Software Developer
|
|
|
|
|
Thanks nibu thomas,
I tried this way. But getting run time assertion error.
Any other way??
|
|
|
|
|
Static member functions do not have the this pointer. So they cannot access nonstatic class member data.
In your case m_myportcontroller is declared as a non static data member.
Vini
|
|
|
|
|
Why does the function have to be static? Some kind of callback?
A lot of callbacks takes a LPVOID parameter which can be used to provide the this-pointer and in the static member function type cast it so that it's possible to access non-static member variables and functions.
--
Roger
It's supposed to be hard, otherwise anybody could do it!
|
|
|
|
|
Thanks vinaya,
How to make that static?
I tried keeping static keyword in front of CPortController m_myportcontroller. But i am getting linker error. Do you know how to make that member as static??
|
|
|
|
|
Thanks Roger,
The function is to be static because, i am calling this process function in a thread. How to pass the LPVOID parameter to this process function??
|
|
|
|