Solved

Act like CreateDialog()

Posted on 1998-05-29
8
363 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
 

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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
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 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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

707 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now