|
I've never seen this problem. It could be the default checkbox image list is very wide or something; doesn't seem likely, but still, you could try setting a different state image list right off & see if that fixes the problem.
---
Shog9
If I could sleep forever, I could forget about everything...
|
|
|
|
|
>>1. How am I going to change the color of view in SDI from white to
something like black?
Use SetClassLong to change background color (GCL_HBRBACKGROUND)
>>2. How am i going to add another view in SDI?..do i have to change everything to MDI?
Not at all. Just add new class, derived from CDocTemplate and create it's instance in CYourApp::InitInstance like that
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CTestDoc),
RUNTIME_CLASS(CMainFrame),
RUNTIME_CLASS(CTestView));
AddDocTemplate(pDocTemplate);
|
|
|
|
|
Roman Fadeyev wrote:
Not at all. Just add new class, derived from CDocTemplate and create it's instance in CYourApp::InitInstance like that
Is this means doing something like this? (I've add a COutputView class derived from CView)
BOOL CPSMZayaxApp::InitInstance()<br />
{<br />
...<br />
CSingleDocTemplate* pDocTemplate;<br />
pDocTemplate = new CSingleDocTemplate(<br />
IDR_MAINFRAME,<br />
RUNTIME_CLASS(CPSMZayaxDoc),<br />
RUNTIME_CLASS(CMainFrame),
RUNTIME_CLASS(CPSMZayaxView));
<br />
CSingleDocTemplate* pDocTemplate2;<br />
pDocTemplate2 = new CSingleDocTemplate(<br />
IDR_MAINFRAME,<br />
RUNTIME_CLASS(CPSMZayaxDoc),<br />
RUNTIME_CLASS(CMainFrame),
RUNTIME_CLASS(COutputView));
AddDocTemplate(pDocTemplate2);<br />
...<br />
}
When I execute the program, VC++ ask me to choose between the two view. How am I going to know which view is being displayed? How can I change from one view to another when the program was running? maybe this sound stupid but there was no minimize button to minimize one view and see the other like in the MDI I wish to init this view when I click a button on a DialogBox. What should I do?
Newbies
|
|
|
|
|
1. Override the views WM_ERASEBKGND message and paint with a black brush and then return TRUE.
2. I think you can do this without going to MDI. SDI means 1 document, not 1 view. Create a new view type like your first and add a document template for it. You should then be able to create instances of that view for your document as well. Although I don;t have all the code here for an example.
3. Not sure a width of 0 is valid. As far as I know 1 is the minimum pen width. You can probably get around the scaling issue by using the window mapping functions. Take a look at the MSDN for SetViewPortExt() and go from there.
4. Once again, you can set the display mapping mode to reflect this. See 3.
Roger Allen
Sonork 100.10016
I think I need a new quote, I am on the prowl, so look out for a soft cute furry looking animal, which is really a Hippo in disguise. Its probably me.
|
|
|
|
|
1. Override the views WM_ERASEBKGND message and paint with a black brush and then return TRUE
If you will use WM_ERASEBKGND, it can result to a blinking whilst Window resizing. It is better way to change background brush in WindowClass properties.
|
|
|
|
|
Roman Fadeyev wrote:
If you will use WM_ERASEBKGND, it can result to a blinking whilst Window resizing.
No, if you handle WM_ERASEBKGND yourselft, the window class brush is not used.
Tomasz Sowinski -- http://www.shooltz.com
Never argue with an idiot, he'll bring you to his level and beat you with experience.
|
|
|
|
|
Tomasz Sowinski wrote:
No, if you handle WM_ERASEBKGND yourselft, the window class brush is not used.
I beg pardon, I was mistaken
I tested example below, all OK. Hmmmm, strangely...
BOOL CTestView::OnEraseBkgnd(CDC* pDC)
{
CRect rect;
pDC->GetClipBox(&rect);
pDC->PatBlt(rect.left, rect.top, rect.Width(), rect.Height(),
BLACKNESS);
return true;
}
|
|
|
|
|
As long as you don't go into ::DefWindowProc, the class brush remains unused. And it doesn't matter what you're returning from OnEraseBkgnd.
Tomasz Sowinski -- http://www.shooltz.com
Never argue with an idiot, he'll bring you to his level and beat you with experience.
|
|
|
|
|
Thank you very much guys. The black screen work just fine
Newbies
|
|
|
|
|
Roger Allen wrote:
Take a look at the MSDN for SetViewPortExt() and go from there.
From what what I've read, if I want to be able to scale, I have to use SetWindowExtent and SetViewportExtent functions. But when using the SetWindowExtent and SetViewportExtent, only two mapping modes are allowed : MM_ISOTROPIC and MM_ANISOTROPIC. The best part was both mapping mode have y going downward. I've tried using negative values in my y axis coordinate input so that my line will be drawn upward but I can't find my line anywhere.
Anyone has any idea?
Newbies
|
|
|
|
|
Whats the best method to select an Item in the list control. I can't seem to get it to work.
I've used SetSelectionMark and SetItemState both don't work. Theres some flickering but the items background colour does not change.
Am i missing something? is there another message I have to send?
Cheers
Asim Hussain
e: asim@jawache.net
w: www.jawache.net
|
|
|
|
|
list.SetItemState(itemIndex, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
Tomasz Sowinski -- http://www.shooltz.com
Never argue with an idiot, he'll bring you to his level and beat you with experience.
|
|
|
|
|
Excellent...
That worked a treat.
Thanks
Asim Hussain
e: asim@jawache.net
w: www.jawache.net
|
|
|
|
|
In addition to what Tomasz said:
You may also need to set the focus to the control to get he blue selection bar, or make sure that the "Show selection always" option is on in the resource editor.
Roger Allen
Sonork 100.10016
I think I need a new quote, I am on the prowl, so look out for a soft cute furry looking animal, which is really a Hippo in disguise. Its probably me.
|
|
|
|
|
How can I set environment variables automatically (e.g. using bat file) without going in Control Panel -> System Properties -> Environment and adding them manually?
Thanks,
Michael
|
|
|
|
|
did you try ::SetEnvironmentVariable ?
-=c
"To announce that there must be no criticism of the president, or that we are to stand by the president right or wrong, is not only unpatriotic and servile, but is morally treasonable to the American public."
-- Theodore Roosevelt
|
|
|
|
|
I think, Michael wants to create constant environment variable, whereas ::SetEnvironmentVariable works only for the current process.
|
|
|
|
|
if you say so...
"To announce that there must be no criticism of the president, or that we are to stand by the president right or wrong, is not only unpatriotic and servile, but is morally treasonable to the American public."
-- Theodore Roosevelt
|
|
|
|
|
MSDN says
HOWTO: Propagating Environment Variables to the System
ID: Q104011
The information in this article applies to:
SUMMARY
You can modify user environment variables by editing the following Registry key:
HKEY_CURRENT_USER \
Environment
You can modify system environment variables by editing the following Registry key:
HKEY_LOCAL_MACHINE \
SYSTEM \
CurrentControlSet \
Control \
Session Manager \
Environment
Note that any environment variable that needs to be expanded (for example, when you use %SYSTEM%) must be stored in the registry as a REG_EXPAND_SZ registry value. Any values of type REG_SZ will not be expanded when read from the registry.
Note that RegEdit.exe does not have a way to add REG_EXPAND_SZ. Use RegEdt32.exe when editing these values manually.
However, note that modifications to the environment variables do not result in immediate change. For example, if you start another Command Prompt after making the changes, the environment variables will reflect the previous (not the current) values. The changes do not take effect until you log off and then log back on.
To effect these changes without having to log off, broadcast a WM_SETTINGCHANGE message to all windows in the system, so that any interested applications (such as Program Manager, Task Manager, Control Panel, and so forth) can perform an update.
MORE INFORMATION
For example, on Windows NT, the following code fragment should propagate the changes to the environment variables used in the Command Prompt:
SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0,
(LPARAM) "Environment", SMTO_ABORTIFHUNG,
5000, &dwReturnValue);
None of the applications that ship with Windows 95, including Program Manager and the shell, respond to this message. Thus, while this article can technically be implemented on Windows 95, there is no effect except to notify third-party applications. The only method of changing global environment variables on Windows 95 is to modify the autoexec.bat file and reboot.
Additional query words:
Keywords : kbNTOS350 kbNTOS351 kbNTOS400 kbSysSettings kbGrpUser
Issue type : kbhowto
Love MSDN and your life will get better
|
|
|
|
|
Roman Fadeyev wrote:
Love MSDN and your life will get better
It'll be at its best when you just provide KB article ID or link, without copying whole article into the message board.
Tomasz Sowinski -- http://www.shooltz.com
Never argue with an idiot, he'll bring you to his level and beat you with experience.
|
|
|
|
|
Tomasz Sowinski wrote:
It'll be at its best when you just provide KB article ID or link, without copying whole article into the message board.
laziness is engine of progress
by the way, Not such this article big!
|
|
|
|
|
how can I change the background color of a datetimectrl?
I don't talk about the MonthCalCtrl that's quite easy (MCM_SETCOLOR).I tried to override the function OnCtlColor(EditCtrl...) but it don't work. I also tried it by the wm_paint message itself no chance.
Has someone an idea and can help me?
|
|
|
|
|
Hi !
I am trying to use a list control inside a window, not a dialog, so I can resize it. I tried to create a class the inherit from CListCtrl and on it's instance to use the Create function:
CErrReport::CErrReport(CWnd *pParent)<br />
{<br />
Create (WS_OVERLAPPEDWINDOW|WS_HSCROLL|WS_VSCROLL,CRect (20,30,200,300),pParent,1);<br />
<br />
}
On the paret window I used :
CErrReport *perr=new CErrReport (this);<br />
perr->ShowWindow (SW_SHOWNORMAL);
But the problem is that when the window starts I can't even click on it or move it or close it, nothing.....
What am I doing wrong ?????????????????///
Please help me
Thank you
|
|
|
|
|
Why not use resizable dialogs?
Alberto
|
|
|
|
|
If I use a resizable dialog, then the dialog itself is resized but the control size is fixed, no ?
If I create a dialog based application, and I click on the maximize button, all the control remian in the original size they were created, is there a way to expand them to the size of the whole dialog frame ?
Thank you
Shay
|
|
|
|