Solved

Act like CreateDialog()

Posted on 1998-05-29
8
367 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
  • 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 

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 100 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
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…

786 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