|
There are some activeX controls on my dialog, and I want to get the ID of the activeX control that has the keyboard focus.
I use the function:
GetWindowsLong(::GetFocus(), GWL_ID),
But the return value is always 0.
I put the fuction GetLastErr() after it, but the return value is ERORR_SUCCESS.
Did I use the wrong fuction? And is there any other way to get the Id?
Thanks!
|
|
|
|
|
I have noticed that active-x are always created with id 0. Use Spy++ and check the ID.
|
|
|
|
|
Naveen.R wrote: I have noticed that active-x are always created with id 0. Use Spy++ and check the ID.
I don't believe this is reliable. Also note that ActiveX controls need not even have a window.
Steve
|
|
|
|
|
Stephen Hewitt wrote: I don't believe this is reliable
I just said my findings. If you show me a sample which have a active-x control id other than 0, I am ready to change the statement.
|
|
|
|
|
I inserted the “Microsoft Office Chart 10.0” control into the “ActiveX Control Test Container” then used "Spy++" to scope out the IDs -- no zeros to be seen! Your advice relies on implementation details of the controls in question.
Steve
|
|
|
|
|
Stephen Hewitt wrote: I inserted the “Microsoft Office Chart 10.0” control into the “ActiveX Control Test Container” then used "Spy++" to scope out the IDs
Ya u r right... Its an ATL active-x isnt it. when I chacked other ATL activex's, it also have have ID. But many other non ATL active x, the ID 0, like Calender,Micorsoft Form 2 controls( For those having windows ).
I have tried specifying the control id while creating the control. In such cases also Id is coming as 0. May be as you said its the implementation difference of control. But offcourse I think this is not under our control.
Do you think its the implementation differece of ATL Active X and MFC Active x?
|
|
|
|
|
Naveen.R wrote: Do you think its the implementation differece of ATL Active X and MFC Active x?
Both ATL's and MFC's hosting and control implentation details differ.
But this line of reasoning is missing the point: If you’re manipulating an ActiveX control you should manipulate it via the OLE control interfaces if possible and be weary of directly manipulating it’s window; windowless controls need not even have windows! One of the main goals of ActiveX control is to isolate clients of the implementation details of the control. ATL allows you to treat the control as a window but the window you manipulate is part of the hosting code and not part of the control: it handles messages and translates them into interface calls on the control. See the OnSize function in the "ATLHOST.H" file for an example.
Steve
|
|
|
|
|
Sorry I dont know much about ATL. May be we can focus on MFC..
What my doubt is that, when ever I create a MFC activex and add it to some applications, the control id is 0. Why this comes so? MFC ignores those ID's? ( Not only MFC activex but the activex like microsoft form 2 control also have same behavior )
|
|
|
|
|
The axtiveX I used was "Microsoft Forms 2.0 OptionButton", and I created it in the MFC application....
But in the Resource.h file the activeX control has the id which is not 0.
|
|
|
|
|
Can you tell me y u need the id of the control?
As i told earlier, that "Microsoft Forms 2.0 OptionButton" active x will be created with out an id. But MFC internally keeps the id of the control. check the COleControlSite::FindItem function() for more details.
|
|
|
|
|
hi,
i have created a new desktop and i successfully switched in to that destop. But any of windows shortcuts not working on my new desktop.ie, if i press Ctrl+Alt+Del the taskmanager executes on default desktop.
how can i solve this problem ? some one please help me.
Thanks & Regards
|
|
|
|
|
Great to hear that you've created your own desktop. Now you need to create your own Operating System.
All the best.
Sreedhar DV
[Real success is having courage to meet failure without being defeated.]
|
|
|
|
|
Hi, I have Two bmp file . Now I want to write A custom Programme so that
I can overlay One bitmap over other and save it to the file.
I try using VIDEOINFOHEADER . but cannot actually proceed how to
overlay one bitmap over other .
Trioum
|
|
|
|
|
Do you want to write a bmp on the other bmp file?
|
|
|
|
|
yes I want to overlay one bmp over other .
Trioum
|
|
|
|
|
Check this code
CImage m_File1,m_File2,mm;
CDC dc;
CBitmap bmp;
m_File1.Load(_T("c:\\1.bmp"));
m_File2.Load(_T("c:\\2.bmp"));
dc.CreateCompatibleDC(GetDC());
dc.FillSolidRect(CRect(0,0,800,600),RGB(53,97,200));
bmp.CreateCompatibleBitmap(GetDC(),800,600);
dc.SelectObject(bmp);
m_File1.BitBlt(dc.m_hDC,0,0,800,600,0,0,SRCCOPY);
m_File2.BitBlt(dc.m_hDC,150,150,800,600,0,0,SRCCOPY);
mm.Attach((HBITMAP)bmp.m_hObject);
mm.Save(_T("E:\\123.bmp"));
m_File2.Detach();
m_File1.Detach();
mm.Detach();
bmp.DeleteObject();
dc.DeleteDC();
|
|
|
|
|
Hamid. wrote: m_File2.Detach();
m_File1.Detach();
mm.Detach();
Nice memory leaks there
Those should be Destroy, not Detach.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
Hi Mark
you changed image on your profile;P.
|
|
|
|
|
Heh - no more filet-o-fish!
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
hi all
i m working on a project where i need to lock file so that it can not be accessed again till certain conditions are met. the "LockFile ()" comd of VC++ deals with locking only a few selected bytes, is there any other such comd or method to achive my requirement????
please guide
thanks
|
|
|
|
|
if you run this code what happens?
HANDLE handle;
DWORD m_Pos,m_NumberofFile=0;
handle=CreateFile(_T("e:\\1.bmp"),
GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
dwPos = SetFilePointer(handle, 0, NULL, FILE_END);
LockFile(handle, m_Pos, 0, m_NumberofFile, 0);
|
|
|
|
|
How to get the file properities programatically.For ex get the last visited time of a file.
|
|
|
|
|
VC++ provides a series of file functions, this is one of them, search for "file functions" in MSDN and choose function to meet your requirement...
all the best
|
|
|
|
|
You can use of FindFirstFile or GetFileAttributes .
|
|
|
|