|
If you just want to be able to set the font point size, use CreatePointFont(), it requires a handle to the device context....
CWindowDC dc(this);
CFont font;
font.CreatePointFont(120, "Times New Roman", &dc); //Creates 12 point Times New Roman Font
//The first value passed to the function should be 10x the point size you want.
|
|
|
|
|
How can I retrive and/or set NUM LOCK key state ???
Celebrate Mr. Cesilko!
|
|
|
|
|
GetKeyState or GetKeyboardState. The former gets the state of an individual key while the later gets the state for all.
|
|
|
|
|
I need to be able to use the ON_COMMAND_UPDATE_UI macro in a dialog. I was helpfully pointed to the WM_KICKIDLE private message and I have investigated how this works and what I need to do.
I have a class which inherits from CDialog to implement some common functionality across the dialogs I'll be using in my app. It includes changing the font for controls (a separate issue!) and enabling the handling described above.
Unfortunately it's not happening I have ON_MESSAGE(WM_KICKIDLE, OnKickIdle) in the message map and a LRESULT CMyDialog::OnKickIdle(WPARAM wp, LPARAM lp) function and there is an afx_msg LRESULT OnKickIdle(WPARAM wp, LPARAM lp); defined in the header file.
Using Spy++ I can see that the WM_KICKIDLE message is being posted for a standard CDialog-derived class that doens't include the handling, but it isn't being posted for my classes that derive from CMyDialog
Any thoughts?
|
|
|
|
|
I believe you need to call the following function in KickIdle
UpdateDialogControls(this, FALSE);
Christian
#include "std_disclaimer.h"
The careful application of terror is also a form of communication.
Eagles may soar, but weasels don't get sucked into jet engines.
|
|
|
|
|
I thought I'd found the problem having read an article at Earthweb. It seems that the process falls apart for modeless dialogs.
Apparently you are supposed to handle WM_KICKIDLE in the parent and manually post it to any child dialogs.
Unfortunately I've tried this and using Spy++ I can see that the dialogs are receiving the posted messages, but my code isn't handling them. My OnKickIdle function never gets called
|
|
|
|
|
WM_KICKIDLE shouldn't be used any more from memory. Instead use WM_IDLEUPDATECMDUI and call UpdateDialogControls() from your message handler.
I do this in ED4W and it all works very well.
Neville Franks, Author of ED for Windows
www.getsoft.com
|
|
|
|
|
Thanks. I'll try that instead
|
|
|
|
|
I've made the change to WM_IDLE_UPDATECMDUI but it's still not working. The dialgo is receiving the messages (as seen in Spy++), but the message handler isn't being called.
|
|
|
|
|
You may need to add a message handler to your CMainFrame class as well. I can't check my code right now I'm afraid, but I will and let you know.
In the mean time go to MSDN and do a search on WM_IDLEUPDATECMDUI
I can assure you it works.
Neville Franks, Author of ED for Windows. Version 4.01 just released, with a C++ Class View that actually works.
www.getsoft.com
|
|
|
|
|
My application is entirely dialog-based.
|
|
|
|
|
Maybe MFC sample DLGCBR32 will help? It demonstrates the dialog-based app with a toolbar. It uses WM_IDLEUPDATECMDUI and ON_UPDATE_COMMAND_UI handlers.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Help! This is sort of related your problem of a window receiving a message but not processing it. The message maps I created for the class inherited from CView don't work.
The COpenGLView class I describe below is the toplevel window when the application is run. I know that the window receives the message I send it from another application because I monitor the messages sent to that window using Spy++. But it doesn't seem to be processing that message I send it, even though it receives the message...
help... i'm at wits' end. thanks.
<br />
<br />
#define UM_MYMESSAGE WM_USER + 1<br />
...<br />
class COpenGLView : public CView<br />
{<br />
... <br />
DECLARE_DYNCREATE(COpenGLView) <br />
DECLARE_MESSAGE_MAP()<br />
... <br />
void OnMyMessage (WPARAM wParam, LPARAM lParam );<br />
...<br />
}<br />
<br />
#include "OpenGLView.h"<br />
<br />
BEGIN_MESSAGE_MAP(COpenGLView, CView) <br />
ON_MESSAGE( UM_MYMESSAGE, OnMyMessage )<br />
END_MESSAGE_MAP()<br />
<br />
...<br />
<br />
void COpenGLView::OnMyMessage (WPARAM wParam, LPARAM lParam )<br />
{ <br />
::MessageBox( NULL, _T("Hi"), _T("Hi"), MB_OK);<br />
}<br />
<br />
<br />
#define UM_MYMESSAGE WM_USER + 1<br />
...<br />
<br />
void CMyDialog::OnButtonFoo() <br />
{ <br />
HWND hwnd_lh = ::FindWindow( NULL, _T("OpenGL") );
::SendMessage( hwnd_lh, UM_MYMESSAGE, (WPARAM) NULL, (LPARAM) NULL );<br />
}<br />
|
|
|
|
|
I can't see how COpenGLView can be your top level window. This is a view within your MainFrame. It would seem to me that your other app is sending to the MainFrame window not the View.
Neville Franks, Author of ED for Windows
www.getsoft.com
|
|
|
|
|
ooops, you're completely right. i should have my wrists slapped for not taking the time out to really understand the document/view architecture. i am now rerouting the message to COpenGLView, which is a child of the the mainframe window. thanks.
|
|
|
|
|
Thanks for everyone's help with this one. Finally it works
The end result was to handle WM_KICKIDLE , as my parent dialog wasn't receiving any WM_IDLEUPDATECMDUI messages. I then had to use SendMessage to pass the message on to all of the child dialogs because PostMessage didn't work.
|
|
|
|
|
Hi,
I'm a begginer in C++ and I've a problem allocating memory on the heap and I'd really appreciate if somebody could help me.
Here's the code:
MyStructure *pMyStructure = new MyStructure[ELEMENTS];
// Do some code here
delete [] MyStructure
Where MyStructure is a structure I've created and I want an array of it.
The problem is when I try to delete the structure, I get some messages like that:
Expression:_BLOCK_TYPE_IS_VALID(pHead->nBlockUse)
I don't understand what is happening and what I'm doing wrong. Could anybody tell it to me?
|
|
|
|
|
Hi again,
Since I posted the message I've found what was happening:
MyStructure *pMyStructure = new MyStructure[ELEMENTS];
// Do some code here
delete [] MyStructure;
What whas happening is that somewhere in
//Do some code here
I had a loop where I increased pMyStructure (pMyStructure++) to access the elements of the array. I've found that if before deleting the array I decrease the pointer until it's initial value, I can delete it without any error.
What I'd like to know is why it happens and if I'm doing right accessing the array that way.
Thanks in advance,
|
|
|
|
|
the problem is that a pointer is just a number. there's nothing else to it. and when you change its value, it no longer points to the same thing.
but when you delete something, the pointer you're deleting must point to the start of the block of memory that was actually allocated - which it probably won't be, if you've changed the pointer's value.
so, do something like:
MyStructure *pMyStructure = new MyStructure[ELEMENTS];
MyStructure *pCur = pMyStructure;
pCur++;... whatever you want.
delete [] MyStructure;
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
Thanks, I've understand it!
|
|
|
|
|
I would like to know how i could use in ADO, the method Item or GetItem, when i don't want to specify the name of the field i need but its index
How could i do that?
thanks in advance
gerald
|
|
|
|
|
Because of the pace of work I get very little chance to look at this discussion group but it's one of the single most useful resorces on the Net and has never let me down.
Does anyone know if there is any CD archive of the past threads or are there any plans to capture one. I would be willing to pay for such a service and I'm sure many others would be as well. I don't mean any fancy searchable database or anything like that - just a copy of the whole discussion group. It would be one of the most valuable resources for me.
Have Fun!
|
|
|
|
|
It'd be better to post this message in th Suggestions Forum, so Chris can see it
|
|
|
|
|
i am making an app using the CFtpConnection and CInternetSession classes.
when i try to connect (or any ther action to the server), my program freezes, the window is not refreshed, how can i solve this? by creating a new thread? if yes than who do i do that?
and another quastion: on my dialog i have a TListCtrl wich shows the files on the server, how can i extract their icons fot the display?
thanks
|
|
|
|
|
Hello
How can i inseret different font color lines to a TRichEdit?
some code will be great!
thanks
|
|
|
|