Click here to Skip to main content
15,913,773 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: CListCtrl - Sort Pin
David Crow24-Mar-04 2:08
David Crow24-Mar-04 2:08 
GeneralRe: CListCtrl - Sort Pin
jcplatt25-Mar-04 8:46
jcplatt25-Mar-04 8:46 
GeneralCan't write to HKEY_CURRENT_USER when impersonating (new problem) Pin
ICantChangeMyAcct23-Mar-04 10:02
ICantChangeMyAcct23-Mar-04 10:02 
GeneralRe: Can't write to HKEY_CURRENT_USER when impersonating (new problem) Pin
David Crow23-Mar-04 10:29
David Crow23-Mar-04 10:29 
GeneralRe: Can't write to HKEY_CURRENT_USER when impersonating (new problem) Pin
ICantChangeMyAcct23-Mar-04 11:06
ICantChangeMyAcct23-Mar-04 11:06 
GeneralPrevent to open program multiplie times Pin
Snillet2k23-Mar-04 9:52
Snillet2k23-Mar-04 9:52 
GeneralRe: Prevent to open program multiplie times Pin
David Crow23-Mar-04 9:55
David Crow23-Mar-04 9:55 
GeneralGetLastError problem Pin
rmnowick23-Mar-04 9:20
rmnowick23-Mar-04 9:20 
I have the following code that I am executing:

DWORD last_err;
WNDCLASS wc;

wc.style = CS_HREDRAW | CS_VREDRAW; 
    wc.lpfnWndProc = (WNDPROC) WindowProc; 
wc.cbClsExtra = 0; 
wc.cbWndExtra = 0; 
    wc.hInstance = hInstance; 
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); 
wc.hCursor = LoadCursor(NULL, IDC_ARROW); 
//wc.hbrBackground = GetStockObject(WHITE_BRUSH); 
wc.lpszMenuName =  "MainMenu"; 
    wc.lpszClassName = "MainWindowClass"; 

    if (!RegisterClass(&wc))
	{
		last_err = GetLastError();
	}


The RegisterClass call fails and when I run the code in debug and last_err gets set it has a value of 0. I'm expecting it to have a value that designates just what the error was. I got this code fom the following example:

int APIENTRY WinMain( 
    HINSTANCE hinstance,  // handle to current instance 
    HINSTANCE hinstPrev,  // handle to previous instance 
    LPSTR lpCmdLine,      // address of command-line string 
    int nCmdShow)         // show-window type 
{ 
    WNDCLASS wc; 
 
    // Register the main window class. 
    wc.style = CS_HREDRAW | CS_VREDRAW; 
    wc.lpfnWndProc = (WNDPROC) MainWndProc; 
    wc.cbClsExtra = 0; 
    wc.cbWndExtra = 0; 
    wc.hInstance = hinstance; 
    wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); 
    wc.hCursor = LoadCursor(NULL, IDC_ARROW); 
    wc.hbrBackground = GetStockObject(WHITE_BRUSH); 
    wc.lpszMenuName =  "MainMenu"; 
    wc.lpszClassName = "MainWindowClass"; 
 
    if (!RegisterClass(&wc)) 
       return FALSE; 
 
    // 
    // Process other messages. 
    // 
 
}


This comes from the help index under "Using Window Procedures".

Robert
GeneralRe: GetLastError problem Pin
David Crow23-Mar-04 9:53
David Crow23-Mar-04 9:53 
GeneralRe: GetLastError problem Pin
rmnowick23-Mar-04 11:35
rmnowick23-Mar-04 11:35 
GeneralRe: GetLastError problem Pin
Neville Franks23-Mar-04 9:59
Neville Franks23-Mar-04 9:59 
GeneralRe: GetLastError problem Pin
rmnowick23-Mar-04 11:47
rmnowick23-Mar-04 11:47 
GeneralRe: GetLastError problem Pin
Maksim Lepikhin23-Mar-04 12:08
Maksim Lepikhin23-Mar-04 12:08 
GeneralRe: GetLastError problem Pin
rmnowick23-Mar-04 12:28
rmnowick23-Mar-04 12:28 
GeneralSaving Encrypted Passwords Pin
ExtraLean23-Mar-04 9:18
ExtraLean23-Mar-04 9:18 
GeneralRe: Saving Encrypted Passwords Pin
Robert A. T. Káldy23-Mar-04 9:35
Robert A. T. Káldy23-Mar-04 9:35 
GeneralRe: Saving Encrypted Passwords Pin
ExtraLean23-Mar-04 10:03
ExtraLean23-Mar-04 10:03 
GeneralRe: Saving Encrypted Passwords Pin
Robert A. T. Káldy23-Mar-04 10:18
Robert A. T. Káldy23-Mar-04 10:18 
GeneralProblem CRecordSet Pin
ansontong23-Mar-04 6:59
ansontong23-Mar-04 6:59 
GeneralRe: Problem CRecordSet Pin
RadioShark23-Mar-04 7:11
RadioShark23-Mar-04 7:11 
GeneralRe: Problem CRecordSet Pin
David Crow23-Mar-04 8:17
David Crow23-Mar-04 8:17 
General_crtisvalidheappointer (URGENT) Pin
BlackDice23-Mar-04 6:53
BlackDice23-Mar-04 6:53 
GeneralRe: _crtisvalidheappointer (URGENT) Pin
Steve S23-Mar-04 7:27
Steve S23-Mar-04 7:27 
GeneralRe: _crtisvalidheappointer (URGENT) Pin
BlackDice23-Mar-04 7:36
BlackDice23-Mar-04 7:36 
GeneralRe: _crtisvalidheappointer (URGENT) Pin
Steve S23-Mar-04 21:30
Steve S23-Mar-04 21:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.