Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Options list in MS C++ console applications 1

Status
Not open for further replies.

Pogonel

Programmer
Mar 8, 2001
2
CA
Hey there,
Is it possible to create an options list in MS C++ that will
run in DOS mode ?
Thanks in advance

 
Yes it is.
for example:
--------
#include<windows.h>
int main()
{
MessageBox(0,&quot;&quot;,&quot;&quot;,0);
return 0;
}
--------
or an other example
--------
#include<windows.h>
#include<iostream>
using namespace std;
LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);
int main()
{
WNDCLASS* wndclass=new WNDCLASS;
MSG* msg=new MSG;
HWND hWnd;
char* name=&quot;name&quot;;
wndclass->cbClsExtra=0;
wndclass->cbWndExtra=0;
wndclass->hbrBackground=(HBRUSH)1;
wndclass->hCursor=LoadCursor(NULL,IDC_ARROW);
wndclass->hIcon=LoadIcon(NULL,IDI_APPLICATION);
wndclass->hInstance=GetModuleHandle(0);
wndclass->lpfnWndProc=WndProc;
wndclass->lpszClassName=name;
wndclass->lpszMenuName=0;
wndclass->style=CS_HREDRAW|CS_VREDRAW;
RegisterClass(wndclass);
hWnd=CreateWindow(name,name,WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,0,0,GetModuleHandle(0),0);
ShowWindow(hWnd,SW_SHOW);
UpdateWindow(hWnd);
while(GetMessage(msg,0,0,0))
{
TranslateMessage(msg);
DispatchMessage(msg);
}

return 0;
}
LRESULT CALLBACK WndProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam)
{
cout<<&quot;message:&quot;<<hex<<message<<endl;
switch(message)
{
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return DefWindowProc(hWnd,message,wParam,lParam);
}
-------
Look at the second parameter of GetMessage. Is your hWnd.
 
Thanks JonhFill for your reply,
I'm very new programmer in MS C++ that's why maybe I dont
realy see where is the list ?
In fact I would need to create a list like
_____________
| Option 1 |
| Option 2 |
| Option 3 |
|__Option 4_|

Any example would be veeeeeeeeeeeeeeeeery appreciated.
Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top