|
You could handle the WM_NCHITTEST message. First call the default handler and if the cursor is over a resizable border simply return HTBORDER to disable resizing with the mouse. To totally disable resizing you would also have to disable the Size command in the system menu.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
LONG_PTR style = GetWindowLongPtr(hwndDlg, GWL_STYLE);
SetWindowLongPtr(hwndDlg, GWL_STYLE, (style & ~WS_THICKFRAME)|WS_BORDER);
|
|
|
|
|
TheDelChop wrote: is it possible to send a message to the dialog box and change it from WS_THICK to WS_BORDER without destroying and recreating the dialog box?
Yes but it is not a "Message". The style bits are contained in the "window long" member. If you have a MFC CDialog then use CDialog::ModifiyStyle(...) otherwise use GetWindowLong(...), SetWindowLong(...) API's.
led mike
|
|
|
|
|
What code or class can I use to get the IP address of the computer my software will be running on? I am using Visual C++ (MFC) 2003. (No .NET)
|
|
|
|
|
What's wrong with gethostname() followed by gethostbyname() ?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Nothing is wrong with them, I just didn't know about those functions.
Thanks, I'll be sure to look them up.
Peace,
BP
|
|
|
|
|
does anyone possibly know how i would get my c++ application (w MFC in vc6.0) to emulate a normal left click? (press, release)
(that works globably, so it can be inactive/minimized and click in my applications for me)
thanks!
/Johannes
|
|
|
|
|
It usually requires sending the appropriate message to the control you want to interact with.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
So you mean that mouse clicking can not be globaly emulated? But keyboard buttons can be..
there must be some way?
thanks.
/Johannes
|
|
|
|
|
Johpoke wrote: So you mean that mouse clicking can not be globaly emulated? But keyboard buttons can be..
Where in the world did you infer this from. Controls respond to both keyboard or mouse, and either can be emulated. One such way is via SendInput() . There are likely other solutions, but without more details as to what you are wanting to achieve...
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
i searched for that and sneaked around to microsoft, were i found mouse_event, then i found this:
mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,NULL);
and
mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,NULL);
which does exactly what i need!
thanks!!
/Johannes
|
|
|
|
|
SendInput() has superseded mouse_event() on Windows NT/2000/XP systems.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Yep!
For longevity's sake, SendInput() should be used instead. mouse_event() is deprecated.
Mark
|
|
|
|
|
I want to hide windows when open the program.
I try to use
CWnd::ShowWindow(SW_HIDE);
in OnInitDialog it still no work
but
CWnd::ShowWindow(SW_MINIMIZE);
It's work.
Please suggest me how to solve the problem.
|
|
|
|
|
you use CWnd::ShowWindow(SW_HIDE); or this->ShowWindow(SW_HIDE); ?
|
|
|
|
|
I also try both
the result still same.
|
|
|
|
|
You can't use ShowWindow() in this fashion because one of the last things that happens with a dialog is a call to ShowWindow(SW_SHOW) , effectively overiding your attempt to hide the window. The solution is to handle the WM_WINDOWPOSCHANGING message, and then remove the SWP_SHOWWINDOW flag.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
The Code Project Visual C++ Forum FAQ
7.6: I have a dialog-based application and want the dialog hidden on startup. How do I do this?
http://www.codeproject.com/cpp/cppforumfaq.asp#mfc_hidedlgstartup[^]
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
|
Max++ wrote: How to Hide windows
Install Lynux
led mike
|
|
|
|
|
Hi,
I have a multithreaded program in which I use the following class object "ClassLock" the synchronize accesses :
<br />
#ifndef CLASSLOCK_H<br />
#define CLASSLOCK_H<br />
<br />
extern CRITICAL_SECTION g_ClassLock;<br />
<br />
class ClassLock<br />
{<br />
public:<br />
static void InitCriticalSection();<br />
static void DelCriticalSection();<br />
inline ClassLock() { EnterCriticalSection( &g_ClassLock ); }<br />
inline ~ClassLock() { LeaveCriticalSection( &g_ClassLock ); }<br />
};<br />
<br />
#endif
I protect a function call by instantiating a ClassLock object at the beginning of the function :
<br />
void MyFunc()<br />
{<br />
ClassLock l;<br />
...<br />
}<br />
But sometimes, don't know why, an exception is thrown. How can I deal with this ?
My idea would be the following modification, but I don't know if it's safe and smart :
<br />
inline ClassLock() { while(!TryEnterCriticalSection( &g_ClassLock )) { } }<br />
Any other ideas ? Thanks
|
|
|
|
|
Tnarol wrote: How can I deal with this ?
Find out what the exception is.
Is the purpose and use model of that class supposed to be evident? I don't get it.
led mike
|
|
|
|
|
led mike wrote: Is the purpose and use model of that class supposed to be evident? I don't get it.
Yes,
First at the beginning of your app you call InitCriticalSection() which is in fact InitializeCriticalSection() on a global g_ClassLock variable
Then inside a function when you instantiate a ClassLock object it calls the constructor which locks the g_ClassLock variable using EnterCriticalSection( &g_ClassLock )
When the function return, the ClassLock object goes out of scope, so the destructor is called automatically and it does LeaveCriticalSection( &g_ClassLock )
Therefore the function has the g_ClassLock synchronization token for the duration of its' execution.
Then at the end of the program DelCriticalSection must be called...and it does DeleteCriticalSection( &g_ClassLock ).
|
|
|
|
|
Tnarol wrote: on a global g_ClassLock variable
I don't understand what problem a "global" critical section solves, you want to synchronize everything in the process?
led mike
|
|
|
|
|
It's just that a global variable is a simple kind of synchronization resource that can be seen and shared by several threads in a program.
I could have this variable static in the class, but there are some strange things happening with static variables members of a class, if you use them very early in the program they are sometimes not yet created and it makes you crash. I don't have a logical explanation for this but that's my experience.
|
|
|
|