473,782 Members | 2,458 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

overlap windows, how is it possible?

dag
Hi!

I would like to do an overlap window, over my main window (of my
application), with a Progress Bar. Exactly when I push a button of my
application I want show a window, with a Progress bar, during the processing
time.

The first question is: Is it possible to have an overlap window? (I create
my windows by the "CreateWindowEx " command) By which command

Is possible to create a "MessageBox " with a progress bar?

Someone know where can I found some sample like this?

I tried to do that first with the application below, maybe someone can give
a look and suggest me something, thanks!!

#include <windows.h>
#include <commctrl.h>

HINSTANCE g_hInst = NULL; // Handle to the application instance
HWND g_hwndMain = NULL; // Handle to the application main window
HWND g_hwndMain2 = NULL; // Handle to the application main window
TCHAR g_szTitle[80] = TEXT ("Main Window"),
// Application main window name
g_szClassName[80] = TEXT ("Main window class");
// Main window class name
#define ID_COMPONTXT 1
/*************** *************** *************** *************** ***********

FUNCTION:
WndProc

PURPOSE:
The callback function for the main window. It processes messages that
are sent to the main window.

*************** *************** *************** *************** ***********/
LRESULT CALLBACK WndProc (HWND hwnd, UINT umsg, WPARAM wParam,
LPARAM lParam)
{
switch (umsg)
{
// Add cases such as WM_CREATE, WM_COMMAND, WM_PAINT if you don't
// want to pass these messages along for default processing.

case WM_CLOSE:
DestroyWindow (g_hwndMain);
return 0;

case WM_DESTROY:
PostQuitMessage (0);
return 0;
}

return DefWindowProc (g_hwndMain, umsg, wParam, lParam);
}

/*************** *************** *************** *************** ***********

FUNCTION:
InitInstance

PURPOSE:
Create and display the main window.

*************** *************** *************** *************** ***********/
BOOL InitInstance (HINSTANCE hInstance, int iCmdShow)
{

g_hInst = hInstance;
g_hwndMain2 = CreateWindow (
g_szClassName, // Registered class name
g_szTitle, // Application window name
WS_OVERLAPPED, // Window style
70, // Horizontal position of the window
120, // Vertical position of the window
100, // Window width
100, // Window height
NULL, // Handle to the parent window
NULL, // Handle to the menu the identifier
hInstance, // Handle to the application instance
NULL); // Pointer to the window-creation data
g_hwndMain = CreateWindow (
g_szClassName, // Registered class name
g_szTitle, // Application window name
WS_EX_CLIENTEDG E, // Window style
CW_USEDEFAULT,//70, // Horizontal position of the window
CW_USEDEFAULT,//120, // Vertical position of the window
CW_USEDEFAULT,//100, // Window width
CW_USEDEFAULT,//100, // Window height

NULL, // Handle to the parent window
NULL, // Handle to the menu the identifier
hInstance, // Handle to the application instance
NULL); // Pointer to the window-creation data
// If it failed to create the window, return FALSE.
if (!g_hwndMain)
return FALSE;

ShowWindow (g_hwndMain, iCmdShow);
UpdateWindow (g_hwndMain);

// If it failed to create the window, return FALSE.
if (!g_hwndMain2)
return FALSE;

ShowWindow (g_hwndMain2, iCmdShow);
UpdateWindow (g_hwndMain2);
return TRUE;

}

/*************** *************** *************** *************** ***********

FUNCTION:
InitApplication

PURPOSE:
Declare the window class structure, assign values to the window class
structure members, and register the window class.

*************** *************** *************** *************** ***********/
BOOL InitApplication (HINSTANCE hInstance)
{
WNDCLASS wndclass;

wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWn dProc = (WNDPROC)WndPro c;
wndclass.cbClsE xtra = 0;
wndclass.cbWndE xtra = 0;
wndclass.hIcon = NULL;
wndclass.hInsta nce = hInstance;
wndclass.hCurso r = NULL;
wndclass.hbrBac kground = (HBRUSH) GetStockObject (WHITE_BRUSH);
wndclass.lpszMe nuName = NULL;
wndclass.lpszCl assName = g_szClassName;

return RegisterClass (&wndclass);
}

