473,385 Members | 1,908 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Trying to make windows

Hi,

Sorry I couldn't come up with a better subject.
I've been trying to get this thing workin but with no luck.
I've never done any GUI stuff with C++ before so I'm new to this.

I'll post the code here that I'm having a hard time with.

============ code start ============
class Window
{
public:
Window (): _hClient(0) {}
Window ( char const * caption, char const * className, HINSTANCE
hInstance )
{
// Obtain handles to two possible menus & submenus
hMenuInit = LoadMenu (hInstance, "MdiMenuInit") ;
hMenuThingz = LoadMenu (hInstance, "DRAWAPP") ;
hMenuInitWindow = GetSubMenu (hMenuInit, 0) ;
hMenuThingzWindow = GetSubMenu (hMenuThingz, 0) ;
hAccel = LoadAccelerators (hInstance, "MdiAccel") ;

_hClient = CreateWindow(
className,
caption,
WS_CHILD | WS_CLIPCHILDREN | WS_HSCROLL | WS_VSCROLL,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
NULL, //hWnd
hMenuInit,
hInstance,
NULL);
if (_hClient == 0)
throw "Window Creation Failed";
}
void Show ( int nCmdShow )
{
::GetWindow (_hClient, GW_CHILD);
::ShowWindow ( _hClient, nCmdShow );
::UpdateWindow ( _hClient );
}
operator HWND() { return _hClient; }
protected:
HWND hWnd;
HWND _hClient;
HWND hwndClient;
CLIENTCREATESTRUCT ccs;

HMENU hMenuInit, hMenuThingz;
HMENU hMenuInitWindow, hMenuThingzWindow;
HANDLE hAccel;
};
============ code end ============

This thing allways fails. The _hClient is allways 0.
I can't figure out why it won't work. I would really appreciate
any help. I'll try to answer any questions if you have any.

----
mkarja

Jul 23 '05 #1
2 1332
mkarja wrote:
Sorry I couldn't come up with a better subject.
This one's good enough.
I've been trying to get this thing workin but with no luck.
I've never done any GUI stuff with C++ before so I'm new to this.

I'll post the code here that I'm having a hard time with.

============ code start ============
class Window
{ [...] hMenuInit = LoadMenu (hInstance, "MdiMenuInit") ; [...] _hClient = CreateWindow( [...] ::GetWindow (_hClient, GW_CHILD); [...] ============ code end ============

This thing allways fails. The _hClient is allways 0.
So, 'CreateWindow' returns 0, right?
I can't figure out why it won't work. I would really appreciate
any help. I'll try to answer any questions if you have any.


Try to post to the right newsgroup: comp.os.ms-windows.programmer.win32
Here things like 'LoadMenu', 'CreateWindow', 'GetWindow', are off-topic
since they have really nothing to do with C++ _language_.

V
Jul 23 '05 #2
Thanks for the answer.
I tried to look for a suitable newsgroup, but couldn't find any better
than this. I'll post this on the group you suggested, thanks.

----
mkarja

Jul 23 '05 #3

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

Similar topics

1
by: Larry | last post by:
I am a C++/Java programmer trying to get going with some simpe xml transformations at work here. I bought the O'Reilly book Learning xlst for kicks. Someone at work sent me this xml shown below,...
4
by: Mark J. McGinty | last post by:
Greets, Part of the content of one of our web pages uses wingdings and Chr(239) through Chr(242) (which are little arrow outlines, though that's not really important.) It worked just fine in...
5
by: The Beast | last post by:
I'm trying to create a thread to write to the serial port and I keep getting an odd error cannot convert parameter 3 from 'unsigned long (void *)' to 'unsigned long (__stdcall *)(void *)' and...
2
by: anoniem | last post by:
Hello, I am trying to make a script which will for example automatically move the mousepointer from one position to another and then click leftmousebutton. I am looking for code-examples....
5
by: tshad | last post by:
I am trying to access my log files and am running into a permissions problem. I am doing the following: ****************************************************************** private void...
2
by: baret bonden | last post by:
Trying to return a selected listbox item to another form .tried lots of ways; defining public variables and passing those as well as textboxes ..I' m able to display the chosen item on it's form...
7
by: John Blair | last post by:
Hi, I am trying to get the datacache1 sample working on my PC. I have downloaded the MSDE 2000 sample SQL Server database and the pubs sample database and installed it. I can view the contents...
5
by: snicks | last post by:
I'm trying to exec a program external to my ASP.NET app using the following code. The external app is a VB.NET application. Dim sPPTOut As String sPPTOut = MDEPDirStr + sID + ".ppt" Dim p As...
13
by: ragtag99 | last post by:
I posted this on comp.lang.asm.x86, alt.os.development, comp.arch, comp.lang.c++ Im working with windows xp professional, NTFS and programming with MASM, c++ (free compiler) or visual basic 6.0...
34
by: Anthony Irwin | last post by:
Hi All, I am currently trying to decide between using python or java and have a few quick questions about python that you may be able to help with. #1 Does python have something like javas...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
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,...
0
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...
0
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...

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.