|
Does any one know how I can Manipulate Views consisting of field values from several tables using Visual C++. I want to Insert new records in one instance,Update Data in another instance and delete data using MS SQL Views.
|
|
|
|
|
How can I shutdown a remote PC after saving all the running applications on it?
|
|
|
|
|
hey, i started building my app in VC++6 and i want to access an IE window's javascript to retrieve the contents of an HTML input box. how can i do that? can you post a sample script?
|
|
|
|
|
I created an own MFC web browser, fetched some interfaces to MSHTML and retrieved the contents that way.
Maybe there is also a way to get the MSHTML interface by injecting a DLL or by creating a toolbar...
Don't try it, just do it!
|
|
|
|
|
I hear there's a simple way to do it using DOM, but how?
|
|
|
|
|
I have an MFC application based on Document/View Architecture which is also an MDI application. I am able to add ToolBar and StatusBar in MDI Child window but instead I need to add menu to MDI child windows. Is there any trick available to add menu in MDI Child window? Per MSDN, MDI Child window can not have its own menu. Please help.
|
|
|
|
|
I can replace the floating frame class in my application with my own ( derived class from CMiniDockFrameWnd )
by using something like :
m_pFloatingFrameClass = RUNTIME_CLASS(MyMiniFrame);
but it replaces all the floating frames for the application ( toolbars, floating windows, ... )
Is there a way to have a different class for each toolbar ( for example ) so that I can do something special for each ?
I'm trying to set a minimum size on the floating window with OnGetMinMaxInfo, but when doing so, it also set the size for the toolbars ( when floating ) and do it will create a frame that is larger than the actual size of the toolbar.
Thanks.
Max.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
I have created a modeless dialog. I am passing in the pointer to the parent window - which happens to be a CFormView derived class.
m_pModeless = new CModelessDialogHeap(this);
Now when I want to get the parent pointer (m_pModeless) from the modeless dialog I can do two things. A. Store the pointer passed into the constructor of the modeless dialog and use that -- which works.
B. Or, according to one article on this site "http://thecodeproject.com/dialog/gettingmodeless.asp" I should be able to use GetParent().
When I do, it doesn't. It returns an empty pointer
CWnd * tmpPtr = this->GetParent();
What am I missing? Thanks!
|
|
|
|
|
|
Sorry I dont' know what you mean. The dialog is created via clicking a button on a CFormView derived class and its pointer (this) is passed to the Modeless Dialog constructor.
|
|
|
|
|
a window's parent is set by the code that creates the window (in the case of a modeless dialog, that's generally your code). if you don't set a parent wnd (usually in the dlg ctor, or in Create) it will remain NULL.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
Look at my first post. I am setting the parent window to the dialog.
Please give me an example if I am off base.
|
|
|
|
|
|
Here is the code that creates the modeless dialog box
void CFormsFormsFormsView::OnModelessheap() {
if(m_pModeless){
m_pModeless->SetForegroundWindow();
m_pModeless->CenterWindow();
}
else {
m_pModeless = new CModelessDialogHeap(this);
m_pModeless->Create(CModelessDialogHeap::IDD);
m_pModeless->CenterWindow();
m_pModeless->ShowWindow(SW_SHOW);
}
}
It all works fine. I just don't understand why GetParent() doesn't when called from the modeless dialog box.
Thanks
|
|
|
|
|
can you step into that Create call ?
i suspect some other bit of code somewhere is setting the dlg's m_pParentWnd to NULL. Create is another common place to set that variable.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
Yes I've stepped through the code. Like I said, the parent is passed into it just fine because I can assign that pointer to a member variable.
But GetParent() should do the same thing...right?
Appreciate your help. Here is the code
CModelessDialogHeap::CModelessDialogHeap(CWnd* pParent /*=NULL*/)
: CDialog(CModelessDialogHeap::IDD, pParent)
{
//{{AFX_DATA_INIT(CModelessDialogHeap)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
m_parent=pParent;
}
|
|
|
|
|
mx483 wrote:
m_pModeless->Create(CModelessDialogHeap::IDD);
The only thing I do different for my modeless dialogs is to call Create(IDD) from within the dialog's constructor.
Does commenting out the call to CenterWindow() have any effect?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
I've tried this several different ways and it works fine each time (i.e., GetParent() returns the correct value). What does the constructor of CModelessDialogHeap look like? From where are you calling GetParent() ? Is CModelessDialogHeap derived from CDialog ?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
I sent the constructor of CModelessDialogHeap already. Here it is again.
CModelessDialogHeap::CModelessDialogHeap(CWnd* pParent /*=NULL*/)
: CDialog(CModelessDialogHeap::IDD, pParent)
{
//{{AFX_DATA_INIT(CModelessDialogHeap)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
m_parent=pParent;
}
CModelessDialogHeap is derived from CDialog.
As long as the parent exists it shouldn't matter where GetParent is called. But I put a button on the dialog and attempted it while it was still active.
void CModelessDialogHeap::OnButton1()
{
CWnd * tmpPtr = this->GetParent();
}
Thanks for your help as well David.
|
|
|
|
|
At this point my suggestion would be to create a little dialog-based test application that does nothing but create and show a modeless dialog in the OnInitDialog() method. Let me know how that works out.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Okay I created a dialog based app and the GetParent function works as advertised. So now we know that the problem is more likely a conceptual one. The mainApp dialog is a popup and the CDialog derived modeless dialog is also a popup. Code is exactly the same as the problem project.
In the problem project example I couldn't get to work I had an MDI application that had a CFormView derived class. It was a child. That child had a button when pressed would create the CDialog derived class modeless dialog. The CDialog derived class was set as PopUp. So can't a child spawn a modeless dialog (works) and can't that dialog in turn know it's spawning entity as Parent (GetParent).
I won't mention anything about child as it was demonstrated to me by David that a modeless dialog shouldn't have a child style. I agree.
I think this is important because these are pretty basic concepts.
Thanks for your help.
|
|
|
|
|
hi
i want to display the bitmap on the picture box in visual c++.code i had used is below if the loadbitmap the id of bitmap present in the resource is passed it loads and displays but if the id is not in the resource then it does not displays the bitmap.
bitmap=LoadBitmap(NULL,MAKEINTRESOURCE("C:\\ff.bmp"));
if(bitmap==NULL) //it displays the fail
MessageBox("fail ");
m_pic.SetBitmap(bitmap);
i want to display the image whose id is not present in the resource. how to do that.
ddd
|
|
|
|
|
if youwant show a bimap file , you can use CImage Class.
|
|
|
|
|
if you want show a bitmap file ,like c:\\ff.bmp, you can use CImage MFC Class(VC++7 ).
|
|
|
|
|
tasleem143 wrote:
bitmap=LoadBitmap(NULL,MAKEINTRESOURCE("C:\\ff.bmp"));
What's this? MAKEINTRESOURCE() does not take a string for its argument.
In the project's resource.h file:
#define IDC_MYBITMAP 1234 // or some other appropriate value In the project's .rc file:
IDC_MYBITMAP BITMAP DISCARDABLE "c:\\ff.bmp" In the .cpp file:
HBITMAP hBitmap = LoadBitmap(NULL, MAKEINTRESOURCE(IDC_MYBITMAP));
if (NULL == hBitmap)
AfxMessageBox("LoadBitmap() failed.");
else
m_pic.SetBitmap(hBitmap);
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|