/*************** *************** *************** *************** ***********

FUNCTION:
WinMain

PURPOSE:
The WinMain function of the application. It is called by the system as
the initial entry point for this Windows CE-based application.

*************** *************** *************** *************** ***********/
int WINAPI WinMain (
HINSTANCE hInstance, // Handle to the current instance
HINSTANCE hPrevInstance, // Handle to the previous instance
LPWSTR lpCmdLine, // Pointer to the command line
int iCmdShow) // Shows the state of the window
{
MSG msg; // Message structure
HACCEL hAccel; // Handle of the accelerator
// table
// Use this code to prevent your application from starting twice
// assuming that your application has not changed its window text

if (FindWindow(g_s zClassName, g_szTitle)){
SetForegroundWi ndow(FindWindow (g_szClassName, g_szTitle));
return FALSE;
}
if (!hPrevInstance )
{
if (!InitApplicati on (hInstance))
return FALSE;
}

if (!InitInstance (hInstance, iCmdShow))
return FALSE;
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

// Initialize the common controls and then create the progress bar.
int i;
int iSpacing; // Controls the size of the progress bar.
HWND hwndPB, h1, hC2; // Handle of progress bar.
INITCOMMONCONTR OLSEX iccInit;
RECT rcClient, rcClient2; // Client area of the application window.

// Initialize the common controls.
iccInit.dwSize = sizeof(iccInit) ;
iccInit.dwICC = ICC_PROGRESS_CL ASS;
InitCommonContr olsEx(&iccInit) ;

// Create the window for the progress bar.
GetClientRect(g _hwndMain2, &rcClient2);
iSpacing = (int)(0.10 * (rcClient2.righ t - rcClient2.left) );

GetClientRect(g _hwndMain, &rcClient);
iSpacing = (int)(0.10 * (rcClient.right - rcClient.left)) ;
hwndPB = CreateWindowEx( 0,
PROGRESS_CLASS ,
TEXT("Progess Bar"),
WS_CHILD | WS_VISIBLE ,
rcClient.left + iSpacing,
(int)((rcClient .bottom - rcClient.top)/2 - iSpacing),///2),
rcClient.right - 2 * iSpacing,
iSpacing,
g_hwndMain2,
NULL,
hInstance,
NULL);
/*h1 = CreateWindowEx( 0,
PROGRESS_CLASS ,
TEXT("Progess Bar"),
WS_CHILD | WS_VISIBLE ,
rcClient.left + iSpacing,
(int)((rcClient .bottom - rcClient.top)/2 - iSpacing),///2),
rcClient.right - 2 * iSpacing,
iSpacing,
g_hwndMain,
NULL,
hInstance,
NULL);*/

hC2 = CreateWindowEx (WS_EX_CLIENTED GE, TEXT ("edit"),
TEXT (""), WS_VISIBLE | WS_CHILD | ES_MULTILINE
|WS_VSCROLL ,//| WS_DISABLED,
0, 0, 100, 100, g_hwndMain, (HMENU)ID_COMPO NTXT,
hInstance, NULL);

/*MessageBox(hwn dPB,
NULL,TEXT ("Fra"), MB_OKCANCEL);*/

//Display the progress bar.
ShowWindow(g_hw ndMain2, iCmdShow);
UpdateWindow(g_ hwndMain2);

//Display the progress bar.
ShowWindow(g_hw ndMain, iCmdShow);
UpdateWindow(g_ hwndMain);

if(!h1)
{
MessageBox(g_hw ndMain, TEXT("Unable to create the progress bar"),
TEXT("Progress Bar"), MB_OK);
return FALSE;
}

// Set the range and increment of the progress bar.
SendMessage(hwn dPB, PBM_SETRANGE, 0, MAKELPARAM(0,20 0));
SendMessage(hwn dPB, PBM_SETSTEP, 2, 0);//MAKEWPARAM(2, 0), 0

// Send data to the progress bar to make it advance.
for(i=0 ; i < 100 ; i++)
{
SendMessage(hwn dPB, PBM_STEPIT, 0, 0);
Sleep(10);
}
// Set the range and increment of the progress bar.
SendMessage(h1, PBM_SETRANGE, 0, MAKELPARAM(0,20 0));
SendMessage(h1, PBM_SETSTEP, 2, 0);//MAKEWPARAM(2, 0), 0

// Send data to the progress bar to make it advance.
for(i=0 ; i < 100 ; i++)
{
SendMessage(h1, PBM_STEPIT, 0, 0);
Sleep(10);
}
DestroyWindow (g_hwndMain2);
DestroyWindow (g_hwndMain);

//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

// Insert code here to load the accelerator table.
// hAccel = LoadAccelerator s (...);

while (GetMessage (&msg, NULL, 0, 0))
{
if (!TranslateAcce lerator (
g_hwndMain, // Handle to the destination window
hAccel, // Handle to the accelerator table
&msg)) // Address of the message data
{
TranslateMessag e (&msg);
DispatchMessage (&msg);
}
}
return msg.wParam;
}

