I have on method call another method NotificationWndProc to create a notification window, which will receive messages. At the first time, things are running OK, but in the second time, it returns error:
RegisterClass returned 1410.
Please help me out!
In .cpp file: -
{
-
...
-
-
long (CALLBACK *WndProcPointer ) ( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) = NotificationWndProc ;
-
wc.lpfnWndProc = WndProcPointer;
-
wc.lpszClassName = NOTIFICATION_CLASS;
-
wc.lpszMenuName = NULL;
-
wc.hInstance = gVars.g_hInst;
-
wc.hIcon = NULL;
-
wc.hCursor = NULL;
-
wc.hbrBackground = NULL;
-
wc.cbWndExtra = sizeof(PSNMP_MGR_SESSION);
-
wc.cbClsExtra = 0;
-
wc.style = 0; // register class
-
fOk = RegisterClass(&wc);
-
-
if (!fOk)
-
{
-
TRACE( "RegisterClass returned %d.\n", GetLastError() );
-
return (FALSE);
-
}
-
-
...
-
}
-
-
LRESULT CALLBACK CACSSnmpUtil::NotificationWndProc(
-
HWND hWnd,
-
UINT uMsg,
-
WPARAM wParam,
-
LPARAM lParam
-
)
-
{
-
-
if (uMsg == WM_MSG_INCOMING)
-
{
-
-
PSNMP_MGR_SESSION pSession;
-
// retrieve session pointer from window
-
pSession = (PSNMP_MGR_SESSION)GetWindowLong(hWnd, 0);
-
-
// validate session ptr
-
if ( pSession == NULL )
-
return (LRESULT)0;
-
-
// process notification message
-
if ( ProcessNotification( pSession ) )
-
{
-
// post message to break out of message pump
-
PostMessage( pSession->hWnd, WM_MSG_DONE, (WPARAM)0, (LPARAM)0 );
-
}
-
return (LRESULT)0;
-
-
}
-
else
-
{
-
// forward all other messages to windows
-
return DefWindowProc(hWnd, uMsg, wParam, lParam);
-
-
}
-
-
} // end of NotificationWndProc
-
In .h file:
static LRESULT CALLBACK NotificationWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
1 6827 Banfa 9,065
Expert Mod 8TB
You can look up the error code here where you will find it is ERROR_CLASS_ALREADY_EXISTS.
Once you have registered a class then there is no need to do so again unless you unregister it.
It is normal to only register classes once for an application not everytime it tries to create a window of that class.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Fabio Garufi |
last post by:
Hi, all,
I built the fftw-3.0.1-fma on a LynxOS 4.0 running on a board equipped
with a PowerPC G4 7457. To compile it I had to slightly modify the
configure
script to use the -fvec instead of...
|
by: Ted Miller |
last post by:
I have a managed class that registers a window class with the usual Win32
RegisterClass API.
// Global function, not part of class
LRESULT
CALLBACK
MyWindowProc(
IN HWND hwnd,
IN UINT Msg,...
|
by: Ken Allen |
last post by:
I have a number of services developed in C# (.Net), and they have been
working fine for the most part. Recently someone reported that ipon
occassion (originally rarely, but more frequently on some...
|
by: Gianluca |
last post by:
Anyone knows if the bug in NativeWindow.RegisterClass and the class names
list being case sensitive is scheduled to be fixed or already fixed?
In short, NativeWindow.RegisterClass keeps a list of...
|
by: keepyourstupidspam |
last post by:
Hi,
I am writing a windows service. The code runs fine when I start the
service when my machine is running but
it fails to start automatically when the machine reboots. The code
bombs out when...
|
by: chriskent |
last post by:
Hi,
I have an unusual situation whereby we create a Window during initialisation. We have used this code for many years and have found one unusual case with a customer when the RegiterClass fails...
|
by: ranin02 |
last post by:
Hi,
I have a COM method that is called from VBA. This COM method in turn
calls CoCreateInstance on a class that is a .NET class with a COM
wrapper around it. This all works fine. However,...
|
by: =?Utf-8?B?QXJtaW4gR2FsbGlrZXI=?= |
last post by:
Hi
I wrote a test for a workflow. Unfortunately my assertions in the
eventhandler which I set up during initialization, fail in every case...
What's the problem??
public void...
|
by: ErikJL |
last post by:
I have a simple webservice that performs a SELECT query against a database, and then an INSERT statement on the same database/table. The problem arises at the time when we create the second OleDB...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |