Solved

Act like CreateDialog()

Posted on 1998-05-29
8
378 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
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 

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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

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.…
In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
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…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

626 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