|
DeleteFile first
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
As Papa says, you have to delete the old file first.
However, if it happens that the old file is in use or can't be deleted for some other reason, you'll have to tinker with Wininit.ini so that it gets replaced on reboot.
Helpful MSDN article[^]
Sometimes I feel like I'm a USB printer in a parallel universe.
|
|
|
|
|
I am working on a small graphics problem at the moment. At the time it runs, no windows for my application have been created, but I need to generate some disabled bitmap images.
To do this I do:
CDC dc;
dc.Attach(::GetDC(NULL)); // get screen DC
CBitmap bmp;
bmp.CreateCompatibleBitmap(&dc, x, y);
...
::ReleaseDC(NULL, dc.Detach());
The problem is the CreateCompatibleDC() function always returns a monochrome bitmap. I would have thought that on a screen display running in 32-bit colour the compatible bitmap should be in the same colour depth. Anyone any idea how to solve the problem? Its the bottle neck on my current project.
|
|
|
|
|
This is what I've been using with no problems (it is a service application)...
<br />
CDC oMemDC;<br />
CBitmap *pOldBmp;<br />
CBitmap oBmp;<br />
<br />
long lWidth = 300;<br />
long lHeight = 200;<br />
pCallContextObj->GetParameterValue("ChartWidth",&lWidth);<br />
pCallContextObj->GetParameterValue("ChartHeight",&lHeight);<br />
<br />
CRect oBmpSize(0,0,lWidth,lHeight);<br />
<br />
oMemDC.CreateCompatibleDC(NULL);<br />
int iOldMapMode = oMemDC.SetMapMode(MM_TEXT);<br />
<br />
CWindowDC dcScreen(NULL);<br />
<br />
oBmp.CreateCompatibleBitmap(&dcScreen,oBmpSize.Width(), oBmpSize.Height());<br />
<br />
pOldBmp = oMemDC.SelectObject(&oBmp);<br />
<br />
WORD wChartType = 88;<br />
pCallContextObj->GetParameterValue("ChartType",&wChartType);<br />
<br />
<br />
....<br />
....<br />
<br />
oMemDC.SetMapMode(iOldMapMode);<br />
oMemDC.SelectObject(pOldBmp);<br />
<br />
oMemDC.DeleteDC();<br />
<br />
onwards and upwards...
|
|
|
|
|
That looks like a possible solution. I will give it a try.
|
|
|
|
|
Cheers,
with a little modification, and hunting, I got the problem sorted using some of your suggestions.
Thank you.
|
|
|
|
|
Glad I could help
onwards and upwards...
|
|
|
|
|
If you use a DIBSection, you can specify whatever colour depth you like, independant of the screen. There is a DIBSection wrapper on CP, written by Chris Maunder.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Hello, I've been working on this program and I recently tested it with rational purify for memory leaks, only to find that gethostname() always results in the above mentioned message:
<br />
Array bounds write in WideCharToMultiByte<br />
The code is working, and I've tested it with other people's code who use gethostname, it is always the same.
Any ideas?
Have no fear of perfection - You will never reach it
|
|
|
|
|
i don't know if it is possible .. but if someone has any idea about how this can B done .. please respond to this..
G_Bela
|
|
|
|
|
Don't you mean Task Manager? Program Manager is a hold-over from Windows' early days.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
yes.. i gues then it's Task Manager..
but the same question still stands without beeing answered to.
G_bela
|
|
|
|
|
I don't believe that services show up in the Task Manager list. I've never tried it, so it's a guess at best.
This page might help.
Read the comments here.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I think they does
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Services indeed do show up in the list. I think there's no way to actually hide something from the process list, although you can hide it from the close tab (when it's a service). Your best bet might be to give the program a fake name or something....
|
|
|
|
|
API hooking techniques are quite wonderfull you know
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
I have the code below:
/////////////////////////////////////////////////////
CFont font;
LOGFONT lf;
memset(&lf, 0, sizeof(LOGFONT));
lf.lfHeight = 12;
strcpy(lf.lfFaceName, "Arial");
VERIFY(font.CreateFontIndirect(&lf));
SetDlgItemInt(IDC_EDIT1, X, TRUE);
////////////////////////////////////////////////////
I want to apply the new font to the value X when I call SetDlgItemInt() above. I dont know how to do it. Can someone help?
Jerry
|
|
|
|
|
Assuming the code you've shown is in the OnInitDialog() method, it will not work because the CFont object must exist as long as the edit box itself. Therefore, the CFont object must be a member variable of the dialog.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Change
CFont font
to be a member variable
CFont m_font
Then do something like this
CWnd* pWnd = GetDlgItem(IDC_EDIT1);
pWnd->SetFont(&m_font);
NOTE: m_font needs to be there for the duration of the edit box.
Ant.
|
|
|
|
|
I have inserted a menu in a dialog box, and added some
ON_UPDATE_COMMAND_UI in the dialogbox messagemap, so that some menu
options are disabled/enabled depending of the application state.
When i open the menu, my CCmdUI handler is not called, the result is
that all options stay enabled.
I known that in an standard document/view application, the mainframe
calls these CCmdUI handlers during idle time. How to make it work in a
dialogbox application ?
JPG
|
|
|
|
|
why would it have a difference between dialog menus and others ?
CMenu* pMenu;
<font style="color:blue;">if </font>(pMenu = GetMenu()) {
pMenu->EnableMenuItem(ID_MENU_ITEM1, MF_GRAYED); <font style="color:green;">
pMenu->EnableMenuItem(ID_MENU_ITEM2, MF_ENABLED); <font style="color:green;">
}
is that ok for you ?
TOXCCT >>> GEII power
|
|
|
|
|
Indeed i could write a function that would do all the required EnableMenuItem,
and call that function everytime i know some menu options have to be updated.
But the goal is to let the MFC code do it automatically, so that i just have to
write some ON_UPDATE_COMMAND_UI in the messagemap and the corresponding message
handlers.
JPG
|
|
|
|
|
got answer on that page :
http://support.microsoft.com/default.aspx?scid=kb;en-us;242577
JPG
|
|
|
|
|
I have a SDI with splitters that look like this:
________________
| | |
|View| |
|Tree|ViewList | (fig. 1)
| | |
| | |
|____|__________|
and I am trying to make a second View (Frame) with splitters that look like this:
____________________
|*****|*View 2******|
| |_____________|
| | | |
|V1 | | |
| |V3 | View 4 | (fig. 2)
| | | |
| | | |
|_____|____|________|
The 1. question: How can I switch between the frames (Views)?
The 2. question: How can I create the 2. frame with splitter to look as shown (fig. 2).
It is important for the first version, that I can switch between to frames. Maybe it is easier to make the second frame like this (no Splitter in a splitter –fig. 3):
__________________
|V 1 | view2 |
|_____|___________|
|View | | (fig. 3)
| 3 |View 4 |
| | |
| | |
|_____|___________|
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, <br />
CCreateContext* pContext) <br />
{<br />
if (!m_wndSplitter.CreateStatic(this,1,2))<br />
{<br />
return FALSE;<br />
}<br />
CRect rect;<br />
GetClientRect(&rect);<br />
CSize sizeTree = rect.Size();<br />
<br />
sizeTree.cx = rect.Width()/4; <br />
<br />
if (!m_wndSplitter.CreateView(PANE_ROW_ZERO, eTreeWinPane, RUNTIME_CLASS(CViewTree),<br />
sizeTree, pContext)|| <br />
(!m_wndSplitter.CreateView(PANE_ROW_ZERO, eListWinPane, RUNTIME_CLASS(CViewList),<br />
CSize(100,100), pContext)))<br />
{ <br />
return FALSE;<br />
}<br />
return TRUE;<br />
}<br />
Must I use OnCreateClient()function, or there is an alternative?
Thanx in advance,
Nadin_sam
|
|
|
|
|