|
One solution is SetWindowPos().
Kuphryn
|
|
|
|
|
Good idea Kuphryn
So you think I can eliminate it from the taskbar by using SetWindowPosition? MSDN shows the following parms for SetWindowPos. SWP_HIDEWINDOW will certainly hide the window but it shows in the taskbar.
Best Wishes, Marty
BOOL SetWindowPos(HWND hWnd,
HWND hWndInsertAfter,
int X,
int Y,
int cx,
int cy,
UINT uFlags
);
Parameters
hWnd
[in] Handle to the window.
hWndInsertAfter
[in] Handle to the window to precede the positioned window in the Z order. This parameter must be a window handle or one of the following values.
HWND_BOTTOM
Places the window at the bottom of the Z order. If the hWnd parameter identifies a topmost window, the window loses its topmost status and is placed at the bottom of all other windows.
HWND_NOTOPMOST
Places the window above all non-topmost windows (that is, behind all topmost windows). This flag has no effect if the window is already a non-topmost window.
HWND_TOP
Places the window at the top of the Z order.
HWND_TOPMOST
Places the window above all non-topmost windows. The window maintains its topmost position even when it is deactivated.
For more information about how this parameter is used, see the following Remarks section.
X
[in] Specifies the new position of the left side of the window, in client coordinates.
Y
[in] Specifies the new position of the top of the window, in client coordinates.
cx
[in] Specifies the new width of the window, in pixels.
cy
[in] Specifies the new height of the window, in pixels.
uFlags
[in] Specifies the window sizing and positioning flags. This parameter can be a combination of the following values.
SWP_ASYNCWINDOWPOS
If the calling thread and the thread that owns the window are attached to different input queues, the system posts the request to the thread that owns the window. This prevents the calling thread from blocking its execution while other threads process the request.
SWP_DEFERERASE
Prevents generation of the WM_SYNCPAINT message.
SWP_DRAWFRAME
Draws a frame (defined in the window's class description) around the window.
SWP_FRAMECHANGED
Applies new frame styles set using the SetWindowLong function. Sends a WM_NCCALCSIZE message to the window, even if the window's size is not being changed. If this flag is not specified, WM_NCCALCSIZE is sent only when the window's size is being changed.
SWP_HIDEWINDOW
Hides the window.
SWP_NOACTIVATE
Does not activate the window. If this flag is not set, the window is activated and moved to the top of either the topmost or non-topmost group (depending on the setting of the hWndInsertAfter parameter).
SWP_NOCOPYBITS
Discards the entire contents of the client area. If this flag is not specified, the valid contents of the client area are saved and copied back into the client area after the window is sized or repositioned.
SWP_NOMOVE
Retains the current position (ignores X and Y parameters).
SWP_NOOWNERZORDER
Does not change the owner window's position in the Z order.
SWP_NOREDRAW
Does not redraw changes. If this flag is set, no repainting of any kind occurs. This applies to the client area, the nonclient area (including the title bar and scroll bars), and any part of the parent window uncovered as a result of the window being moved. When this flag is set, the application must explicitly invalidate or redraw any parts of the window and parent window that need redrawing.
SWP_NOREPOSITION
Same as the SWP_NOOWNERZORDER flag.
SWP_NOSENDCHANGING
Prevents the window from receiving the WM_WINDOWPOSCHANGING message.
SWP_NOSIZE
Retains the current size (ignores the cx and cy parameters).
SWP_NOZORDER
Retains the current Z order (ignores the hWndInsertAfter parameter).
SWP_SHOWWINDOW
Displays the window.
Best Wishes,
Marty
|
|
|
|
|
ModifyStyleEx( 0, WS_EX_TOOLWINDOW );
Joel Lucsy
|
|
|
|
|
I have to take a test as part of the application process for a specific programming job. A specific question, which I'll post on here, has me a little bit confused, and I just wanted to see if I'm just reading it wrong...I would like some opinions before I write this program incorrectly. Here's the question:
"Write an optimized C program to convert a base 16 number to its base 10 equivalent, without using the standard C libraries, i.e. don't use scanf("%x"). The program should allow the user to input the number. State any assumptions you made when writing the program. Use 23DA as a test number."
Ok, that was the question I have to "answer." Here's what I'm curious about, and would like some insight...if I can't use any of the standard C libraries, exactly how am I to input the number from the user? I am assuming I should keep this as simple as possible and create a console application, which is what I intend to do. How else would I get the input, I mean I could use command line arguments, but that's hardly allowing the "user to input the number." And I still wouldn't be able to display the number without using any of the standard libraries. Please, I need some clarification on this from all of the pros who help us intermediates on this site!!! Thanks so much
Douglas A. Wright
dawrigh3@kent.edu
|
|
|
|
|
DougwW48 wrote:
without using the standard C libraries
I assume this means don't use libraries for the conversion ONLY
DougwW48 wrote:
State any assumptions you made when writing the program
State that you assumed that standard libraries/CMD line args could be used for inputting the values. You could suggest that they tightend up their method of writing specifications!
It is amazing what you can accomplish if you do not care who gets the credit. - Harry S Truman
|
|
|
|
|
The mean purpose of the specification is to force you to design a solution without the help of a library API. It does not include I/O.
Kuphryn
|
|
|
|
|
They want to verify that you can handle the task of converting numbers from base 16 to base 10 without using stdlib - thus proving that you understand "COMPUTERS"
Can you
I doubt very much that their intent was to force you to write the simple but infinitely tedious console i/o routines.
|
|
|
|
|
Of course I can convert a hex number into decimal. You bit shift your total to the left 4 digits, then add the next number from your hex string! My biggest concern was that they specified not using scanf("%x") which I later looked up. You guys (and ladies) are all correct, they don't care that I use scanf, they just don't want me using %x because that will read a number already formatted in hexadecimal, which defeats the entire purpose of the program!
Thanks for the response though, I appreciate it!
Douglas A. Wright
dawrigh3@kent.edu
|
|
|
|
|
Does anybody know how to get the number and letters of local drives on a system?
|
|
|
|
|
|
I am new to designing my own OCX Controls and have managed to "hack" my way through and develop a workable control that seems to work. I was able to add in the Stock Properties OK and they too work. Somehow I managed to get Visual Studio (7.0) to add a COleControl wrapper class which is my interface to programatically change the stock properties. So far, so good.
I now wish to further add some variables that CxxxCtrl.cpp can access. It is at this point that I am throughly confused as to how to do this manually now that the control has been constructed.
A simple walk thru of "CWrapperClass::SetMyNewVariable(short NewVariable)" in the COleControl wrapper class and winding up in CxxxCtrl.h as "short m_MyNewVariable" in CxxxCtrl.h will do or even a reference to an article that will help me understand how to get from point A to point B.
This is strictly a run time function and does not to be persistantly stored or an ambient property.
Help, I'm running out of hair to pull out.
Thanks.
Barry
|
|
|
|
|
I want to be able to put in a line in the version info that specifies what the build is - e.g., Unicode Release, ASCII Debug, etc.
I tried to define a variable in the RC2 file (well, actually in an include file included from the RC2 file) that does this:
#ifdef _DEBUG
#ifdef UNICODE
#define VER_BUILDTYPE "Unicode Debug\0"
#else
#define VER_BUILDTYPE "ASCII/Multi-byte Debug\0"
#endif
#else
#ifdef UNICODE
#define VER_BUILDTYPE "Unicode\0"
#else
#define VER_BUILDTYPE "ASCII/Multi-byte\0"
#endif
#endif
PRoblem is, the define always says "ASCII/Multi-byte", as if UNICODE and _DEBUG aren't defined in resource files.
Is there any way to do what I'm attempting to do, short of going in the resource properies and manually defining symbols for all configurations?
Thanks.
"When a man sits with a pretty girl for an hour, it seems like a minute. But let him sit on a hot stove for a minute and it's longer than any hour. That's relativity." - Albert Einstein
|
|
|
|
|
Well, I found *one* way of doing what I want:
Simply define this string for all configurations in the "Resources" tab, "Defines" edit field:
VER_CFG=\"$(ConfigurationName)\0\"
And then reference VER_CFG wherever I need to in my RC files. This is less evil than having to put in the Debug and Unicode defines in the appropriate places, since at least one define can be used across all configurations here.
Still not sure why resources wouldn't automatically get the other project defines, though...
"When a man sits with a pretty girl for an hour, it seems like a minute. But let him sit on a hot stove for a minute and it's longer than any hour. That's relativity." - Albert Einstein
|
|
|
|
|
The defines are all passed in as command line arguments /Dxxxx=somevalue /Dxxxxx etc.
The resource compiler, MIDL compiler and C/C++ compiler all use individual settings. Defining _UNICODE isn't done for resource compilations or IDL compilations because it's a no-op. All resources are UNICODE for Win32 platforms.
In VC++6 you can go to 'Project/Settings' menu item, find your RC file and then see what additional defines you do/don't want for the various builds.
Steve S
|
|
|
|
|
I want to programmatically turn off the video signal so my display will power down into standby. I'd like to selectively turn off each video signal on a dual-channel VGA.
I did this years ago by tweaking a VGA register under DOS. Now I'm looking for a Windows API to do it.
Any suggestions? Examples?
Alternatively, I've heard there's a VESA standard to send device control info via the VGA port?
TIA
|
|
|
|
|
I have an application written in VC++6 that has been working great for some time, but I recently added a menu bar item with two submenu selections to respective message handlers.
It works well on my machine and any others in my group that have VC++ installed, but doesn't show any response, error or change if these new sub-menu items are selected on any other machine.
Our plant just changed over to XP at the same time, (so the water is now muddy!) but we can't find any hard correlation except that the custom menu selections (previously added in other versions) that used to work with the old workstations under Win98 are now giving a message
"Attempted an unsupported operation!"
Does anyone have any suggestions?
I will add some prompts to see if I even get into the message handler, but I don't think that it does!
David Leikis
ATK Thiokol Propulsion
Laboratory Automation
|
|
|
|
|
You may be using a library that is installed when you install VC++. Try compiling your project with a statically linked library instead for shared DLL.
|
|
|
|
|
Hi,
I would like to be able to resize the MDI before start up,
I mean, i want to make it really small,
How can I resize it in my code?
Ehsan Behboudi
|
|
|
|
|
The simplest solution I can think of:
BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
{
cs.y = my.y;
cs.x = my.x;
cs.cx = my.cx;
cx.cy = my.cy;
if( !CNewMDIChildWnd::PreCreateWindow(cs) )
return FALSE;
return TRUE;
}
INTP
|
|
|
|
|
Hi,
I have a MFC "multi-document" application where I draw a cube.
I want to be able to roate the cube by clicking on a button ...
+----------------------------------------------------------+
|:::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|:+---------------------------------------------+:::::::::
|:|ooooooooooooooooooooooooooooooooooooooooooooo|:::::::::
|:|ooooooooooooooooooooooooooooooooooooooooooooo|:::::::::
|:|ooooooooo+==============+oooooooooooooooooooo|:::::::::
|:|ooooooooo|\oooooooooooooo\ooooooooooooooooooo|:::::::::
|:|ooooooooo|o\oooooooooooooo\oooooooooooooooooo|:::::::::
|:|ooooooooo|oo\oooooooooooooo\ooooooooooooooooo|:::::::::
|:|ooooooooo|ooo\oooooooooooooo\oooooooooooooooo|:::::::::
|:|ooooooooo|oooo+==============+ooooooooooooooo|:::::::::
|:|oooooooooo\ooo|oooooooooooooo|ooooooooooooooo|:::::::::
|:|ooooooooooo\oo|oooooooooooooo|ooooooooooooooo|:::::::::
|:|oooooooooooo\o|oooooooooooooo|ooooooooooooooo|:::::::::
|:|ooooooooooooo\|oooooooooooooo|ooooooooooooooo|:::::::::
|:|oooooooooooooo+==============|ooooooooooooooo|:::::::::
|:|ooooooooooooooooooooooooooooooooooooooooooooo|:::::::::
|:|_____________________________________________||::::::::
|:|______________<PUSH2ROTATE>__________________||::::::::
|:|_____________________________________________||::::::::
|:+---------------------------------------------+:::::::::
Sorry for the ugly graphic above but I don't know enough about MFC (What things are called) to describe this in any other way. Please help
|
|
|
|
|
There are several solutions. One solution is a splitter window. One side is the control. The other side is the view.
Kuphryn
|
|
|
|
|
That will work. How do I go about making a splitter window?
|
|
|
|
|
There are a couple relatively easy ways, in addition to the splitter idea the other guy suggested.
1. Create a control dynamically. Have an object of, say, CButton, in your header file, and then in the view class initialization, create the button with the desired attributes. For instance:
// in header file
protected:
CButton myButton;
// in initialization function
myButton.Create(blah);
Look in MSDN for the parameters to Create, you will have size, position, caption, etc. One important one is the control ID. You can use that control ID in your message map so you can define a handler that controls what happens when the button is clicked.
2. Handle mouse clicks (e.g., OnMouseUp). Check if the mouse position is within a certain area, and then do whatever you feel like doing.
#1 is probably cleaner, since you get an actual button, but 2 is probably a little easier.
"When a man sits with a pretty girl for an hour, it seems like a minute. But let him sit on a hot stove for a minute and it's longer than any hour. That's relativity." - Albert Einstein
|
|
|
|
|
Hi,
I have posted this question before and got an answer, but for some reasons it doesn't seem to work, or I have the code at the wrong place.
I copy pasted the code in my InitInstance()
so now it looks like the following:
BOOL CMotionControllerApp::InitInstance()
{
// CG: The following block was added by the Splash Screen component.
\
{
\
CCommandLineInfo cmdInfo;
\
ParseCommandLine(cmdInfo);
\
\
CSplashWnd::EnableSplashScreen(cmdInfo.m_bShowSplash);
\
}
AfxEnableControlContainer();
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
// Change the registry key under which our settings are stored.
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization.
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
LoadStdProfileSettings(); // Load standard INI file options
// Register the application's document templates. Document templates
// serve as the connection between documents, frame windows and
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CMotionControllerDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CMotionControllerView));
AddDocTemplate(pDocTemplate);
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
/////////////////////////////////////////////////////
//This is the code, it is at the correct spot?
/////////////////////////////////////////////////////
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;
//////////////////////////////////////////////////////
// The one and only window has been initialized, so show and update
// m_pMainWnd->ShowWindow(SW_SHOWMAXIMIZED);
// m_pMainWnd->UpdateWindow();
return TRUE;
Ehsan Behboudi
|
|
|
|
|
Post the code that hides the window. One solution is SW_HIDE.
Kuphryn
|
|
|
|
|