Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

demonrealms

The last straw - Create(); ?

This topic is 5493 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Look at the next post. Please tell me what's wrong!! I'm about to go insane with all these problems lol. Thanks in advance, demonrealms [edited by - demonrealms on October 8, 2003 7:12:03 PM]

Share this post


Link to post
Share on other sites
Advertisement
Wait, I''ve got a whole new problem. I got the Dailog box to show, but when I added a textbox to it, it complied fine, but it came back to be saying the Dailog was Null, and I can''t get it to show up. When I take away the textbox, it shows up again with no error. Any idead on whats wrong? I''m using vc++ 6.0 complier and tried to put in a activex text box called: Microsoft forms 2.0 textbox

Share this post


Link to post
Share on other sites
My code is here
#define WIN32_LEAN_AND_MEAN  // just say no to MFC


#include <windows.h> // include all the windows headers

#include <windowsx.h> // include useful macros

#include <stdio.h>
#include <math.h>
#include <fstream.h>
#include <iostream.h>
#include "resource.h"
#include "commctrl.h"

// DEFINES ////////////////////////////////////////////////


// defines for windows

#define WINDOW_CLASS_NAME "WINCLASS1"

// GLOBALS ////////////////////////////////////////////////

HWND g_hToolbar = NULL;
// FUNCTIONS //////////////////////////////////////////////


BOOL CALLBACK ToolDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch(Message)
{
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDC_PRESS:
MessageBox(hwnd, "Hi!", "This is a message",
MB_OK | MB_ICONEXCLAMATION);
break;
case IDC_OTHER:
MessageBox(hwnd, "Bye!", "This is also a message",
MB_OK | MB_ICONEXCLAMATION);
break;
}
break;
default:
return FALSE;
}
return TRUE;

}

BOOL CALLBACK AboutDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch(Message)
{
case WM_INITDIALOG:

return FALSE;
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDOK:
EndDialog(hwnd, IDOK);
break;
}
break;
default:
return FALSE;
}
return FALSE;
}


LRESULT CALLBACK WindowProc(HWND hwnd,
UINT msg,
WPARAM wparam,
LPARAM lparam)
{
// this is the main message handler of the system

PAINTSTRUCT ps; // used in WM_PAINT

HDC hdc; // handle to a device context


switch(msg)
{
case WM_LBUTTONDOWN:
{
MessageBox(NULL, "I''ve just created your new file", "Lost Realms Studios", MB_ICONEXCLAMATION);
ofstream datafile001( "Rpad.txt" );
datafile001 << "Welcome to the new Rpad software!" << endl << endl
<< "This new software allows you to create various items." << endl
<< "These varous items include web design and ASCII saving." << endl;
datafile001.close();
ofstream datafile002( "config.data" );
datafile002 << "[file]" << endl << endl
<< "[new file]=TRUE;" << endl
<< "([prj->n] -> ? : 0)=TRUE" << endl;
datafile002.close();
} // <-

// <- we just added this stuff

break;
case WM_RBUTTONDOWN:
{
break;
}
case WM_CREATE:
g_hToolbar = CreateDialog(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_TOOLBAR),
hwnd, ToolDlgProc);
if(g_hToolbar != NULL)
{
ShowWindow(g_hToolbar, SW_SHOW);
}
else
{
MessageBox(hwnd, "CreateDialog returned NULL", "Warning!",
MB_OK | MB_ICONINFORMATION);
}
break;
case WM_COMMAND:
switch(LOWORD(wparam))
{
case ID_FILE_EXIT:
PostMessage(hwnd, WM_CLOSE, 0, 0);
break;
case ID_DIALOG_SHOW:
ShowWindow(g_hToolbar, SW_SHOW);
break;
case ID_DIALOG_HIDE:
ShowWindow(g_hToolbar, SW_HIDE);
break;
}
break;

case WM_PAINT:
{
// simply validate the window

hdc = BeginPaint(hwnd,&ps);

// you would do all your painting here

EndPaint(hwnd,&ps);

// return success

return(0);
} break;

case WM_DESTROY:
{
// kill the application, this sends a WM_QUIT message

PostQuitMessage(0);

// return success

return(0);
} break;

default:break;

} // end switch


// process any messages that we didn''t take care of

return (DefWindowProc(hwnd, msg, wparam, lparam));

} // end WinProc
But that can''t be the problem can it? B/c It works untill I put up any active X controls then It comes back sayinmg the Dialog is null and not showing up.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!