• Some users have recently had their accounts hijacked. It seems that the now defunct EVGA forums might have compromised your password there and seems many are using the same PW here. We would suggest you UPDATE YOUR PASSWORD and TURN ON 2FA for your account here to further secure it. None of the compromised accounts had 2FA turned on.
    Once you have enabled 2FA, your account will be updated soon to show a badge, letting other members know that you use 2FA to protect your account. This should be beneficial for everyone that uses FSFT.

Win32 C/C++ Help

Wingy

[H]ard|Gawd
Joined
Dec 18, 2000
Messages
1,294
I'm getting an exception in my program (I've only included the driver in this post)..

The file looks like this:

Code:
#include <windows.h>
#include "resource.h"
#include "dlgmain.h"
#include "menu.h"
#include "installcall.h"
#include "utils.h"

//--------------------------------------------------------------
// WinMain()
//--------------------------------------------------------------

int PASCAL WinMain (HINSTANCE hInst, HINSTANCE  hPrevInst,
                    LPSTR lpCmdLine,  int nCmdShow )
{
   FARPROC lpProcMain;
   lpProcMain = MakeProcInstance( (FARPROC) Main, hInst );
   //
   // Note that 0 is passed as the parent to the dialog
   //

   //  ###  Exception thrown on line below ####
   DialogBox( hInst, MAKEINTRESOURCE(IDD_DIALOG1), 0, (DLGPROC)lpProcMain );

   FreeProcInstance( lpProcMain );
   return 0;
}
//--------------------------------------------------------------
// Main() Dialog callback porcedure
//--------------------------------------------------------------


BOOL CALLBACK Main(HWND hDlg, UINT message,
                   WORD wParam, LONG lParam)
{
RECT dlgRt;
switch (message)
{
  case WM_INITDIALOG:          // message: initialize dialog box
                               // center the dialog box

    // Get the screen coordinates into dlgRt RECT
    GetWindowRect( hDlg, &dlgRt );

    // Moves rect to (0, 0) so the bottom and right of structure
    // will equal the size of the rect
    OffsetRect( &dlgRt, -dlgRt.left, -dlgRt.top );

    // The rect information combined with GetSystemMetrics() is
    // used to center the dialog
    MoveWindow( hDlg,((GetSystemMetrics( SM_CXSCREEN ) -
                       dlgRt.right ) / 2 + 4) & ~7,
                      (GetSystemMetrics( SM_CYSCREEN ) -
                       dlgRt.bottom) / 2,
                       dlgRt.right, dlgRt.bottom, 0 );


    if(!setWorkingDir(hDlg))
    {
		displayError(hDlg, "ERROR: Could not set working directory.");
    }
	loadFileToBox("instructions\\guide.txt", hDlg, IDC_EDIT1);
	initInstallMenu(hDlg);        // Setup the menu for install

    return TRUE;
  case WM_COMMAND:  
    return TRUE;              // message: received a command
  break;
}
return FALSE;                        // Didn't process a message
}

The exception is thrown on the DialogBox() line. VC++ shows me this in the debugger.

Unhandled exception at 0x4f525245 in dlgmain.exe: 0xC0000005: Access violation reading location 0x4f525245.

Any help would really be appreciated as to why this is happening. Thanks.
 
my guess is its not getting ahold of your message handling function ( blahProc). Check and see what is in the memory location that the thing is trying to get to.
 
Back
Top