|
Hi.
Thanks for your reply. It is indeed the WM_SETFONT message. I am using WTL 7.0 so I could do it with SetFont() .
One queston which I would like to ask is, How do I change the Height of an Edit Control? Well, I am using SetWindowPos , but the height is not being set accoring to what I give the SetWindowPos function. Does the Edit Control have any other means by which its height can be changed? Also you may be thinking that the height of the control will not be smaller than the height of the font. Let me assure you that I have changed the height of the font using the SetFont() method.
Any suggestions?
---
With best regards,
A Manchester United Fan
The Genius of a true fool is that he can mess up a foolproof plan!
|
|
|
|
|
SetWindowPos should work just fine. e.g.
::SetWindowPos(hWnd, NULL, 0, 0, 100, 100, SWP_NOZORDER|SWP_NOMOVE);
Steve
|
|
|
|
|
Hi Stephen.
Stephen Hewitt wrote: SetWindowPos should work just fine. e.g.
Well, SetWindowPos is not doing the Trick. That's why I asked!
---
With best regards,
A Manchester United Fan
The Genius of a true fool is that he can mess up a foolproof plan!
|
|
|
|
|
Did you:
1. Pass the correct window handle. To check you can do something like call GetWindowText with the HWND and make sure its the correct control; or you could use Spy++.
2. Did you pass the correct flags to SetWindowPos ?
Steve
|
|
|
|
|
Hey Stephen,
I am sure you aren't gonna believe this but I have been a #$%^#$ Ass . I wasted one whole day trying to figure out why SetWindowPos is not working and I found the culprit. The culprit is ME. Instead of passing the Height and Width to the SetWindowPos function I was actually passing the position for the right and bottom corners of the control relative to the Left and top positions.
It was something like, if the top of the control is 20 then to get a height of 20, I was passing Top+20 to the Height argument. How silly of me.
Anyways, thanks a lot for your support. I really appreciate it.
Thanks once again.
---
With best regards,
A Manchester United Fan
The Genius of a true fool is that he can mess up a foolproof plan!
|
|
|
|
|
I want to apply HTML hooking from my ATL project.
I seen articles from MFC examples,
i don't know how to use them in ATL.
If someone has idea then please reply.
|
|
|
|
|
What do you mean by "HTML hooking"?
Steve
|
|
|
|
|
IE events and/or javascript?
--
100% natural. No superstitious additives.
|
|
|
|
|
This is probably a dumb question, but I will ask it anyway:->
In my app I am running two threads, the main GUI thread and a data gathering thread. In the application object I have a std::queue object that I am using for data entry. The gathering thread pushes objects into the queue and the the main GUI thread reads and pops the same objects off the queue. My question is do I have to synchronise access to the queue using a critical section or is it perfectly safe to push on one end and pop off the other without worrying about synchronzation? I ask because I want the data gathering thread to be able to run as fast as possible, without having to wait on a critical section while the main thread does it's data accessing.
#define WMU_NEWDATA WM_APP + 0
#typedef std::queue<CMyDataClass> DataQueue;
class CMyApp : public CWinApp
{
...
DataQueue InputQueue;
...
};
extern CMyApp theApp
...
CMyDataClass InputData;
...
...
theApp.InputQueue.push(InputData);
theApp.m_pMainWnd->PostMessage(WMU_NEWDATA, 0, 0);
...
LRESULT CMainFrame::OnNewData(WPARAM, LPARAM)
{
while (!theApp.InputQueue.empty())
{
CMyDataClass NewData = theApp.InputQueue.front();
theApp.InputQueue.pop();
}
}
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
Never mind, I tried it and gave my app a good rush of data and it crashed and burned. The critical section seems to be a necessity after all.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
If the data item's small enough, can you pass it in the LPARAM/WPARAM of the message? Or, alternatively, new it in the data gathering thread and use/delete in the GUI thread.
Not using shared state is always the best way of doing concurrency - message passing, a la Erlang, is much less likely to break horribly
|
|
|
|
|
The only problem I have with passing messages is the size of the message queue. On windows 2000/XP it is limited to 10000 messages. Not that it is likely to happen often, but if that limit gets hit then I would start to run into other problems such as memory leaks and lost data. By using a custom queue I hope to avoid those problems.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
Yeah, I'd have to agree about filling up a message queue - I've managed it when using a worker thread to update UI (a ProgressBar, using PostMessage) directly - had to reduce the update rate.
You're probably OK using critical sections anyway, so long as you're not sampling too quickly - I've got code that samples at something around 1ms (and does lot's of other stuff as well) that works perfectly OK. Just make sure you haven't got hard real-time requirements, 'cause Windows can't do that reliably.
|
|
|
|
|
Maybe you're past this issue PJ, but anyway....
I frequently use std::queue when sending/receiving/sampling data and I've found synchronisation necessary.
I usually use smart pointers with reference counting as queued elements since it takes care of memory leaks. I also think it's a good design since it encapsulates the data object without the need for memory reallocation which is expensive regarding speed performance.
Every time you push/pop an CMyDataClass object to/from your queue, all members have to be copied and perhaps reallocated depending on your CMyDataClass copy contructor and assignment operator. This could be a greater bottleneck than synchronisation. You can use smart pointers instead to speed things up.
Also consider having two queues in order to disturb the data gathering as little as possible.
Have a second worker thread waiting for a semaphore to be released when new data arrives in the first queue and copy one element at a time from the first queue to the second queue.
Your main thread could periodically empty the second queue having it locked without disturbing the data gathering thread.
I've used this technique with great success from time to time. Hope it helps in your situation.
--
Roger
It's supposed to be hard, otherwise anybody could do it!
Regarding CodeProject: "resistance is pointless; you will be assimilated"
|
|
|
|
|
I start a WTL project in visual studio 2005, select "create as a COM Server", then after Wizard finish its job, I select "Add Class", "ATL Simple Object", but a exception dialog occurs, say"ATL classes can only be added MFC EXE and MFC DLL projects or projects with full ATL support". So I want to ask what happens about this? Is ATL 8.0 crazy? If I want to add a ATL COM Object, what can I do?
|
|
|
|
|
Hi,
I have written a plugin to IE successfully. Now I want my Plugin can get the Request and Response object when IE visit the page "http://myURL".
Thanks for your help,
Hung
|
|
|
|
|
I used a table named FDetails with 4 text fields and a datetime field named date in MSaccess
when insert values into table ising ado recordset obj I receive some syntax error
recordset->Open("INSERT INTO FDetails(name,path,duration,volume,date) VALUES('hello','location','duration','vol','12/12/2000')",connection.GetInterfacePtr(), ADODB::adOpenForwardOnly,ADODB::adLockReadOnly, ADODB::adCmdText);
any one know inserting date into table
|
|
|
|
|
'Date' is a reserved word in MS Access Try changing the column name 'Date' to 'Date1'
cheers.. Milton KB
|
|
|
|
|
inserting problem is over but now while retvieve the date I got no. of days form 1900 to till date &time in mill or micro sec.
how to get the time in mm/dd/yyyy hh:mm:ss format
|
|
|
|
|
use the Format function in the select statement:
eg:
select Format (#date1#, "Short Date") from ur_table //would return '17/04/2004'
select Format (#date1#, "Long Date") from ur_table //would return 'April 17, 2004'
select Format (#date1#, "yyyy/mm/dd") from ur_table //would return '2004/04/17'
go thru http://www.techonthenet.com/access/functions/date/format.php[^]
for more details.
cheers....Milton KB
|
|
|
|
|
|
Hi all,
I've got a windowless ActiveX control written in ATL. I've been asked to use it to capture a users key input with regards to the F1 button. The idea seemed easy, just use PreTranslateAccelerator. Unfortunately, nothing is coming through either that or any other of the handling functions I've tried. I'm assuming now I have to register with IE somehow to get them working.
Any help on the matter would be very helpful as I'm very new to the whole ATL setup.
Thanks.
Tom
|
|
|
|
|
How are you hosting the ActiveX control? IOleInPlaceActiveObject::TranslateAccelerator is called by the host's message loop: if you're done your own hosting the message pump may have been constructed incorrectly. IOleInPlaceObjectWindowless::OnWindowMessage is another method you may want to look at.
Steve
|
|
|
|
|
Thanks for the response Steve.
The control is embedded in and HTML OBJECT tag if that's what you mean by "hosting". Because it's a windowless control I fear my control may not have the same message pump functionality as a control with a window on which the message pump can be based.
When overriding a method such as IOleInPlaceActiveObject::TranslateAccelerator is there anything else apart from entering its decleration in the header and the implimetation in the cpp to address?
Thanks again
Tom
|
|
|
|
|
So are you hosting the web browser control or using IE? If you're hosting the web browser control there could still be problems with your message pump.
Steve
|
|
|
|