|
you can have it deleted on system restart by using the MoveFileEx() function, with the MOVEFILE_DELAY_UNTIL_REBOOT flag set and the destination parameter NULL. See the docs.
|
|
|
|
|
Except that it doesn't work on 9X, only the NT variants.
Even if you win the rat race, you're still a rat.
|
|
|
|
|
Good solution here:
http://www.microsoft.com/msj/defaultframe.asp?page=/msj/0198/win320198.htm&nav=/msj/0198/newnav.htm
|
|
|
|
|
hi im trying to hide some of my controls from the menu bar.. by typiing this code
void CMainFrame::OnModeEnrollmentOrdinary()
{
GetDlgItem(IDC_EDIT_FNAME)->ShowWindow(FALSE);
}
but it is not working.. and im getting a memory error sort of thing..
kindly tell me how to do it from a menu contol
looking forward from all the gurus of code
|
|
|
|
|
Menu Items are not windows. You must either update the menu on the OnUpdateCommand handler or load a different menu from the application resource.
Best regards,
Alexandru Savescu
|
|
|
|
|
Hi,
The edit box and other controls are not the direct children
of the Main Frame, so GetDlgItem will not work.
They are the children of the Dialog bar you have attached
to the MainFrame, for ex generally the dialog bar is named
'm_wndReBar'.
For this use
m_wndReBar.GetDlgItem(IDC_EDIT_FNAME)->ShowWindow(FALSE) ;
and it will work.
|
|
|
|
|
Hi all,
I'm writing a function that will print the first page of the document from the tray1 and the rest from the tray2.
so i wrote codes as following. However i have runtime error at
GetDeviceCapabilities(...)
What did I do wrong? and How should I fixed it??
<br />
<br />
CPrintDialog dlg(FALSE);<br />
CDC dcPrinter;<br />
DOCINFO docinfo;<br />
dlg.GetDefaults();<br />
HDC hdcPrinter = dlg.GetPrinterDC();<br />
HDC DefaultPrinter = hdcPrinter;<br />
dcPrinter.Attach(hdcPrinter);<br />
<br />
if (theApp.my_DevMode != NULL) <br />
::GlobalFree(theApp.my_DevMode);<br />
theApp.my_DevMode = dlg.m_pd.hDevMode; <br />
LPDEVMODE lp = (LPDEVMODE) ::GlobalLock(theApp.my_DevMode); <br />
ASSERT(lp); <br />
<br />
LPCTSTR pDevice = (LPCTSTR)dlg.GetDeviceName();
LPCTSTR pPort = (LPCTSTR)dlg.GetPortName();
WORD fwCapability = DC_BINS;
LPTSTR pOutput;
<br />
DeviceCapabilities(pDevice,pPort,fwCapability,pOutput,lp);
<br />
if(pOutput!=NULL)<br />
{<br />
CWordArray binsArray = (CWordArray)pOutput; <br />
lp->dmDefaultSource = binsArray.GetAt(0);
}<br />
<br />
dcPrinter.ResetDC(lp);<br />
<br />
|
|
|
|
|
1:st - Your displayed code contains no code to GetDeviceCapabilities().
2:nd - Your code probably stamps on some memory it doesn't own.
As to how you should fix it; don't mess with memory or other stuff that doesn't belong to you.
|
|
|
|
|
what do u mean by no code to GetDeviceCapabilities???
I don't know how to use it anyway. can you tell me how to get the printer bins and set it to cdc printer device??
|
|
|
|
|
I have a dialog resource within a COM object and have added a thirdparty ActiveX control to the dialog box.
During execution, while loading the dialog resource I get the following error message..
"Dialog has OLE controls, but not matching DLGINIT resource"
I checked the .rc file and there is DLGINIT resource defined.
Any clue. Thanks
|
|
|
|
|
Hi,
Some times when u embed the ActiveX controls in a dialog
the Dialog editor writes information required for instantiating
the ActiveX control as a part of the DLGINIT.
In you case this is missing. Just try deleting the ActiveX control
in the Dialog Editor and then create it again.
|
|
|
|
|
I did delete/inserted the ActiveX control couple of times but same problem.
|
|
|
|
|
I found the solution ..
http://support.microsoft.com/search/preview.aspx?scid=kb;en-us;Q231591
Thanks for your time and effort.
|
|
|
|
|
Hi!!
I ve created a client server based chat program and now i want to enhance it by adding the feature of connecting to MSN messenger service. There are few non-MS commercial applications available that connects to MSN server (like Trillian).
As such i require detail information about MSN messenger service protocol information etc. Where can i get these ????
Also if you know any open source messenger application program in C++ that connects to MSN/Yahoo servers, then please inform me so that i can see the actual implementation.
Thanks a lot in advance.
PetricMA
|
|
|
|
|
type "MSN messenger service protocol" into google. You will get a ton of references.
|
|
|
|
|
Ive implemented last year for fun only an MSN client that connects to the server and then gets u the list of connected user in ur list without them noticing you, meaning that ure appearing offline.
This year i used a different way of doing stuff, i used the MSN object COM model, so i passed by the client itself in order to add some functionnality to my application
If ure interested email me at johnny_mkhael@hotmail.com and tell me what u need in details.
Papa
Murex Co.
|
|
|
|
|
I am trying to make a core API app. It seems to pay off, but when I use a *.exe.manifest file, the MessageBox function does not work (IE: I hear a sound, but there is no visual . Is there someone who knows the problem?
thanks in advance,
Sjoerd van Leent
LPCSTR Dutch = "Double Dutch "
|
|
|
|
|
How to write burning program for CDR!
|
|
|
|
|
There are commercial SDK's available. I've seen this question asked often and that is the only answer I have ever seen.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
Half the reason people switch away from VB is to find out what actually goes on.. and then like me they find out that they weren't quite as good as they thought - they've been nannied. - Alex, 13 June 2002
|
|
|
|
|
|
Hello,
My program seems to be getting different device contexts in different functions (results of GetTextExtent differs sometimes for same window). I would like to ensure that the DCs are the same. Here are the two code fragments. Any suggestions on making sure that OnBeginlabeledit has the same DC as OnCustomdrawMyList? Thanks!
void CGoalsListView::OnCustomdrawMyList (NMHDR* pNMHDR, LRESULT* pResult)
{
NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<nmlvcustomdraw*>( pNMHDR );
CDC* pDC = CDC::FromHandle ( pLVCD->nmcd.hdc );
...
void CGoalsListView::OnBeginlabeledit(NMHDR* pNMHDR, LRESULT* pResult)
{
NMLVDISPINFO* pDispInfo=(NMLVDISPINFO*)pNMHDR;
*pResult=1;
CDC* pDC = GetDC();
Jon Paul
|
|
|
|
|
The difference is probably due to a pre setup DC being passed in in custom draw. It will have the correct font setup for it, while in the GetDC() version you will need to get the font from the control and apply it to your DC before measuring the text.
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
Hi Roger,
Thanks for the reply.
I found that the custom draw DC is the 'correct' one that gives proper proportions, while the other is the 'bad' one.
How do I get the DC from the control? I thought I was already doing it by its position in the code? I have tried
CDC* pDC = CGoalsListView::GetDC(); // with resolution operator
but that didn't work. I've tried to extract it from the
void CGoalsListView::OnBeginlabeledit(NMHDR* pNMHDR, LRESULT* pResult)
header, but I was unable to find it.
Any suggestions? Thanks! JP
Jon Paul
|
|
|
|
|
What you had was almost correct I think.
void CGoalsListView::OnBeginlabeledit(NMHDR* pNMHDR, LRESULT* pResult)
{
NMLVDISPINFO* pDispInfo=(NMLVDISPINFO*)pNMHDR;
*pResult=1;
CDC* pDC = GetDC();
pDC->SaveDC() ;
CFont *pFont = GetFont() ;
if (pFont != NULL)
pDC->SelectObject(pFont) ;
...
pDC->RestoreDC(-1) ;
pDC->ReleaseDC() ;
}
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
Wow! It seems to work!--Thanks! ... However, I'm not sure why. Here's the full function (to position an CEdit box on top of the List Column--except for col==0 where it positions it on top of the tabbed text).
Perhaps something between GetDC() and pDC->GetTextExtent sets up the new DC? Or perhaps the GetFont() is necessary, but I thought that GetDC() gets the font of the current DC also. Hmm... Thanks again! JP
void CGoalsListView::OnBeginlabeledit(NMHDR* pNMHDR, LRESULT* pResult)
{
NMLVDISPINFO* pDispInfo=(NMLVDISPINFO*)pNMHDR;
*pResult=1;
CDC* pDC = CGoalsListView::GetDC();
pDC->SaveDC();
CFont *pFont = GetFont();
if (pFont != NULL)// you can get NULL if no font has been set for the control
pDC->SelectObject(pFont) ;
CPoint posMouse;
GetCursorPos(&posMouse);
ScreenToClient(&posMouse);
LV_COLUMN lvc;
lvc.mask=LVCF_WIDTH;
CRect rcItem;
GetListCtrl().GetItemRect(pDispInfo->item.iItem,rcItem,LVIR_LABEL);
if(rcItem.PtInRect(posMouse)) {
CString tIndent = GetDocument()->GetGoalArray()->GetIndentText(pDispInfo->item.iItem);
int npixIndent = pDC->GetTextExtent(tIndent + GLV_OFFSET).cx;
TRACE2("BegLabelEdit: string='%s', npixIndent=%d\n", tIndent, npixIndent);
m_LVEdit.m_x=rcItem.left + npixIndent;
lvc.cx = rcItem.Width() - npixIndent;
m_nEdit=0;
}
int nCol=1;
while(m_nEdit==-1 && GetListCtrl().GetColumn(nCol,&lvc)) {
rcItem.left=rcItem.right;
rcItem.right+=lvc.cx;
if(rcItem.PtInRect(posMouse)) {
m_nEdit=nCol;
m_LVEdit.m_x=rcItem.left;
TRACE1("BegLabelEdit: rcItem.left=%d\n", rcItem.left);
}
nCol++;
}
if(m_nEdit==-1)
return;
HWND hWnd=(HWND)SendMessage(LVM_GETEDITCONTROL);
ASSERT(hWnd!=NULL);
VERIFY(m_LVEdit.SubclassWindow(hWnd));
m_LVEdit.m_y=rcItem.top-1;
m_LVEdit.LimitText(50);
m_LVEdit.SetWindowText(GetDocument()->GetGoalArray()->GetItemColText(pDispInfo->item.iItem , m_nEdit));
m_LVEdit.m_cx = lvc.cx;
m_LVEdit.m_cy = rcItem.Height();
ReleaseDC(pDC);
*pResult=0;
}
Jon Paul
|
|
|
|