?
Solved

Act like CreateDialog()

Posted on 1998-05-29
8
Medium Priority
?
379 Views
Last Modified: 2013-12-03
Not using MFC.
I would like to know what style(s) to register a window class with, and what style(s) to create a window with so that it will act like a window created with CreateDialog().
That is:
1) Will not create an item in the taskbar.
2) Will remain on top of my application.
3) Will allow focus to be transferred to my application.
Any help would be appreciated.
0
Comment
Question by:PhilC
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 4

Expert Comment

by:tflai
ID: 1405322
1)  extended style WS_EX_TOOLWINDOW
2)  WS_POPUP (don't forget the styles for title bar, system menu, minimize/maximize, ....)
Look at the property dialog box for a dialog box resource in MSVC's resource editor.  And take a look at help for CreateWindow() and CreateWindowEx() API's.

0
 
LVL 22

Expert Comment

by:nietod
ID: 1405323
You don't want the WS_EX_TOOLWINDOW style.  That will produce a smaller caption.

I use
WS_POPUPWINDOW | WS_DLGFRAME | WS_THICKFRAME | WS_OVERLAPPED | WS_CLIPSIBLINGS,

and for extended styles.
WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE

You can always use Spy++ to see what a :"real" dialog uses.
0
 
LVL 4

Expert Comment

by:tflai
ID: 1405324
Yeh, nietod is right.  Since the dialog box is not your main application window, it won't show up on the taskbar even without WS_EX_TOOLWINDOW.  That's only if you want your main window not to show up on the taskbar.
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 

Author Comment

by:PhilC
ID: 1405325
This is how I'm registering my window class:

myclass.cbSize = sizeof(menwndclass);
myclass.style     = CS_HREDRAW | CS_VREDRAW;
myclass.lpfnWndProc = MyProc;
myclass.cbClsExtra  =0;
myclass.cbWndExtra = 0;
myclass.hInstance = hInstance;
myclass.hIcon = LoadIcon(hInstance,MAKEINTRESOURCE(APP_ICON));
myclass.hCursor = NULL;
myclass.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH);
myclass.lpszMenuName =  NULL;
myclass.lpszClassName = "My Class";
myclass.hIconSm = LoadIcon(hInstance,MAKEINTRESOURCE(APP_ICON));
RegisterClassEx(&myclass);

This is how I am creating the window:

MyWindow = CreateWindowEx(WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE | WS_EX_CONTROLPARENT,"My Class","MY Title",
WS_POPUPWINDOW | WS_OVERLAPPED | WS_MINIMIZEBOX | WS_CLIPSIBLINGS | WS_VSCROLL | WS_DLGFRAME | DS_MODALFRAME,
0,0,0,0,NULL,NULL,(HINSTANCE)GetWindowLong(MainWnd,GWL_HINSTANCE),NULL);


0
 

Author Comment

by:PhilC
ID: 1405326
I still get item in task bar, and can switch back and forth
0
 
LVL 1

Accepted Solution

by:
marvinm earned 400 total points
ID: 1405327
Need to set the parent window
0
 
LVL 1

Expert Comment

by:marvinm
ID: 1405328
MyWindow = CreateWindowEx(WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE | WS_EX_CONTROLPARENT,"My Class","MY Title",
WS_POPUPWINDOW | WS_OVERLAPPED | WS_MINIMIZEBOX | WS_CLIPSIBLINGS | WS_VSCROLL | WS_DLGFRAME | DS_MODALFRAME,
0,0,0,0,

/** parent window goes here **/NULL

,NULL,(HINSTANCE)GetWindowLong(MainWnd,GWL_HINSTANCE),NULL);

0
 

Author Comment

by:PhilC
ID: 1405329
That did the trick. thanks
0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question