Resource Editor Help

This is a discussion on Resource Editor Help within the C++ Programming forums, part of the General Programming Boards category; ALMOST THERE! Updates Source Code: #include <windows.h> #include <tchar.h> #include <resource.h> BOOL MainDialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ...

  1. #16
    Programmer Frantic-'s Avatar
    Join Date
    Dec 2004
    Posts
    114
    ALMOST THERE!

    Updates Source

    Code:
    #include <windows.h>
    #include <tchar.h>
    #include <resource.h>
    
    BOOL MainDialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
    {
        return FALSE;
    }
    
    int _tmain(void)
    {
        DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_DialogBox), 
            NULL, (DLGPROC)MainDialogProc, 0);
        return 0;
    }
    Updated Header

    Code:
    #include <windows.h>
    
    #define IDD_DialogBox 100
    Compiler Errors:

    /Documents and Settings/Owner/Desktop/Comp Prog/C++/Windows API Lessons/Lesson2/example1.cpp C:\Documents and Settings\Owner\Desktop\Comp Prog\C++\Windows API Lessons\Lesson2\C resource.h: No such file or directory.


    In function `int main()':

    12 C:\Documents and Settings\Owner\Desktop\Comp Prog\C++\Windows API Lessons\Lesson2\example1.cpp ` IDD_DialogBox' undeclared (first use this function)

    Ive added the heder file into the directory, perhpas i should move the header file to where all the others are? Into the dev folder?

  2. #17
    Handy Andy andyhunter's Avatar
    Join Date
    Dec 2004
    Posts
    540
    #include "resource.h"

    if you use < and > then the compiler thinks to look into the default include directory.
    i don't think most standard compilers support programmers with more than 4 red boxes - Misplaced

    It is my sacred duity to stand in the path of the flood of ignorance and blatant stupidity... - quzah

    Such pointless tricks ceased to be interesting or useful when we came down from the trees and started using higher level languages. - Salem

  3. #18
    Programmer Frantic-'s Avatar
    Join Date
    Dec 2004
    Posts
    114
    Ok, so im almost there!!!!

    remade source again

    Code:
    #include <windows.h>
    #include <tchar.h>
    #include <resource.hpp>
    
    BOOL MainDialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
    {
    	return FALSE;
    }
    
    int _tmain(void)
    {
    	DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_DialogBox), 
    		NULL, (DLGPROC)MainDialogProc, 0);
    	return 0;
    }
    remade header file

    saved as resource.hpp and not resource.h

    1 error left to tackle!

    26 C:\Documents and Settings\Owner\Desktop\Comp Prog\C++\Windows API Lessons\Lesson2\resource.hpp:5 [Warning] no newline at end of file

  4. #19
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    That's a warning, not an error. Go to the very end of the file and hit enter once.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  5. #20
    Programmer Frantic-'s Avatar
    Join Date
    Dec 2004
    Posts
    114
    Ok, no errors compiling, but when nothing shows up!!!

    Code:
    #include <windows.h>
    #include <tchar.h>
    #include <resource.hpp>
    
    
    BOOL MainDialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
    {
    	return FALSE;
    }
    
    int _tmain(void)
    {
    	DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_DialogBox), 
    		NULL, (DLGPROC)MainDialogProc, 0);
    	return 0;
    }
    Perhaps it has something to do with the res file?

  6. #21
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    No, I believe it has something to do with the MainDialogProc always returning FALSE. There are some messages sent that, if you return FALSE, prevent the creation of the dialog in the first place.
    Return TRUE in all cases instead.


    You might also want to check the return value of DialogBoxParam to see if it gives you an error code. And check GetLastError().
    Last edited by CornedBee; 01-31-2005 at 02:11 AM.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Sorting out a resource manager
    By psychopath in forum Game Programming
    Replies: 1
    Last Post: 11-10-2008, 06:12 PM
  2. unmanaged resource
    By George2 in forum C++ Programming
    Replies: 2
    Last Post: 01-03-2008, 03:23 AM
  3. CreateProcess with Resource of executable, not the Filename
    By Ktulu in forum Windows Programming
    Replies: 4
    Last Post: 11-04-2006, 12:07 AM
  4. resource problem/question
    By stallion in forum Windows Programming
    Replies: 4
    Last Post: 01-29-2003, 01:08 PM
  5. Serial Communications in C
    By ExDigit in forum Windows Programming
    Replies: 7
    Last Post: 01-09-2002, 09:52 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21