|
Hide the main window. In MFC this will do the trick:
AfxGetMainWnd()->ShowWindow(SW_HIDE)
Of course, you won't be able to interact with the app while it's hidden unless you provide a means of making it visible or allowing it do display a context menu. A common convention here is do add an icon to the system tray while the app is hidden.
Anna
Homepage | My life in tears
"Be yourself - not what others think you should be"
- Marcia Graesch
"Anna's just a sexy-looking lesbian tart"
- A friend, trying to wind me up. It didn't work.
Trouble with resource IDs? Try the Resource ID Organiser Visual C++ Add-In
|
|
|
|
|
I believe you can take off the WS_EX_APPWINDOW extended style from the window.
|
|
|
|
|
I am not sure if I am doing something wrong, but it doesnt seem to like me using a vector in my managed c++ app.
??
Appreciate your help,
ns
|
|
|
|
|
|
That is exactly what I needed to read...........many many thanks!
Appreciate your help,
ns
|
|
|
|
|
I'm trying to implement a floating window, like a tooltip, to follow the mouse to show display info on our data.
I'm now using the tooltip, and it works ok, not great, but ok; the view gets invalidated, and forces a redraw. ( I was using a simple CWnd before to simulate this, and it was ok also)
Are there other alternatives for that kind of floating window ?
Thanks
Max.
Maximilien Lincourt
For success one must aquire one's self
|
|
|
|
|
If you create a special window class with the style CS_SAVEBITS (among others), you shouldn't have a problem with redraw. See AfxRegisterClass or ::RegisterClass in the MSDN.
Chris Richardson
You can stash and you can seize
In dreams begin, responsibilities U2 - Acrobat[^]
Stop being PC and accounting for everyone and his momma's timeframe. Just enjoy your - Rohit Sinha in the content-challenged thread
|
|
|
|
|
Yeah !
I learn something really usefull today!
Thanks so much!
Max.
Maximilien Lincourt
For success one must aquire one's self
|
|
|
|
|
Does anyone know the limits to the length of a (Win2K/NT/XP) username and domain name? Are these #defined anywhere? Thanks,
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
|
I want to display a .jpg file in a Dialog. How to do that??? Is there any Control available for that.
|
|
|
|
|
there are probably ten different articles on this site that can help you do that. try looking in the "Bitmap and Palettes" section.
-c
|
|
|
|
|
If you are using VC++ 7, then you can use CImage class. If you don't but have the latest Platform SDK, then can use the Image class of the new GDI+ library. If neither, then download the CXImage class from code project.
All this classes with allow you to access to an HBITMAP that you can use it anywhere.
|
|
|
|
|
With an MFC Menu, is it possible to not just disable but *hide* menu items without having to delete them from the menu?
|
|
|
|
|
Yes, it's possible, but not recommended, it confuses the user that sometimes a menu item is visible, and sometimes it's not.
look for :
BOOL CMenu::RemoveMenu( UINT nPosition, UINT nFlags );
Max.
Maximilien Lincourt
For success one must aquire one's self
|
|
|
|
|
Thank you but RemoveMenu() deletes the item from the menu. I just want to hide it so that I can easily restore it when a different document is shown.
|
|
|
|
|
you need to remove it to hide it.!
Max.
Maximilien Lincourt
For success one must aquire one's self
|
|
|
|
|
I am just brainstorming here because I have never tried this but what if you use two different menu bars, one with all the menu options and the other with certain menus hidden? I don't even know if it can be done, but you can try it.
Max is right though, if you want to hide it you have to remove it.
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
OnKeyDown does not seem to be getting called in this case at all. Any ideas what needs to be done in order for the keyboard accelerators to start working and keyboard inputs to get recorded?
Thanks in advance!!!
LRESULT TestPage::OnKeyDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
MSG msg;
HACCEL hAccel;
BOOL bRet;
if (!m_hWnd)
return FALSE;
hAccel = ::LoadAccelerators( _Module.m_hInstResource, MAKEINTRESOURCE(Accel));
if (m_hAccel == NULL)
return FALSE;
while ((bRet = ::GetMessage(&msg, m_hWnd, NULL, NULL)) != 0)
{
if (bRet == -1)
{
return FALSE;
}
else
{
if (!::TranslateAccelerator( m_hWnd, m_hAccel, &msg))
{
MessageBox ("Key Pressed ","Accelerators",MB_OK);
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
}
return TRUE;
}
|
|
|
|
|
Hi
I've followed the following tutorial about implementing contextsensitive help:
http://www.codeguru.com/misc/csh_dialog.shtml
But the tutorial doesn't work .. i alsoo get 'Help topic is not found' .. Does anyone know what the problem is? Or can anyone post a fix or something?
I'd appreciate it greatly.
Best regards
Jens
|
|
|
|
|
Hi, everyone!
Please look at the following codes. In function(), the return
value is a reference type, but it is assigned to an object. I
think reference type and origin object type are two kinds of
things. We often assign an object to a reference. But what about
the contrary? And this is my first question.
I have learned from others before that reference is just a alias
of the other object. But in the following case I am not sure. Because
the returned reference is pointed to a temorary object. And it can
be printed in main!! And this is my second question.
Who can help me with my two questions?
Source Code:
--------
#include <iostream>
using namespace std;
class foo {
public:
void Echo()
{
cout << "Hmm..." << endl;
}
};
foo& function()
{
foo obj;
return obj;
}
int main()
{
foo obj = function();
obj.Echo();
return 1;
}
--------
Thanks in advance,
George
|
|
|
|
|
We often assign an object to a reference. But what about
the contrary? And this is my first question.
It is perfectly legal, the reference is treated as the object it is bound to. For instance:
int i=0;
int& ir=i;
int j=ir;
j=5; As for your second question, returning a reference to a temporary leads most likely than not to catastrophe. Your example is working out of sheer luck. The problem is that your foo function returns a reference that is bound to an object which gets destroyed as soon as foo exits. By the time the caller uses the reference, this is bound to a non-existent object.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanks, Joaquín buddy!
I have thought my sample a little deeper. I think
when "return" statement is called, a reference to the
temporary object is generated and finally the reference
to the "obj" object is returned to the client code.
Am I correct?
I often the type of a function returns a reference.
In your opinions, I think it is dangerous usage. But
the usage is too often -- return a reference type.
Can you explain it a bit deep?
I think return a reference of a function local object
is illegal. Am I correct?
regards,
George
|
|
|
|
|
Returning a reference is not dangerous in general, only if the reference is to a temporary object. The rule is: you can safely return a reference to an object from a function if the object lives longer than the function. For instance, the following example is perfectly safe:
class A
{
private:
std::string str;
public:
std::string& get_str()
{
return str;
}
};
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanks, Joaquín buddy!
George
|
|
|
|