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

C / C++ / MFC

 
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 
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 
Neville,
My hInstance param comes right from my main window creation, just like the example:

int PASCAL WinMain (HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR szCmdLine, int nShow)
{
	
	hInstance = hInst;


I changed the name of my WindowProc routine to MyWindowProc just so that it wasn't the default anymore. That routine is at the top of the module that contains the code in question:

LRESULT CALLBACK MyWindowProc(HWND hwnd,
    UINT uMsg,
    WPARAM wParam,
    LPARAM lParam
)
{
int dummy_var;

	dummy_var = 1;
	return 1;
}


My lpszMenuName is NULL. My intent is to create a window that is invisible later on by calling CreateWindow for the purpose of processing messages only. The reason that I am calling RegisterClass is because I assumed that I needed to do this prior to getting the CreateWindow to work. BTW, that is also returning a 0 when it fails and I check GetLastError. Very strange.

The help message that describes the kind of window that I want to create is here:

From CreateWindow...
hWndParent
[in] Handle to the parent or owner window of the window being created. To create a child window or an owned window, supply a valid window handle. This parameter is optional for pop-up windows. 
Windows 2000/XP: To create a message-only window, supply HWND_MESSAGE or a handle to an existing message-only window. 


Message-Only Windows
A message-only window enables you to send and receive messages. It is not visible, has no z-order, cannot be enumerated, and does not receive broadcast messages. The window simply dispatches messages.

To create a message-only window, specify the HWND_MESSAGE constant or a handle to an existing message-only window in the hWndParent parameter of the CreateWindowEx function. You can also change an existing window to a message-only window by specifying HWND_MESSAGE in the hWndNewParent parameter of the SetParent function.

To find message-only windows, specify HWND_MESSAGE in the hwndParent parameter of the FindWindowEx function. In addition, FindWindowEx searches message-only windows as well as top-level windows if both the hwndParent and hwndChildAfter parameters are NULL.


As to the last reference to MFC, I am not using it.

Robert
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 
GeneralRe: _crtisvalidheappointer (URGENT) Pin
BlackDice23-Mar-04 7:47
BlackDice23-Mar-04 7:47 
GeneralRe: _crtisvalidheappointer (URGENT) Pin
Steve S23-Mar-04 21:40
Steve S23-Mar-04 21:40 
GeneralAdding Items to CTabCtrl Pin
mmica23-Mar-04 6:38
mmica23-Mar-04 6:38 
GeneralRe: Adding Items to CTabCtrl Pin
Ravi Bhavnani23-Mar-04 10:59
professionalRavi Bhavnani23-Mar-04 10:59 

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.