|
I saw where someone was having this same problem and it referenced a post that didn't show up so I am sorry but I must ask it again.
When I load the CTreeCtrl programmatically the checks do not show up. I have done Invalidate and all that and the only way I can get them to show up is if I show the control then empty it and read in the information again (I am buildiing it based on a XML file. I can't see any reason why I am getting this behaviour and have worked on it for a couple of days with nothing but a headache. Thank you very much if you can figure this out. I hope it isn't a stupid rookie mistake.
Bill
|
|
|
|
|
I figured it out. If you create the treectrl with the style tvs_checkboxes you must modify its style to remove that style then add it back. Or just create it without that style then do a modify and add it.
Bill
|
|
|
|
|
Hi !
I'm creating context menu's for a view dynamically (by code and depending on some conditions).
Is there a way to dynamically connect Accelerator Keys to this context menu or do I have to write a mechanism catching the WM_KEYDOWN or a similar message to implement that ?
[I'm using VC++ 6 & MFC, but some WinAPI-Calls to make that possible would also help]
Regards, Marco
|
|
|
|
|
Hi,
I think you can create an Accelerator table and load
it dynamically. Have a look at the foll functions
- CreateAcceleratorTable
- CopyAcceleratorTable
- LoadAccelerators
|
|
|
|
|
Try overloading the document methods below as:
HACCEL CMyDoc::GetDefaultAccelerator()
{
if (m_hAccelTable == NULL)
LoadAccelTable(MAKEINTRESOURCE(IDR_EDIT));
return m_hAccelTable;
}
BOOL CMyDoc::LoadAccelTable(LPCTSTR lpszResourceName)
{
ASSERT(m_hAccelTable == NULL); // only do once
ASSERT(lpszResourceName != NULL);
HINSTANCE hInst = AfxFindResourceHandle(lpszResourceName, RT_ACCELERATOR);
m_hAccelTable = ::LoadAccelerators(hInst, lpszResourceName);
return (m_hAccelTable != NULL);
}
Also overload this in the Main Frame derived class:
HACCEL CMainFrame::GetDefaultAccelerator()
{
HACCEL hAccelTable = m_hAccelTable;
// Get the active MDI child window.
CMDIChildWnd *pChild = (CMDIChildWnd *) GetActiveFrame();
// or CMDIChildWnd *pChild = pFrame->MDIGetActive();
// Get the active view attached to the active MDI child
// window.
if (pChild)
{
CView* pView = (CView*) pChild->GetActiveView();
if (pView)
{
CDocument* pDoc = pView->GetDocument();
if (pDoc)
hAccelTable = pDoc->GetDefaultAccelerator();
}
}
return hAccelTable;
}
|
|
|
|
|
I have created a ATL/COM project in VC6 that will run as a service. Then I added a OLE DB Provider and modified it to just return 2 rows of a very simple record layout.
It compiles with no errors or warnings!
Then I launch Visual Basic and create a standard exe projekt, the first thing I do is to add a DataEnvironment Designer. When I open the property dialog on "Connection1" I get a list of providers to choose from, and my provider is listed there.
When I select the provider I have created and presses next button, I get an error message saying something like this: "The provider is not available, check that you have installed it correctly" !!!!!!
What have I missed? How do I install/register my provider?
Is it not possible to have OLE DB providers in an ATL/COM project running as a service?
I have ofcourse started the service!
Don't give me a RTFM, cause I have!
Confused
|
|
|
|
|
Hi,
How can I use SystemTray tooltip text up to 256 characters (or more)?
Today it seems to only support 64 characters.
Thanks
Ola Carlsson
|
|
|
|
|
Is there a way to allow an application to permanetly delete itself(file) after exiting or after a period of time.
|
|
|
|
|
One way is to create a .bat file that deletes the .exe file and then itself. .bat files are loaded into memory and closed before execution, so a .bat can delete itself, where a .exe cannot.
You may have to do something to make the .bat wait until the app has been unloaded.
|
|
|
|
|
Further on using .bat file,
This .bat file can be called from ur application.Execute this .bat file in applications destructor/exit function.
Other method,
Try to use close function .I am not very sure on this
|
|
|
|
|
Check this Thread:
http://www.codeproject.com/script/comments/forums.asp?forumid=1647&app=50&tid=153951&select=153964#xx153951xx
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
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
|
|
|
|