demonrealms

Members
  • Content count

    478
  • Joined

  • Last visited

Community Reputation

122 Neutral

About demonrealms

  • Rank
    Member
  1. Hey everyone, my server got hacked and I got it reset. Ever since then I replaced my site and started new yahoo.com no longer displays my site under Demon Realms Studios. Instead when I typed in www.demonrealmstudios.com in the search engine it displayed Index of/. How do I change it back? Thanks in advance.
  2. DX-C++ error

    I have the DirectX 9 installed (Debug Version). And what I mean by crahsing is it comes up as a normal window and then comes up with the Windows Standard "Would you like to send this error to microsoft" dialog box. Then I hit Don't Send and it exits the application. [Edited by - demonrealms on August 30, 2004 9:37:35 PM]
  3. DX-C++ error

    I'm wondering why I can't get this code to work. I followed what my book said, and it doesn't work. I think the author who wrote this book should start thinking of a new career b/c this is the 18th time I've come to thsi forum asking a question about this book b/c the author doesn't know worth crap. So could someone from forum please help out? Here's my code, I'm trying to use DX 9 to Load an X file (bitmap) form my computer to display. But it keeps crashing, here's the code: #define WIN32_LEAN_AND_MEAN #include <d3d9.h> #include <d3dx9.h> #include <windows.h> #include <windowsx.h> //Defines here #define WINDOW_CLASS_NAME "winclass" //Globals here LPDIRECT3D9 pD3D; LPDIRECT3DDEVICE9 pd3dDevice; D3DPRESENT_PARAMETERS d3dpp; IDirect3DSurface9* surface; IDirect3DSurface9* backbuffer = NULL; HWND hwnd; bool fscreen = false; //prototypes here void render(void); bool initDirect3D(); void Cleanup(void); /********************************************************************* * WndProc *********************************************************************/ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_CHAR: { case VK_ESCAPE: { PostQuitMessage(0); }break; }break; case WM_DESTROY: PostQuitMessage(0); break; } return DefWindowProc(hWnd, message, wParam, lParam); } /************************************************************* * WinMain * **************************************************************/ int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hprevinstance, LPSTR lpcmdline, int ncmdshow) { MSG msg; WNDCLASSEX winclass; winclass.cbSize = sizeof( WNDCLASSEX ); winclass.cbClsExtra = 0; winclass.cbWndExtra = 0; winclass.hbrBackground = (HBRUSH)CreateSolidBrush(RGB(255,255,255)); winclass.hCursor = LoadCursor(NULL, IDC_ARROW); winclass.hIcon = LoadIcon(NULL, IDI_INFORMATION); winclass.hIconSm = LoadIcon(NULL, IDI_INFORMATION); winclass.hInstance = hinstance; winclass.lpfnWndProc = WndProc; winclass.lpszClassName = WINDOW_CLASS_NAME; winclass.lpszMenuName = NULL; winclass.style = CS_DBLCLKS | CS_OWNDC | CS_HREDRAW | CS_VREDRAW; if(!(RegisterClassEx(&winclass))) { //error, quit application return(0); } if(!(hwnd = CreateWindowEx(NULL, WINDOW_CLASS_NAME, "Getting to learn the DRS Script Engine", WS_OVERLAPPEDWINDOW | WS_VISIBLE, 0,0, 640,480, NULL, NULL, hinstance, NULL))) { //error, quit application return(0); } if(!initDirect3D()) { return false; } while(msg.message != WM_QUIT) { if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { if(msg.message == WM_QUIT) { break; } //translate msg TranslateMessage(&msg); //send message to window proc DispatchMessage(&msg); } else { render(); } } Cleanup(); return(msg.wParam); } bool initDirect3D() { if( NULL == (pD3D = Direct3DCreate9( D3D_SDK_VERSION )) ) return false; d3dpp.BackBufferCount = 1; d3dpp.BackBufferFormat = D3DFMT_UNKNOWN; d3dpp.BackBufferWidth = 640; d3dpp.BackBufferHeight = 480; d3dpp.hDeviceWindow = hwnd; d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; d3dpp.Windowed = TRUE; pD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pd3dDevice); HRESULT hr = pd3dDevice->CreateOffscreenPlainSurface( 640, 480, D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &surface, NULL); if(FAILED( hr )) { return false; } D3DXLoadSurfaceFromFile( surface, NULL, NULL, "test.bmp", NULL, D3DX_DEFAULT, 0, NULL); return true; } void render(void) { if( pd3dDevice == NULL ) return; pd3dDevice->Clear(0, 0, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0,0,255), 1.0f, NULL); pd3dDevice->GetBackBuffer( 0, 0, D3DBACKBUFFER_TYPE_MONO, &backbuffer); pd3dDevice->StretchRect(surface, NULL, backbuffer, NULL, D3DTEXF_NONE); pd3dDevice->Present( NULL, NULL, NULL, NULL ); } void Cleanup(void) { if(pD3D != NULL) { pD3D->Release(); } if(pd3dDevice != NULL) { pd3dDevice->Release(); } }
  4. Email programming

    well so far I'm leaning toward the .NET post with the smtp. But I'm still running Visual Studio 6. Can I run .NET code on this platform? Or is it to outdated?
  5. Hey, I want to create a basic program that emails people. Is there any API's (or functions of Win32) out there that support this? Thanks in advance for reading.
  6. This book is really getting old. The author is just plain stupid. Every new lesson so far I've had to come to this forum to ask why it's not working, to find out the authour just well...sux at coding. Well anyway here it goes, it keeps giving me an error "failed ot initDirect3D" which was programmed in by the author to say if the application failed when it hit initDirect3D. I got a GeForceFX5700LE so I know it's not my video card anymore. I also know the code compiles and builds but none of them work on the CD, or the one's I create. So here's my code: /**************************************************************** * example3 * shows the user how to setup either a fullscreen or windowed * directx application ****************************************************************/ #include <windows.h> // include directx9 #include <d3d9.h> // global variables HINSTANCE hInst; // application instance HWND wndHandle; // application window handle bool bFullScreen = false; LPDIRECT3D9 pD3D; // the Direct3D Object LPDIRECT3DDEVICE9 pd3dDevice; // the Direct3D Device ////////////////////////////////////////////// forward declarations bool initWindow(HINSTANCE hInstance); LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); // DirectX functions bool initDirect3D(); void render(void); /********************************************************************* * WinMain *********************************************************************/ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { // put up a messagebox requesting the user to chose between a // fullscreen or windowed application if (MessageBox(NULL, "Would you like fullscreen?", "INFORMATION", MB_YESNO) == IDYES) { // we set a bool to true if the user wants fullscreen bFullScreen = true; } // call our function to init and create our window if (!initWindow(hInstance)) { MessageBox(NULL, "Unable to create window", "ERROR", MB_OK); return false; } // call our function to init direct3D if (!initDirect3D()) { MessageBox(NULL, "Unable to init Direct3D", "ERROR", MB_OK); return false; } // Main message loop: MSG msg; ZeroMemory( &msg, sizeof(msg) ); while( msg.message!=WM_QUIT ) { if( PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) ) { TranslateMessage( &msg ); DispatchMessage( &msg ); } else { render(); } } // release the device and the direct3D object if( pd3dDevice != NULL) pd3dDevice->Release(); if( pD3D != NULL) pD3D->Release(); return (int) msg.wParam; } /********************************************************************* * initWindow *********************************************************************/ bool initWindow(HINSTANCE hInstance) { WNDCLASSEX wcex; DWORD m_dwWindowStyle; // this holds the window style wcex.cbSize = sizeof(WNDCLASSEX); wcex.style = CS_HREDRAW | CS_VREDRAW; wcex.lpfnWndProc = (WNDPROC)WndProc; wcex.cbClsExtra = 0; wcex.cbWndExtra = 0; wcex.hInstance = hInstance; wcex.hIcon = 0; wcex.hCursor = LoadCursor(NULL, IDC_ARROW); wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); wcex.lpszMenuName = NULL; wcex.lpszClassName = "DirectXExample"; wcex.hIconSm = 0; RegisterClassEx(&wcex); // if the application is to be fullscreen then set the window styles to // WS_EX_TOPMOST | WS_POPUP | WS_VISIBLE if (bFullScreen) m_dwWindowStyle = WS_EX_TOPMOST | WS_POPUP | WS_VISIBLE; // otherwise, we are doing a standard windowed application using // WS_OVERLAPPEDWINDOW else m_dwWindowStyle = WS_OVERLAPPEDWINDOW; // create the window wndHandle = CreateWindow("DirectXExample", "DirectXExample", m_dwWindowStyle, // pass the window style as a variable this time CW_USEDEFAULT, CW_USEDEFAULT, 640, 480, NULL, NULL, hInstance, NULL); if (!wndHandle) return false; ShowWindow(wndHandle, SW_SHOW); UpdateWindow(wndHandle); return true; } /********************************************************************* * WndProc *********************************************************************/ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_DESTROY: PostQuitMessage(0); break; } return DefWindowProc(hWnd, message, wParam, lParam); } /********************************************************************* * initDirect3D * initializes direct3D *********************************************************************/ bool initDirect3D() { pD3D = NULL; pd3dDevice = NULL; // create the directX object if( NULL == ( pD3D = Direct3DCreate9( D3D_SDK_VERSION ) ) ) { return false; } // fill the presentation parameters structure D3DPRESENT_PARAMETERS d3dpp; ZeroMemory( &d3dpp, sizeof(d3dpp) ); d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; // here we use the bool variable that we set earlier // if the user wants a fullscreen application then // we have to set d3dpp.Windowed to FALSE // and we must specify a backbufferformat if( bFullScreen ) { d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8; d3dpp.Windowed = FALSE; } // if this is a windowed application // we set d3dpp.Windowed to TRUE // and the backbufferformat can be set to // D3DFMT_UNKNOWN else { d3dpp.BackBufferFormat = D3DFMT_UNKNOWN; d3dpp.Windowed = TRUE; } d3dpp.BackBufferCount = 1; d3dpp.BackBufferHeight = 480; d3dpp.BackBufferWidth = 640; d3dpp.hDeviceWindow = wndHandle; // create a default directx device if( FAILED( pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_REF, wndHandle, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pd3dDevice ) ) ) { return false; } return true; } /********************************************************************* * render *********************************************************************/ void render(void) { // check to make sure we have a valid Direct3D Device if( NULL == pd3dDevice ) return; // Clear the backbuffer to a blue color pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0,0,255), 1.0f, 0 ); // Present the backbuffer contents to the display pd3dDevice->Present( NULL, NULL, NULL, NULL ); } Anyone have any ideas? Thanks in advance.
  7. Hey, this makes no sense. When I add my header file (I created), it adds 29 errors to my winmain.cpp file saying there's an error in my program. When I take the header file out it works magically. It makes no sense to me that including a header file that I created that has functions in it would make a file just all the sudden say "Hey I know, let's create 29 errors b/c it sounds like fun!" (I know it doesn't really do that but it feels like it). So does anyone know why this is? Here's my header file (DSEngine.h) /**************************** ** Demon Realms Studios ** ** DirectSound Engine v1.0 ** ******************************/ //Prototypes here int initDS(LPDIRECTSOUND8 g_pDS, LPDIRECTSOUNDBUFFER DSBuffer); //initDS, set's up a DirectSound Device int initDS(LPDIRECTSOUND8 g_pDS, HWND hwnd) { //create hresult for testing HRESULT hr; //Create the DirectSoundDevice hr = DirectSoundCreate8( NULL, &g_pDS, NULL ); if(FAILED( hr )) { //failed to set up the DirectSound Device, //exit app return(0); } //Set cooperative level to PRIORITY hr = g_pDS->SetCooperativeLevel(hwnd, DSSCL_PRIORITY); if(FAILED( hr )) { //failed to set cooperative level, //exit app return(0); } return(1); } //DSCleanup, clears out all data to prevent memory leaks. int DSCleanup(LPDIRECTSOUND8 g_pDS, LPDIRECTSOUNDBUFFER DSBuffer) { if(g_pDS != NULL) { g_pDS->Release(); g_pDS = NULL; } if(DSBuffer != NULL) { DSBuffer->Release(); DSBuffer = NULL; } return(1); } int DSCBuffer(LPDIRECTSOUND8 g_pDS, LPDIRECTSOUNDBUFFER DSBuffer, WAVEFORMATEX wfx, DSBUFFERDESC dsbd) { HRESULT hr; ZeroMemory( &wfx, sizeof( WAVEFORMATEX ) ); //Set the format of the buffer to WAVE_FORMAT_PCM wfx.wFormatTag = (WORD) WAVE_FORMAT_PCM; //Set the number of channels to 2 (stereo quality) wfx.nChannels = 2; //Set the samples per second to 22050 wfx.nSamplesPerSec = 22050; //Compute the nBlock value wfx.wBitsPerSample = 16; wfx.nBlockAlign = (WORD) (wfx.wBitsPerSample / 8 * wfx.nChannels); //Compute the nAveBytesPerSec value wfx.nAvgBytesPerSec = (DWORD) (wfx.nSamplesPerSec * wfx.nBlockAlign); //Define teh structure to all zerps ZeroMemory( &dsbd, sizeof( DSBUFFERDESC ) ); //Set the size of the structure dsbd.dwSize = sizeof( DSBUFFERDESC ); //Set the flags dsbd.dwFlags = 0; //the size of the buffer dsbd.dwBufferBytes = 64000; //the GUID of the algorithm dsbd.guid3DAlgorithm = GUID_NULL; //The address of the WAVEFORMATEX structure dsbd.lpwfxFormat = &wfx; //Create the buffer hr = g_pDS->CreateSoundBuffer( &dsbd, &DSBuffer, NULL ); if(FAILED( hr )) { msgwar( "DirectSound Error", "failed to create the sound buffer" ); return(0); } return(1); } int DSPlayWav() { DWORD dwDSLockedBufferSize = 0; // size of the locked buffer DWORD dwWavDataRead = 0; // amount of data read from the WAV file CWaveFile *wavFile; wavFile = new CWaveFile(); //Open the wav file wavFile->Open(filename, &wfx, WAVEFILE_READ ); //Check the size of the file. If the file contains //no information, thw code will stop reading from it. if(wavFile->GetSize() == 0) { //no info, abort read operation msgwar( "DS Error", "No info in file path" ); return(0); } //Time to lock the DSBuffer DSBuffer->Lock(0, 64000, &dwDSLockedBuffer, &dwDSLockedBufferSize, NULL, NULL, DSBLOCK_ENTIREBUFFER); wavFile->ResetFile(); //reset track to beginning //Read the wav file hr = wavFile->Read( ( BYTE* ) pDSLockedBuffer, dwDSLockedBufferSize, &dwWavDataRead ); //Check to make sure that the read process was successful if(FAILED( hr )) { msgwar( "DS Error", "Failed to read wav file" ); return(0); } if(loop_file == 0) { DSBuffer->Play(0,0,0); } else { DSBuffer->Play(0,0,DSPLAY_LOOPING); } return(1); } Any help is appreciated, thanks in advance.
  8. I never understood this

    I don't know, my code looks like this: CWaveFile *wavFile; wavFile = new CWaveFile(); //Open the wav file test.wav wavFile->Open( "test.wav", NULL, WAVEFILE_READ ); //check to make sure the wav file is vaild if( wavFile->GetSize( ) == 0 ) { //invaild file msgwar( "DSound Error", "Failed to open sound file" ); return(0); } //The previous block of code opens the file test.wav, //then makes sure the file has data in it. If the file has no data, //the program stops reading the file. DSBuffer->Lock(0, 64000, &pDSLockedBuffer, &dwDSLockedBufferSize, NULL, // No secondary is needed, NULL, // No secondary is needed //lock the entire buffer DSBLOCK_ENTIREBUFFER); //check the return code to make sure the lock was successful if(FAILED( hr )) { msgwar( "DSound Error", "Failed to lock buffer" ); return(0); } wavFile->ResetFile( ); //reset the wav file to the beginning //Read the wav file hr = wavFile->Read( ( BYTE* ) pDSLockedBuffer, dwDSLockedBufferSize, &dwWavDataRead ); //Check to make sure that the read process was successful if(FAILED( hr )) { msgwar( "DS Error", "Failed to read wav file" ); return(0); } //Play the file DSBuffer->Play( 0, 0, DSBPLAY_LOOPING ); As to me knowing what unresolved link error means, I only know that somtimes it means you forgot to include a .lib file in the linking settings. But that's not the case this time I knwo for sure. I have all the required .lib's I already checked.
  9. Hey, I've never understood what these errors mean. Could someone help me please? --------------------Configuration: DMusic - Win32 Debug-------------------- Linking... winmain.obj : error LNK2001: unresolved external symbol "public: long __thiscall CWaveFile::Read(unsigned char *,unsigned long,unsigned long *)" (?Read@CWaveFile@@QAEJPAEKPAK@Z) winmain.obj : error LNK2001: unresolved external symbol "public: long __thiscall CWaveFile::ResetFile(void)" (?ResetFile@CWaveFile@@QAEJXZ) winmain.obj : error LNK2001: unresolved external symbol "public: unsigned long __thiscall CWaveFile::GetSize(void)" (?GetSize@CWaveFile@@QAEKXZ) winmain.obj : error LNK2001: unresolved external symbol "public: long __thiscall CWaveFile::Open(char *,struct tWAVEFORMATEX *,unsigned long)" (?Open@CWaveFile@@QAEJPADPAUtWAVEFORMATEX@@K@Z) winmain.obj : error LNK2001: unresolved external symbol "public: __thiscall CWaveFile::CWaveFile(void)" (??0CWaveFile@@QAE@XZ) Debug/DMusic.exe : fatal error LNK1120: 5 unresolved externals Error executing link.exe. DMusic.exe - 6 error(s), 0 warning(s) Thanks in advance.
  10. it's from the SDK DX 9.0. I'm using MS VS 6.0, whihc might be a little out of date so maybe that's it. I don't know though. Anyone know what could be causing the problem?
  11. Hey, I'm programmign in DirectSound and it came up with this internal linking error: --------------------Configuration: DMusic - Win32 Debug-------------------- Linking... winmain.obj : error LNK2001: unresolved external symbol "int __stdcall DSCallback(struct _GUID *,char *,char *,void *)" (?DSCallback@@YGHPAU_GUID@@PAD1PAX@Z) Debug/DMusic.exe : fatal error LNK1120: 1 unresolved externals Error executing link.exe. DMusic.exe - 2 error(s), 0 warning(s) I've included dxguid.lib winmm.lib dsound.lib dplayx.lib. Are there any others I need to include that I'm missing? Thanks in advance.
  12. nvm I got it to work I was just being tired and stupid.
  13. I think my compiler (MS Studio 6.0) thinks up all night while I'm asleep all the ways to tick me off. It comes up (the message saying unexpected end of file found) after I add this line: LPDIRECTSOUND8 m_pDS; to my program. When I take it out, my program works fine. There isn't an unexpected end of file found. It just wants to tick me off (so I'm beginning to think) b/c that is logic code. I added it in my globals section. And I added all the .lib's for the directx 9.0 sound, and all of it's header files. No luck. And actually another question that makes me in wonder how microsoft even exists, why is it when I add .h files from the SDK of 9.0 the errors of my program increse up to 23 errors? When I havn't changed the coding at all? I'm sorry but this just isn't making sense. I know I need a new video card but it should still compile at least. Anyone have any ideas? Thanks. Here's my full code: #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <windowsx.h> #include <iostream.h> #include <fstream.h> #include <string.h> #include <stdio.h> #include <stdlib.h> #include <shellapi.h> #include <mmsystem.h> #include "drsscript.h" #include "resource.h" #include <dplay8.h> #include <dplay.h> //Defines here #define WINCLASS1 "winclass1" #define WINDOW_CLASS_NAME2 "winclass2" #define WINDOW_CLASS_NAME3 "winclass3" #define TIMER_ID_1 1 #define TIMER_ID_2 2 //Globals here //ALL INT'S int lsn1_show = 0; int ncmdshow2; int open_adv = 0; int tester = 0; int show_prev = 0; int prev_on = 0; int dlg_closed = 0; //ALL HINSTANCE'S HINSTANCE hinstance2; HINSTANCE hprevinstance2; HINSTANCE main_inst; HINSTANCE hinstance3; HINSTANCE hprev; //All HWND's HWND hwnd2; HWND main_app; HWND win2; //Other LPSTR lpcmdline2; LPSTR lpcmdline3; LPDIRECTSOUND8 m_pDS; //Prototypes int main_text(void); void prev_text(void); int DRS_Main(void); int DRS_Init(void); int DRS_Exit(void); int MyDialog_Main(void); int MyDialog(HINSTANCE hinstance, HINSTANCE hprevinstance, LPSTR lpcmdline, int ncmdshow); int lsn1_window(HINSTANCE hinstance2, HINSTANCE hprevinstance2, LPSTR lpcmdline2, int ncmdshow2); //Function - WindowProc (1 & 2) LRESULT CALLBACK WindowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { switch(msg) { case WM_TIMER: { //What timer was fired? switch(wparam) { case TIMER_ID_1: { //Do processing here }break; case TIMER_ID_2: { //Do processing here }break; } } case WM_CREATE: { //When the window get's created, //what do you want to do? }break; case WM_PAINT: { HDC hDC, MemDCExercising; PAINTSTRUCT Ps; HBITMAP bmpExercising; hDC = BeginPaint(hwnd, &Ps); int y_pos = GetSystemMetrics(SM_CYSCREEN); RECT rect2 = {0,0,200,y_pos}; FillRect(hDC, &rect2, CreateSolidBrush(RGB(118,153,227))); // Load the bitmap from the resource bmpExercising = LoadBitmap(main_inst, MAKEINTRESOURCE(IDB_BITMAP1)); // Create a memory device compatible with the above DC variable MemDCExercising = CreateCompatibleDC(hDC); // Select the new bitmap SelectObject(MemDCExercising, bmpExercising); // Copy the bits from the memory DC into the current dc BitBlt(hDC, 5, 10, 191, 118, MemDCExercising, 0, 0, SRCCOPY); // Restore the old bitmap DeleteDC(MemDCExercising); DeleteObject(bmpExercising); SetTextColor(hDC, RGB(0,0,0)); SetBkMode(hDC, OPAQUE); SetBkColor(hDC, RGB(214,223,247)); char *text = "Lesson 1"; HFONT font; font = CreateFont(14, 12, 0, 0, FW_REGULAR, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_ROMAN, "Century Gothic"); SelectObject(hDC, font); TextOut(hDC, 14, 42, text, strlen(text)); DeleteObject(font); EndPaint(hwnd, &Ps); break; } case WM_DESTROY: { PostQuitMessage(0); break; } default:break; } return(DefWindowProc(hwnd, msg, wparam, lparam)); } LRESULT CALLBACK WindowProc2(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { PAINTSTRUCT ps; //used in WM_PAINT HDC hdc2; //handel to device context switch(msg) { case WM_CREATE: { //When the window get's created, //what do you want to do? }break; case WM_PAINT: { hdc2 = BeginPaint(hwnd, &ps); //todo code EndPaint(hwnd, &ps); }break; case WM_DESTROY: { PostQuitMessage(0); }break; default:break; } return(DefWindowProc(hwnd, msg, wparam, lparam)); } LRESULT CALLBACK WindowProc3(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { PAINTSTRUCT ps; //used in WM_PAINT HDC hdc2; //handel to device context switch(msg) { case WM_TIMER: { //what timer was fired? switch(wparam) { case TIMER_ID_1: { }break; default:break; } } case WM_CREATE: { //When the window get's created, //what do you want to do? SetTimer(win2, TIMER_ID_1, 3000, NULL); }break; case WM_PAINT: { hdc2 = BeginPaint(hwnd, &ps); //todo code EndPaint(hwnd, &ps); }break; case WM_DESTROY: { PostQuitMessage(0); }break; default:break; } return(DefWindowProc(hwnd, msg, wparam, lparam)); } int lsn1_window(HINSTANCE hinstance2, HINSTANCE hprevinstance2, LPSTR lpcmdline2, int ncmdshow2) { MSG msg; WNDCLASSEX winclass2; winclass2.cbClsExtra = 0; winclass2.cbSize = sizeof(WNDCLASSEX); winclass2.cbWndExtra = 0; winclass2.hbrBackground = (HBRUSH)CreateSolidBrush(RGB(71,91,118)); winclass2.hCursor = LoadCursor(NULL, IDC_ARROW); winclass2.hIcon = LoadIcon(NULL, IDI_APPLICATION); winclass2.hIconSm = LoadIcon(NULL, IDI_APPLICATION); winclass2.hInstance = hinstance2; winclass2.lpfnWndProc = WindowProc2; winclass2.lpszClassName = WINDOW_CLASS_NAME2; winclass2.lpszMenuName = NULL; winclass2.style = CS_DBLCLKS | CS_OWNDC | CS_HREDRAW | CS_VREDRAW; if(!(RegisterClassEx(&winclass2))) { //write to error log and quit application error( "Sorry, failed to register lesson1 window.\n" "________________________________________\n", 3); return(0); } if(!(hwnd2 = CreateWindowEx(NULL, WINDOW_CLASS_NAME2, "DRS Lesson 1::Learning the basics of VC++ - Display Mode ONLY", WS_OVERLAPPEDWINDOW | WS_VISIBLE, 1,30, 800,600, main_app, NULL, hinstance2, NULL))) { //write to error log and quit application error( "Failed show the window lesson 1\n" "_______________________________\n", 4); return(0); } while(TRUE) { if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { if(msg.message == WM_QUIT) { dlg_closed = 1; break; } //translate msg TranslateMessage(&msg); //send message to window proc DispatchMessage(&msg); DRS_Main(); } } DRS_Exit(); return(msg.wParam); } DRS_Init(void) { //This function will be called once per startup //of program return(1); } void prev_text() { HDC pdc; HFONT font2; pdc = GetDC(main_app); font2 = CreateFont(48, 38, 215, 0, FW_REGULAR, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_ROMAN, "Times New Roman"); SelectObject(pdc, font2); SetTextColor(pdc, RGB(0,0,0)); SetBkMode(pdc, TRANSPARENT); SetBkColor(pdc, RGB(255,255,255)); char *myprevtext = "Display Mode ONLY!"; int text_xpos = 1; int text_ypos = 320; TextOut(pdc, text_xpos, text_ypos, myprevtext, strlen(myprevtext)); DeleteObject(font2); } int DRS_Main(void) { //Do all processing here that will be called //everytime if(lsn1_show == 1) { //Show the lesson 1 window SW(hwnd2); } return(1); } int DRS_Exit(void) { //This will be called during the exit //of the program. if(open_adv == 1) { ShellExecute(NULL, "open", "http://www.demonrealmstudios.com/software/beta/SIAD/index.php", NULL, NULL, SW_NORMAL); HW(win2); } return(1); } int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hprevinstance, LPSTR lpcmdline, int ncmdshow) { HWND hwnd; MSG msg; WNDCLASSEX winclass; winclass.cbSize = sizeof( WNDCLASSEX ); winclass.cbClsExtra = 0; winclass.cbWndExtra = 0; winclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); winclass.hCursor = LoadCursor(NULL, IDC_ARROW); winclass.hIcon = LoadIcon(hinstance, MAKEINTRESOURCE(IDI_ICON2)); winclass.hIconSm = LoadIcon(hinstance, MAKEINTRESOURCE(IDI_ICON2)); winclass.hInstance = hinstance; winclass.lpfnWndProc = WindowProc; winclass.lpszClassName = WINCLASS1; winclass.lpszMenuName = NULL; winclass.style = CS_DBLCLKS | CS_OWNDC | CS_HREDRAW | CS_VREDRAW; //Register the windows class if(!(RegisterClassEx(&winclass))) return(0); //create the main window if(!(hwnd = CreateWindowEx(NULL, "WINCLASS1", "First DirectSound 9.0 App", WS_VISIBLE | WS_OVERLAPPEDWINDOW, 0,0, 850,600, NULL, NULL, hinstance, NULL))) { //If failed, quit application and //write to the error log. error("Failed to create window. Please check\n" "syntax and parameters to make sure\n" "everything connects together.\n", 2); return(0); } /********************************************** Add hwnd globally to the program by storing the hwnd information into the HWND main_app. ***********************************************/ main_app = hwnd; main_inst = hinstance; play_wav("ir_end.wav", 0); HDC hdc3; hdc3 = GetDC(hwnd); //Do all initlization from this function DRS_Init(); while(TRUE) { if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { if(msg.message == WM_QUIT) { break; } //translate msg TranslateMessage(&msg); //send message to window proc DispatchMessage(&msg); DRS_Main(); } } DRS_Exit(); return(msg.wParam); } int MyDialog(HINSTANCE hinstance2, HINSTANCE hprevinstance2, LPSTR lpcmdline2, int ncmdshow2) { MSG msg; WNDCLASSEX winclass3; winclass3.cbClsExtra = 0; winclass3.cbSize = sizeof(WNDCLASSEX); winclass3.cbWndExtra = 0; winclass3.hbrBackground = (HBRUSH)CreateSolidBrush(RGB(81,141,227)); winclass3.hCursor = LoadCursor(NULL, IDC_ARROW); winclass3.hIcon = LoadIcon(hinstance3, IDI_WARNING); winclass3.hIconSm = LoadIcon(hinstance3, IDI_WARNING); winclass3.hInstance = hinstance3; winclass3.lpfnWndProc = WindowProc3; winclass3.lpszClassName = WINDOW_CLASS_NAME3; winclass3.lpszMenuName = NULL; winclass3.style = CS_DBLCLKS | CS_OWNDC | CS_HREDRAW | CS_VREDRAW; if(!(RegisterClassEx(&winclass3))) { //write to error log and quit application error( "Sorry, failed to register lesson1 window.\n" "________________________________________\n", 3); return(0); } if(!(win2 = CreateWindowEx(NULL, WINDOW_CLASS_NAME3, "DRS Warning", WS_OVERLAPPED | WS_VISIBLE, 10,30, 680,150, win2, NULL, hinstance3, NULL))) { //write to error log and quit application error( "Failed show the window lesson 1\n" "_______________________________\n", 4); return(0); } while(TRUE) { if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { if(msg.message == WM_QUIT) { break; } //translate msg TranslateMessage(&msg); //send message to window proc DispatchMessage(&msg); MyDialog_Main(); } } return(msg.wParam); } int MyDialog_Main(void) { HDC hdc5; hdc5 = GetDC(win2); SetTextColor(hdc5, RGB(0,0,0)); SetBkMode(hdc5, TRANSPARENT); HFONT font3; font3 = CreateFont(14, 12, 0, 0, FW_REGULAR, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_ROMAN, "Times New Roman"); //Text posistions int text_xpos2 = 1; int text_ypos2 = 1; char *mytext = "Please note this program is in progress " "and is subject to change at any time."; TextOut(hdc5, text_xpos2, text_ypos2, mytext, strlen(mytext)); return(1); } int main_text(void) { dtext( "Demon Realms Studios", 1,1, RGB(0,0,0), main_app, RGB(71,91,118)); return(1); }
  14. Failed to initDirect3D?

    wow well thanks AP it worked what you sent me so it's what I'm doing. Awsome now I can get on to programming Thanks! As to may thanks goes out to the others that took time out of thier day to help me. I appreciate it!
  15. Failed to initDirect3D?

    for somereason it didn't output it soI'll try again sathenzar @woh.rr.com