Hello, Folks,
I am new to VC++ and I just added a form to my application. The GUI has a
group of checkboxes, a combo box, a text box and two buttons.
Will someone please walk me through getting the form to load and displayed
on my screen?
I greatly appreciate the help.
jazz 3 1205
The answer depends on what technique you are using. Is it pure WinAPI or MFC
or ATL.... etc
Basically here you can find the simplest way to initialize and display
dialog box is to execute the following piece of code:
#include <windows.h>
#define MY_CLASS_NAME "MyClass"
#define MY_WINDOW_TITLE "MyTitle"
/* Prototype */
LRESULT CALLBACK
WndProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow )
{
MSG msg;
WNDCLASS wc;
HWND hwnd;
/* Register the window class for the main window. */
if( hPrevInstance == NULL )
{
wc.style = 0;
wc.lpfnWndProc = (WNDPROC)WndPro c;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon( (HINSTANCE)NULL , IDI_APPLICATION );
wc.hCursor = LoadCursor( (HINSTANCE)NULL , IDC_ARROW );
wc.hbrBackgroun d = GetStockObject( WHITE_BRUSH );
wc.lpszMenuName = 0;
wc.lpszClassNam e = MY_CLASS_NAME;
if ( RegisterClass( &wc ) == 0 )
return 0;
}
/* Create our window. */
hwnd = CreateWindow( MY_CLASS_NAME, MY_WINDOW_TITLE , WS_OVERLAPPEDWI NDOW,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
(HWND)NULL, (HMENU)NULL, hInstance, (LPVOID)NULL );
/*
* If the window cannot be created, terminate
* the application.
*/
if( hwnd == NULL )
return 0;
/* Show the window and paint its contents. */
ShowWindow( hwnd, nCmdShow );
UpdateWindow( hwnd );
/* Start the message loop. */
while( GetMessage( &msg, (HWND)NULL, 0, 0 ) )
{
TranslateMessag e( &msg );
DispatchMessage ( &msg );
}
/* Return the exit code to the system. */
return msg.wParam;
}
#include <windows.h>
LRESULT CALLBACK WndProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM
lParam )
{
HINSTANCE hinst = (HINSTANCE)::Ge tWindowLong(hwn d, GWL_HINSTANCE);
witch( uMsg )
{
case WM_CREATE:
//Here is where dialog box will appear using your template
::DialogBox(hin st, MAKEINTRESOURCE (DLG_WINDOW), hwnd,
(DLGPROC)DlgWnd Proc)==IDOK
case WM_DESTROY:
PostQuitMessage ( 0 );
break;
default:
return( DefWindowProc( hwnd, uMsg, wParam, lParam ) );
}
return 0;
}
~~~~~~~~~~~~~~~
Rememeber to replace DLG_WINDOW with the ID of your own dialog window
Read the following article in order to decide whether you need to use modal
or modeless dialog box. It will also help you to write your own Dialog
procedure: http://msdn.microsoft.com/library/de...ialogBoxes.asp
if you use MFC you can find usefull reading the following article: http://msdn.microsoft.com/library/de...menuoption.asp
---
Roman
"Jazzkt" <ja**@msn.com > wrote in message
news:rZIYc.3410 43$%_6.339973@a ttbi_s01... Hello, Folks,
I am new to VC++ and I just added a form to my application. The GUI has a group of checkboxes, a combo box, a text box and two buttons.
Will someone please walk me through getting the form to load and displayed on my screen?
I greatly appreciate the help.
jazz
The answer depends on what technique you are using. Is it pure WinAPI or MFC
or ATL.... etc
Basically here you can find the simplest way to initialize and display
dialog box is to execute the following piece of code:
#include <windows.h>
#define MY_CLASS_NAME "MyClass"
#define MY_WINDOW_TITLE "MyTitle"
/* Prototype */
LRESULT CALLBACK
WndProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow )
{
MSG msg;
WNDCLASS wc;
HWND hwnd;
/* Register the window class for the main window. */
if( hPrevInstance == NULL )
{
wc.style = 0;
wc.lpfnWndProc = (WNDPROC)WndPro c;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon( (HINSTANCE)NULL , IDI_APPLICATION );
wc.hCursor = LoadCursor( (HINSTANCE)NULL , IDC_ARROW );
wc.hbrBackgroun d = GetStockObject( WHITE_BRUSH );
wc.lpszMenuName = 0;
wc.lpszClassNam e = MY_CLASS_NAME;
if ( RegisterClass( &wc ) == 0 )
return 0;
}
/* Create our window. */
hwnd = CreateWindow( MY_CLASS_NAME, MY_WINDOW_TITLE , WS_OVERLAPPEDWI NDOW,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
(HWND)NULL, (HMENU)NULL, hInstance, (LPVOID)NULL );
/*
* If the window cannot be created, terminate
* the application.
*/
if( hwnd == NULL )
return 0;
/* Show the window and paint its contents. */
ShowWindow( hwnd, nCmdShow );
UpdateWindow( hwnd );
/* Start the message loop. */
while( GetMessage( &msg, (HWND)NULL, 0, 0 ) )
{
TranslateMessag e( &msg );
DispatchMessage ( &msg );
}
/* Return the exit code to the system. */
return msg.wParam;
}
#include <windows.h>
LRESULT CALLBACK WndProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM
lParam )
{
HINSTANCE hinst = (HINSTANCE)::Ge tWindowLong(hwn d, GWL_HINSTANCE);
witch( uMsg )
{
case WM_CREATE:
//Here is where dialog box will appear using your template
::DialogBox(hin st, MAKEINTRESOURCE (DLG_WINDOW), hwnd,
(DLGPROC)DlgWnd Proc)==IDOK
case WM_DESTROY:
PostQuitMessage ( 0 );
break;
default:
return( DefWindowProc( hwnd, uMsg, wParam, lParam ) );
}
return 0;
}
~~~~~~~~~~~~~~~
Rememeber to replace DLG_WINDOW with the ID of your own dialog window
Read the following article in order to decide whether you need to use modal
or modeless dialog box. It will also help you to write your own Dialog
procedure: http://msdn.microsoft.com/library/de...ialogBoxes.asp
if you use MFC you can find usefull reading the following article: http://msdn.microsoft.com/library/de...menuoption.asp
---
Roman
"Jazzkt" <ja**@msn.com > wrote in message
news:rZIYc.3410 43$%_6.339973@a ttbi_s01... Hello, Folks,
I am new to VC++ and I just added a form to my application. The GUI has a group of checkboxes, a combo box, a text box and two buttons.
Will someone please walk me through getting the form to load and displayed on my screen?
I greatly appreciate the help.
jazz
Hey this guy is not talking about MFC form, or typical old (Petzold) style
window procedure. he is talking about WinForm of dot net 2003.
just press Ctrl-F5 and your form will be on your screen.
"Roman Yankin" <ro********@mai l.ru> wrote in message
news:uk******** ******@TK2MSFTN GP11.phx.gbl... The answer depends on what technique you are using. Is it pure WinAPI or
MFC or ATL.... etc
Basically here you can find the simplest way to initialize and display dialog box is to execute the following piece of code: #include <windows.h> #define MY_CLASS_NAME "MyClass" #define MY_WINDOW_TITLE "MyTitle" /* Prototype */ LRESULT CALLBACK WndProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow ) { MSG msg; WNDCLASS wc; HWND hwnd; /* Register the window class for the main window. */ if( hPrevInstance == NULL ) { wc.style = 0; wc.lpfnWndProc = (WNDPROC)WndPro c; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hInstance; wc.hIcon = LoadIcon( (HINSTANCE)NULL , IDI_APPLICATION ); wc.hCursor = LoadCursor( (HINSTANCE)NULL , IDC_ARROW ); wc.hbrBackgroun d = GetStockObject( WHITE_BRUSH ); wc.lpszMenuName = 0; wc.lpszClassNam e = MY_CLASS_NAME; if ( RegisterClass( &wc ) == 0 ) return 0; }
/* Create our window. */ hwnd = CreateWindow( MY_CLASS_NAME, MY_WINDOW_TITLE ,
WS_OVERLAPPEDWI NDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, (HWND)NULL, (HMENU)NULL, hInstance, (LPVOID)NULL ); /* * If the window cannot be created, terminate * the application. */ if( hwnd == NULL ) return 0; /* Show the window and paint its contents. */ ShowWindow( hwnd, nCmdShow ); UpdateWindow( hwnd ); /* Start the message loop. */ while( GetMessage( &msg, (HWND)NULL, 0, 0 ) ) { TranslateMessag e( &msg ); DispatchMessage ( &msg ); } /* Return the exit code to the system. */ return msg.wParam; }
#include <windows.h>
LRESULT CALLBACK WndProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) { HINSTANCE hinst = (HINSTANCE)::Ge tWindowLong(hwn d, GWL_HINSTANCE); witch( uMsg ) {
case WM_CREATE:
//Here is where dialog box will appear using your template
::DialogBox(hin st, MAKEINTRESOURCE (DLG_WINDOW), hwnd, (DLGPROC)DlgWnd Proc)==IDOK case WM_DESTROY: PostQuitMessage ( 0 ); break; default: return( DefWindowProc( hwnd, uMsg, wParam, lParam ) ); } return 0; } ~~~~~~~~~~~~~~~
Rememeber to replace DLG_WINDOW with the ID of your own dialog window
Read the following article in order to decide whether you need to use
modal or modeless dialog box. It will also help you to write your own Dialog procedure: http://msdn.microsoft.com/library/de...ialogBoxes.asp if you use MFC you can find usefull reading the following article: http://msdn.microsoft.com/library/de...menuoption.asp
---
Roman
"Jazzkt" <ja**@msn.com > wrote in message news:rZIYc.3410 43$%_6.339973@a ttbi_s01... Hello, Folks,
I am new to VC++ and I just added a form to my application. The GUI has
a group of checkboxes, a combo box, a text box and two buttons.
Will someone please walk me through getting the form to load and
displayed on my screen?
I greatly appreciate the help.
jazz
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: clintonG |
last post by:
Is there a document that explains the difference between the
Visual Studio .NET 2003 Combined Help Collection and the
MSDN Library for Visual Studio .NET 2003 or does someone
have comments describing the benefits of either or the other?
--
<%= Clinton Gallagher, "Twice the Results -- Half the Cost"
Architectural & e-Business Consulting -- Software Development
NET csgallagher@REMOVETHISTEXTmetromilwaukee.com
|
by: Larry Fix |
last post by:
I recently added help to a C# application using the Help.ShowHelp
method. My compiled help file gets display so that's good.
What's not so good is that the help window always starts out with a
very small size. Smaller than any page that's going to be displayed.
It's a real pain.
ShowHelp does not let you set the size. I can't find anyway to get a
hold of the help window after it's created so I can't hit it with the
resize hammer.
|
by: Tom marsh |
last post by:
I'm finishing an application and want to supply help files. However MS
Access's help files, ironically don't contain much help on HELP. What is
the best approach? I could easily just provide .doc files and shell out to
Wordpad.exe, but is there a better way? I'm using Access 2002. Any help is
appreciated.
|
by: deko |
last post by:
What's the best way to create a help system for Access 2003? Is MS HTML
Help Workshop the way to go? I want to put a clickable control on different
forms, that, when clicked, will bring up the help topic specific to that
form. Can this be done?
|
by: Junkguy |
last post by:
Hi,
I need help adding help to my Visual Studio 6 C# form application.
In searching around the Microsoft C# documentation for Visual Studio, I cannot
seem to discover how to add a menu item to bring up the Help Viewer within my
Windows Forms product. Everything there seems to deal only with the
HelpProvider tool. I don't want to use the HelpProvider, I simply want to open
the Table Of Contents in my application from a menu item for a...
| |
by: Rich Noons |
last post by:
Hi,
I'm currently trying to link a help file to an application. Everything is
linking correctly to the help topics (on the right hand side of the help
file). My problem is that the help contents on the left does not synchronise
to the topic displayed on the right hand side. (eg the tree structure opens)
and displays the associated topic. I've done this before with Win32 apps...
I'm using
|
by: JJ |
last post by:
Ok I have now got to grips with HTML help workshop and created my help
files, TOC etc.
Now how do I integrate this with my application? I have added an
errorprovider to my form and pointed it to my hhp file, but I am not sure
which is the correct next step.
Specifically my questions are:
1. How do I get the index, table of contents menu items to link to the help
file
|
by: WhiteWizard |
last post by:
Hello all,
I have been tasked with coming up with a system for providing help for our
users, and we have some somewhat unique requirements. NO INTERNET. This is
a windows application that will be running a good majority of the time at
about 60,000 feet.
I have done some previous work with and been reading about the "old" .chm
compiled html files and am leaning that way, but thought I would ask this
group what they thought, what...
|
by: TJ WIlson |
last post by:
Using Windows XP, my Access 2002 program works, but there are no help files. The help window opens, there is nothing there. I've tried repairing the installation, removing the installation and re-installing. Nothing works. I really need this to work, I've even tried the new downloads for help from MS, but it didn't help.
|
by: =?Utf-8?B?cnViZW4=?= |
last post by:
Hi developers,
Maybe this will sound silly, but I need help placing an icon in a menu when
setup is build in .Net through a setup project.
Really what I need is indicate the help icon (html help workshop file), I
couldn't find other way than copy the icon in the application folder and I
know HAVE TO BE another way to do it.
Please, I'll appreciate any help, Thanks.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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...
|
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...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |