|
How to gray the radio button?
mIchAel Liu
__________________________________________________________
The secret of business is to know something that nobody else knows.
|
|
|
|
|
Using Win32 SDK
BOOL EnableWindow(
HWND hWnd, // handle to window
BOOL bEnable // enable or disable input
);
|
|
|
|
|
Hello,
I am seeing some weird List View behaviors.. I am trying to resize all my columns when the window is re-sized.. When i make the window bigger the header resizes fine, when I make the window smaller the header still resizes fine but I get a scroll bar at the bottom of the view (every other time its sized smaller). If I click on the scroll bar it goes away (because it should never have been drawn).. Anyone seen this? Here is a snip of the WM_SIZE..
void CMyListView::OnSize(UINT nType, int cx, int cy)
{
GetListCtrl().SetColumnWidth(0,cx);
GetListCtrl().SetColumnWidth(1,0);
GetListCtrl().SetColumnWidth(2,0);
GetListCtrl().SetColumnWidth(3,0);
GetListCtrl().SetColumnWidth(4,0);
GetListCtrl().SetColumnWidth(5,0);
CListView::OnSize(nType, cx, cy);
}
|
|
|
|
|
Never mind, I tried doing the SetColumnWidth inside the MainFrame Size function.. and every thing works as expected.
|
|
|
|
|
I'm trying to draw a button in my active x control.
I just need simple button/text elements, so I thought I could just use the ResourceView->Dialog to add the components visually.
However, it seems I'm only able to create Dialogs, and I'm not able to add directly to the normal visual area of the active x control.
So... my question is how do I draw, say, a simple CButton in the OnDraw area of my control?
something like:
void CAChatCtrl::OnDraw(CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid)
{
CButton testButton = new Button();
CRect bBounds = new CRect( rcBounds->r - 30, rcBounds->b - 30, rcBounds->r, rcBounds->b );
testButton::Create("DrawnButon",BS_DEFPUSHBUTTON,bBounds,?,??);
}
Sorry about asking such an easy question
|
|
|
|
|
I need to change the background colour of a CButton? Is there any way to do it
a) without creating a new class?
b) if creating a new class, without owner-draw?
Thomas
modified 29-Aug-18 21:01pm.
|
|
|
|
|
chech out msdn article # Q132080 or # Q117778
"If at any time I announce that a nation or kingdom is to be uprooted, torn down and destroyed, and if that nation I warned repents of its evil, then I will relent and not inflict on it the disaster I had planned. And if at another time I announce that a nation or kingdom is to be built up and planted, and if it does evil in my sight and does not obey me, then I will reconsider the good I had intended to do for it." -- Jeremiah 18:7-10 (God, commenting on the value of the United Nations)
|
|
|
|
|
cannot find them on msdn.microsoft.com. have a link?
modified 29-Aug-18 21:01pm.
|
|
|
|
|
got it
modified 29-Aug-18 21:01pm.
|
|
|
|
|
Anybody know what's supposed to happen if you do this? I've got a project where it seems like both of these .dll's are present, and I seem to be getting a lot of heap warnings in the dbug build. I open up depends, and lo and behold, both of the runtimes are there.
I think I should be using the MSVCRTD alone, but it appears that the MSVCRT is getting loaded as a dependency of shell32.dll. I am calling SHGetFileInfo.
Is there a debug shell32.dll? If so, how do I get it instead of the release one?
Thanks,
Aaron
|
|
|
|
|
Is there an easy way to sort the contents of a CMenu in mfc ?
Thanks!
|
|
|
|
|
I have a class derived from CPropertyPage which contains a modeless dialog. On dialog creation I pass a client rect structure of the property page. I also handle OnSize() and OnShowWindow() in the property page class to resize/show/hide the dialog. But at startup this dialog is not correctly aligned in the property page. It is displayed beyond the property page's edges. If I move to another property page and then go back to the malicious one everything is fine. Anybode knows a solution for this....
The funny thing is that this bug happens only with Windows 98/ME - Windows 2000/XP is fine...
Gero
|
|
|
|
|
and I am using Windows 2000.
Anybody has any idea how to solve it? Thanks a lot!
|
|
|
|
|
The dialog is not properly aligned at the first time only, is because that the property sheet was moved after the first active property page was shown. This is the message handling sequence:
CMyPropertyPage::OnShowWindow()
{
}
CMyView::OnInitialUpdate()
{
m_sheet.MoveWindow(&sheetRect, TRUE);
}
so the solution is: reshow the property page after the property sheet is moved to a correct position. My method is:
CMyView::OnInitialUpdate()
{
m_sheet.MoveWindow(&sheetRect, TRUE);
m_sheet.GetActivePage()->SendMessage(WM_SHOWWINDOW, FALSE, 0);
m_sheet.GetActivePage()->SendMessage(WM_SHOWWINDOW, TRUE, 0);
}
HTH.
|
|
|
|
|
I'm trying to hook up to another program, using SetWindowsHookEx .
I need to hook to a specific application (ie: calc.exe) so a global hook shouldn't be neccecary.
HHOOK hook = SetWindowsHookEx(WH_MOUSE,
(HOOKPROC) MouseHookProc,
AfxGetInstanceHandle(),
tID
);
SetWindowsHookEx returns 0, the hook is set succesfully. Yet, when I move with my mouse over the calc dialog, the calculator crashes.
I think I need to use the Process instance of calc.exe instead of the instance of the program that hooks to it. If that is the case, how can I get the HINSTANCE of a process?
If that's not the case, what am I doing wrong?
Thanks in advance and kind regards,
Griffith
Everything you say will be misquoted, ripped out of context and used against you.
|
|
|
|
|
You gotta put the hook procedure in a dll that can be loaded by Calc.exe's process. Then pass SetWindowsHookEx the HINSTANCE for that dll as loaded into your process. (as well as the pointer to the hook procedure)
|
|
|
|
|
Okay, thanks I'll try that then.
Cheers
Griffith
Everything you say will be misquoted, ripped out of context and used against you.
|
|
|
|
|
A return of 0 means it didn't work. NULL = 0. Check the docs. As previously mentioned, the actual procedure needs to be in a dll.
Joel Lucsy (jjlucsy@concentric.net)
|
|
|
|
|
My mistake, I meant to say that GetLastError() returned 0, just after I attempted to create the hook.
I thought I had to place the procedure in a DLL only for system-wide hooks, but it appears it's in order for all hooks outside of the calling process.
Griffith
Everything you say will be misquoted, ripped out of context and used against you.
|
|
|
|
|
I added a cpp /.h file pair which has definitions of listcontrol derived class. I am supposed to associate a variable of this type with the listctrl on my view form. i.e. I should have the choice of making the variable either of type Clistctrl or Myclistctrl. In the sample project I can do that....both classes show up in CW. I included the .h file of the derived class in my view class. IN my project when I select the listctrl ID_LIST1 in CW, and try to associate it with a m_list, I can only make it of type Clistctrl, and not myCListCtrl. How do I get around this?
Thanks,
ns
|
|
|
|
|
When I have that problem I delete the clw file and then I call the classwizard. It will ask you the file that you want to add to it....
Regards
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
That was great! I was thinking I'd have to mess with messagemaps etc...
Many thanks,
ns
|
|
|
|
|
I have a modeless dialog that comes up before the main window (OnCreate()). when the Main Window comes up, my dialog loses focus. I want to be able regain focus initially to let the user view the data in the dialog, then let them do whatever(shut it down, hide, etc.)
BW
{insert witty/thought-provoking saying here}
|
|
|
|
|
You could create your modeless dialog in a different place like, OnInitDialog() for dialog app or at the end of CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) in a SDI or MDI. How are you creating your Modeless dialog?
I create mine like this..
/Display the Refresh Dialog Box
if (!::IsWindow(m_dMyModelessDlg.GetSafeHwnd()))
{
m_dMyModelessDlg.Create(IDD_MY_MODELESS, this);
m_dMyModelessDlg.ShowWindow(SW_SHOW);
}
|
|
|
|
|
I am optimising an application that relies on a utility function (two square a number) in a different source code file. In the particular case, the utility function is getting called 400 million times (which takes a while).
So essentially I have:
file1.cpp
..
get_square(num)
..
file2.cpp
double get_square(double a)
{
return a * a;
}
When I compile and link this, get_square() is not made inline. I am using a header file to declare function in file2.c.
file2.h
extern inline double get_square(double a);
Now the code still does not get inlined. If I move the function definition into the header file, then it is inlined.
Is this the correct way to do this? Should the function body be in the head file as well? What if the compiler does not decide to inline the code, won't I get problem on linking?
I understand how to use inline in source code files and class definitions, but how should it be used when I want to call functions in a different source code file?
|
|
|
|