|
if you're dealing with STL, why do you go to the end and use std::string, rather that mixing STL and MFC ?
std::vector<std::string> would have done your job though.
|
|
|
|
|
I got the same compiler error when I used std::vector<string> m_Item. Thats why I tried std::vector<CString> m_Item.
A C++ programming language novice, but striving to learn
|
|
|
|
|
maybe because you didn't include the correct headers...
have you thought of #include <string> ?
|
|
|
|
|
Hi All,
I'm having a win32 dll. I need to provide a version number for the DLL.
How can we achieve this through code?
I'm using VC++6.0 for building the dll.
Many thanks,
Rajesh
|
|
|
|
|
|
Hi,
I'm actually writing a CLIENT/SERVER TCP/IPv6 application, under Microsoft Visual Studio C++. In which the SERVER is a file server application and the CLIENT is a "Multiple Document Interface (MDI)" and "RichEdit Text" application that can open multiple files from the server.
I would like to add a Toolbar window into my MDI frame window, to do this, I've created the Toolbar window with the "CreateToolBarEx" function.
But the created Toolbar window is located in the client area of the MDI frame window and each time a new MDI child window is created to hold a new document, it erases the Toolbar window in the client area.
My question is how can I do :
1) To change the client area size so that fits
height(MDI Frame window) - height(Toolbar window)
OR
2) To include the Toolbar window into the
non-client area like the Menubar and the Titlebar
So that the MDI client window can't anymore erase the Toolbar window in the client area.
Thanks,
Alain NGUYEN
|
|
|
|
|
add a class derived from ccontrolbar.
and then use dockcontrolbar().
prasann
who else
|
|
|
|
|
Hi all,
it's very helpful for me. i have created an application to install an printer Locally through INF file.when a call AddPrinter() function it fails with error code 126(specified module could not be found) Although i have initalise all the parameter as mention in MSDN( You must specify non-NULL values for the pPrinterName, pPortName, pDriverName, and pPrintProcessor members of this structure before calling AddPrinter. ). but it failed and initialisation is correct for that from my end......is there any reson to fails this function.
plz help me.Thanks in Advance.
Ashish
|
|
|
|
|
Have you checked the path to the *.inf file?
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
Hi,
Is that possible to run an executable file that is part of a data file by passing the begining (disk offset) inside this data file ?
Regards,
sdancer75
|
|
|
|
|
I've just been having a look at CreateProcess, and the simple answer is...
NO.
But - you can be clever...
There's nothing stopping you making a temp file from this arbitrary data, and then running create process on it.
The clever bit is to create the temp file with the FILE_FLAG_DELETE_ON_CLOSE flag set. So, after the process is started, close your handle to the file.
When the process finishes - that will close it's handle, and *poof* - file gone.
Iain.
ps. I haven't actually tried this myself, it's from reading. I look forward to your results.
pps. doing a google search for FILE_FLAG_DELETE_ON_CLOSE may give you very clear sample code.
|
|
|
|
|
|
Well, that example does explicitly say its for assemblies, etc - so it's not really any use to you.
I'd break your problem into steps (classic programming!)
1/ Get a pointer to a resource in your software (FindReource, etc).
2/ Then work out how to make temporary filenames
3/ Create a temp file with the delete-on-close flag - sleep - alt tab to explorer and go "wow, it's there!"
3a/ close the handle... alt tab to explorer and go "wow, it's gone!"
4/ Now try the trick with an executable - and make sure you use appropriate sharing flags when you create the file.
4a/ try running your executable manually between creation and deletion.
5/ Move on to Create Process and away you go!
All of the above could be with MFC, Win32.. etc. In the end it will end up as Win32 calls.
Iain.
|
|
|
|
|
ok Iain thanks.
Right now it works in this way you described. All I wanted is to avoid temp files.
Anyway, I can not think any other way to do that.
Regards,
sdancer75
|
|
|
|
|
Hi
How to find that a CWnd pointer is a CEdit* or a CButton* or ant other Cwnd drived classes?
I tested it this way :
if(pWnd->GetRuntimeClass() == RUNTIME_CLASS(CEdit))<br />
pWnd->ShowWindow(SW_HIDE);
but it did not work.
Thanks
|
|
|
|
|
Try this,
TCHAR strClassName[100];<br />
CString strEdit = _T("EDIT");<br />
::GetClassName( pWnd->m_hWnd, (LPTSTR)&strClassName, 100 );
Regards,
Paresh.
|
|
|
|
|
|
if( pWnd->IsKindOf( RUNTIME_CLASS(CEdit)))
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
That would only work if he created a CEdit, then cast it to CWnd.
If he's done...
CWnd *pWnd = GetDlgItem (IDC_MYEDIT);
on a window he's not attached to a class, then he'll get a generic CWnd* - which he can then case to a CEdit*, but without getting any runtime type info.
Iain.
|
|
|
|
|
Hi,
I need to disable Windowed ActiveX Controls on another Application, say Windows Media Player.
Is it Possible?
Iam doing this way...
Initially I am opening the windows media player and then executing the below code.I could notice that the ActiveX controls on WmPlayer are windowed ActiveX controls by placing messageboxes.
But when I disable the ActiveX control using the handle I got it throws an assertion
CWnd *pWnd = CWnd::FindWindow(_T("WMPlayerApp"),NULL);
if(pWnd == NULL)
{
if(AfxMessageBox(_T("Couldn't find the Windows Media Player application. Do you want to start it?"),MB_YESNO) == IDYES)
{
}
return;
}
HWND hWndChildAfter = NULL;
CWnd *pChild = CWnd::FindWindowEx(pWnd->GetSafeHwnd(),hWndChildAfter,_T("WMPAppHost"),NULL);
COleControlSiteOrWnd* pOleChildSiteOrWnd = (COleControlSiteOrWnd*)pChild->GetNextDlgTabItem((CWnd*)pChild);
COleControlSite* pOleControlSite;
if(pOleChildSiteOrWnd->m_hWnd == NULL)
{
AfxMessageBox(_T("Its a Windowless ActiveX Control"));
}
else if(pOleChildSiteOrWnd->m_pSite == NULL)
{
AfxMessageBox(_T("Its a Standard Window Control"));
}
else if(pOleChildSiteOrWnd->m_hWnd != NULL && pOleChildSiteOrWnd->m_pSite != NULL)
{
AfxMessageBox(_T("Its a Windowed ActiveX Control"));
pOleControlSite = pOleChildSiteOrWnd->m_pSite;
}
pOleControlSite->EnableWindow(FALSE);
Is this the right approach? or else can this be possible by hooking and inspecting the click on the ActiveX control? I need an approach. Any suggestions would be greatly appreciated.
Thanks in Advance
Satya
Today is a gift, that's why it is called the present.
|
|
|
|
|
I have a MFC dll in which the main code resides in a class that inherits a CDialog. In order to start the main code, I do the following:
BOOL CdllEntryApp::InitInstance()
{
AfxEnableControlContainer();
m_pMainWnd = &theApp.myInstance;
theApp.myInstance.Create(IDD_MYDIALOG);
theApp.myInstance.ShowWindow(SW_HIDE);
return TRUE;
}
When I call the dll I can see the CDialog showing up and then very quickly disappear. This works, but it's not very pretty. What is the correct way to instantiate an object based on a CDialog without showing it?
|
|
|
|
|
I think you should override PreCreateWindow method, removing WS_VISIBLE flag (e.g. cs.style &= ~WS_VISIBLE ); however I didn't make a test.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Thanks for your response. I added the following:
BOOL CdllMainCodeDlg::PreCreateWindow(CREATESTRUCT& cs)
{
cs.style &= ~WS_VISIBLE;
return CDialog::PreCreateWindow(cs);
}
and I added the following to the h-file:
protected:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
However, the CdllMainCodeDlg::PreCreateWindow is never executed, why is that? Do I need to add something to BEGIN_MESSAGE_MAP(CdllMainCodeDlg, CDialog) also?
|
|
|
|
|
Try to remove the WS_VISIBLE style in the dialog template inside resource (.rc ) file.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
I don't think that would help. Because modal application dialogs can not be hidden. For that you've to go for modeless dialogs. I hope I'm right. I also had faced the same problem, and even tried all these steps. Didn't help me that.
- Malli...!
|
|
|
|