Sep 20 '05 #1
0 1866

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2583
by: Dag Sunde | last post by:
Is there any way to make a <div> section overlap the (windowed) content of a java Applet? I'm asking this, because JavaScript menus usually ends up beneath Applet windows... -- Dag.
2
4799
by: John Baker | last post by:
HI; I have a table where the user is entering data which shows scheduling for member of teams. One problem we have encountered is that sometimes the inputter (is this a word) puts in dates for an individual that overlap, creating all sorts of problems. One record is entered for each scheduled event (each one is a day in length or more), so that an individual will have multiple events on the table. For the purposes of this question,...
0
485
by: dag | last post by:
Hi! I would like to do an overlap window, over my main window (of my application), with a Progress Bar. Exactly when I push a button of my application I want show a window, with a Progress bar, during the processing time. The first question is: Is it possible to have an overlap window? (I create my windows by the "CreateWindowEx" command) By which command
6
19186
by: Robin Haswell | last post by:
Hey guys I was wondering if you could give me a hand with something. If I have two tuples that define a range, eg: (10, 20), (15, 30), I need to determine whether the ranges overlap each other. The algo needs to catch: (10, 20) (15, 25) (15, 25) (10, 20) (10, 25) (15, 20) and
13
3167
by: Mike S | last post by:
I came across the following paragraph in the "Semantics" section for simple assignment in N1124 (C99 draft) and I'm wondering if I'm interpreting it right: 6.5.16.1p3: If the value being stored in an object is read from another object that overlaps in any way the storage of the first object, then the overlap shall be exact and the two objects shall
7
9305
by: Cruelemort | last post by:
All, I have a div in my page that has a set width of 1000px, height of 200px, inside this i declare two more div's, both relatively positioned and floated left, the first is placed to the top left of the box and is a 30px square, the other one is set to 970px and is naturally positioned next to the square and so fills all the way to the right hand edge of the box. Now i need the second (wider) box to overlap the square and so start
1
1649
Traveler33
by: Traveler33 | last post by:
When a custom control moves, how to detect when it encounter or overlap with another control? Platform: Windows XP sp2 Language: C#.net express 2005
3
3635
by: Justin | last post by:
What is the syntax to overlap partitions? Lets assume I want a year split amount 4 months (3 partitions for a year) and later adding an additional set of partitions for every 6 months. Plus giving us the option to detach old partitions. For example: CREATE TABLE orders(id INT, shipdate DATE, …) PARTITION BY RANGE(shipdate) ( PARTITION m12y05 STARTING MINVALUE,
5
10877
by: liketofindoutwhy | last post by:
It seems like there are only 4 methods to overlap 2 images using CSS? There are two images, each with its own URL. Using CSS, there seems to be 2 ways to overlap them (the task is actually to put a "play button" image with size 50 x 50 on top of the bigger image which is a video thumbnail size 200 x 150). 1) Use <div><img ><img ></divwith the play button as the second image and displayed relatively positioned to overlap the first...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10313
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10146
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9944
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8968
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7494
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5378
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4044
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.