|
I have a dialog-based application. I would like to hide the main dialog and display an icon only in the system tray. I've tried to use ShowWindow(SW_HIDE), but the dialog still appears.
In "ApplicationName.cpp" file and in "InitInstance" module, my codes look like the following:
CFwuTestDlg dlg; //1 //the main dialog
m_pMainWnd = &dlg; //2
m_pMainWnd->ShowWindow(SW_HIDE);//3
m_pMainWnd->UpdateWindow();//4
int nResponse = dlg.DoModal();//5
return FALSE;//6
I've tried to delete line 5, but Windows complains that .exe file generate error.
Could anyone help me? Thank you.
|
|
|
|
|
First, you do not need to hide the dialog. The way that the system tray works is that windows are minimized to be not shown.
http://www.codeproject.com/shell/systemtray.asp
http://home.socal.rr.com/samhobbs/VC/TaskbarStatusIcon.html
You certainly do not want to remove the DoModal (line 5) but you do want to remove the ShowWindow and UpdateWindow (lines 3 and 4).
|
|
|
|
|
Is it possible to store pointers to objects in the STL collection classes and have the collection automatically destroy the objects as the collection elements are destroyed? e.g.:
class A
{
int var1;
};
vector<a*> v;
A* obj1 = new A;
A* obj2 = new A;
v.push_back(obj1);
v.push_back(obj2);
v.clear();
The last statement here will remove all elements from the vector but won't delete the actual objects, *obj1 and *obj2. Can vector be specialised so it will delete the objects its elements point to? (This can be done fairly easily in MFC so I am hoping the same is true for STL)
|
|
|
|
|
No. It's not possible, at least not without modifying the STL classes (which you shouldn't do anyways, since people will expect their behavior to be consistent with what the standard dictates).
Just write a small for loop which iterates over the pointers and delets them, then call clear. Or, don't store pointers in your vector, but the actual objects themselves.
|
|
|
|
|
No. It's not possible, at least not without modifying the STL classes (which you shouldn't do anyways, since people will expect their behavior to be consistent with what the standard dictates).
Just write a small for loop which iterates over the pointers and delets them, then call clear. Or, don't store pointers in your vector, but the actual objects themselves.
|
|
|
|
|
No. The trick is not to specialize the container, but to specialize the pointers you store in the container.
Use smart pointers in the collection instead of ordinary pointers.
A smart pointer will delete the object it points to, if the smart pointer gets deleted. Otherwise it behaves just like an ordinary pointer.
A smart pointer implementation that can be used as STL container element can be found at http://www.boost.org. Just look there for the class shared_ptr in the smart_ptr library.
|
|
|
|
|
I'm having trouble finding information on how to customize the Windows file open dialog to add, for example, a preview pane for images or something like that. I know I have to subclass the common dialog and I've found a few simple examples but nothing like adding other controls to the dialog. Can anyone point me to any resources or give me a general idea what I need to do? Thanks in advance.
Cheers,
Farzad
|
|
|
|
|
I want to know if I press a icon on the Toolbar, how can I run the code??? I mean like if I click a icon, and what I want to do is run a function!!!! How?
Thanks
|
|
|
|
|
Here's a link to an MSDN document to get you started.
|
|
|
|
|
Hey any one know how to get the size of the Single Document?? When the user resize the Form I want to know what's the length and width of the resized form!!! Thanks for anyone that helps!!!!!
|
|
|
|
|
If you're talking an SDI app, AfxGetMainWnd()->GetWindowRect() will do it.
|
|
|
|
|
AfxGetMainWnd()->GetWindowRect() will get the size of the frame, not the view.
|
|
|
|
|
How do I get the icon from a running process?
I already have the Process ID, the hwnd, and the hinstance of the runnig program, and I want to get the icon of that process and display it in a list control and in a dialog tab.
I could get the executable filename too, but I'd like to avoid that if possible.
Many thanks in advance.
|
|
|
|
|
How do I get the icon from a running process?
I already have the Process ID, the hwnd, and the hinstance of the runnig program, and I want to get the icon of that process and display it in a list control and in a dialog tab.
I could get the executable filename too, but I'd like to avoid that if possible.
Many thanks in advance.
|
|
|
|
|
How do I get the icon from a running process?
I already have the Process ID, the hwnd, and the hinstance of the runnig program, and I want to get the icon of that process and display it in a list control and in a dialog tab.
I could get the executable filename too, but I'd like to avoid that if possible.
Many thanks in advance.
|
|
|
|
|
Does anyone know where I can find a tutorial or book for Adobe Premiere SDK? I looked at the documentation by Adobe and it seems a little bit on the high-level. Specifically, I want to know how to make plug-ins.
-- Frank
|
|
|
|
|
Can someone help me? I need to set my Dialog Box to a certain size on initialization, so that it will be proportionate to the computer screen it is ran on? Right now it opens at different sizes on different computers. Is it a resolution problem, or do I need to check Desktop window size during initialization? I would appriciate any info. Thank You
|
|
|
|
|
It's not a problem at all, dialogs have a fixed size. It "looks smaller" on 1280x1024 than 800x600 because there's more screen there.
To change the dlg size, call CWnd::SetWindowPos() at the end of your OnInitDialog() . But you'll need to resize/reposition all your controls as well, or the dlg will look fugly.
|
|
|
|
|
Maybe, it's better to create more than one dialog if the size is important. At run time you can check screen resolution and use the proper one.
|
|
|
|
|
How do I adjust the size of the MainFrame?
And, after that, how do I set it to be fixed?
Thanks
|
|
|
|
|
This sort-of kind-of does it... I put this code in at the end of InitInstance, after the window has been shown.
Might need a little fine tuning...
RECT rect = {100,100,500,500};
pMainFrame->MoveWindow(&rect,TRUE);
pMainFrame->ModifyStyle(WS_THICKFRAME,0);
You can call ModifyStyle with WS_MAXIMIZEBOX as well, if you want to prevent maximizing the window.
|
|
|
|
|
I am using Visual C++ version 6.0. I receive this error when I try to execute my application on a system without Visual C++.
This was a problem in previous versions of VC++. I checked the file that contained the error (daocore.cpp) and it appears that the fix is installed in version 6.0.
Any ideas/suggestions will be appreciated.
Rick
|
|
|
|
|
Hi any one is there who knows how to develop Window Explorer control that means simulating a Windows Explorer with all operation like Explorer including folder,file view and cut,copy paste and context menus.
If any one know how to do this pl tell me,if u know any material/books/articles regarding this u pl let me know.
thanx
Sreenivasulu.G
|
|
|
|
|
|
Hi,
I want to replace the default MFC icon in the Application's title bar as well as in the Explorer.
I have repainted the IDR_MAINFRAME icon using the resource editor but even after doing this and after rebuilding all the files, the application still shows the default MFC icon.
Why is this so and what should I do to display a new icon?
Thanks in advance,
Dipalee
|
|
|
|