|
This event gets the new position. But I am unable to find a way to change it or affect the position changing. If new position is pushed into the position structure it is not accepted. Is there a known solution to this problem?
|
|
|
|
|
Handle the WM_NCHITTEST message.
Check the reply from the base class call and if it is HTCAPTION then return HTNOWHERE;
See below
UINT CNchittestDlg::OnNcHitTest(CPoint point)
{
UINT nReply;
nReply = CDialog::OnNcHitTest(point);
if (nReply == HTCAPTION)
{
nReply = HTNOWHERE;
}
return nReply;
}
|
|
|
|
|
Thanks, it works excellently.
|
|
|
|
|
Hi
In a standard SDI mfc project, when I add .cpp and .h files to it by right clicking the project and using "Add files to Projec" option,those new file names are not shown in the "class names" combo box under "message maps" tab of Mfc class wizard.
Can you please tell me the reason for it?
With Regards
Neeraj Sinha
|
|
|
|
|
Hi Friends,
I m having a simple win32 console Application. It is running in a infinite loop, there is only one option to close application by clicking the close button in console. I want to trap this event when closing application.
Please suggest the best solution.
Thanks
Pankaj Jain
|
|
|
|
|
|
Thanks! I m looking.............
Pankaj Jain
|
|
|
|
|
The syntax of C++ has changed so dramatically???
--
======
Arman
|
|
|
|
|
Yes, it's called
C++
++
now
|
|
|
|
|
I want to know how I would be able to run 2 or more MFC apps within one single MFC Window. The purpose of doing this is to enable the user to run one or more MDI applications in one single Window.
The user should be able to select or attach other MFC applications ( all of which are MDI Window applications ) at initialisation. Once he selects the front ends, the parent application should find the executable files of the selected apps and then launch the child windows of those apps, within its own primary Window.
My question is, how would this be possible ? I have heard that .net allows you to host MFC apps within its own, but I do not intend to work on .net solutions. Ive heard OLE is a suitable workaround for this too, but is there any easier approach ?
thanx in advance,
looking forward to a prompt reply.
|
|
|
|
|
You can't do this with regular Win32 apps because you can't have windows from different processes in the same stack. You could try making the main frame an ActiveX control container, then write the other apps as AX controls.
|
|
|
|
|
You can do it. Run the following twice. The first instance creates a main window and the second a child within the first. If you use Spy you'll see that both windows belong to different processes. OLE relies on this feature of Win32 to implement in-place editing with out-of-process servers. Some messages should not be sent across processes (such as WM_NOTIFY) so obviously the window would have to be written to take this into account. In real world applications using edit controls as I’ve done is probably not sensible if parent notification is required, but using them simplifies the example code.
===========================================
// RunTwice.cpp : Defines the entry point for the application.
//
#include "stdafx.h"
#pragma data_seg(".shared")
HWND s_hMainWindow = NULL;
#pragma data_seg()
#pragma comment(linker, "/SECTION:.shared,RWS")
WNDPROC g_pSuper;
LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_NCDESTROY:
PostQuitMessage(0);
break;
}
return CallWindowProc(g_pSuper, hwnd, uMsg, wParam, lParam);
}
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
if (s_hMainWindow==NULL)
{
s_hMainWindow = CreateWindow(
"EDIT", "Main",
WS_VISIBLE | WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | ES_MULTILINE,
0, 0, 500, 500,
NULL,
NULL,
hInstance,
NULL
);
LONG res = SetWindowLong(s_hMainWindow, GWL_WNDPROC, reinterpret_cast<LONG>(&WindowProc));
g_pSuper = reinterpret_cast<WNDPROC>(res);
}
else
{
HWND hChild = CreateWindow(
"EDIT", "Child",
WS_VISIBLE | WS_CHILD | WS_BORDER | ES_MULTILINE,
100, 100, 300, 300,
s_hMainWindow,
NULL,
hInstance,
NULL
);
LONG res = SetWindowLong(hChild, GWL_WNDPROC, reinterpret_cast<LONG>(&WindowProc));
g_pSuper = reinterpret_cast<WNDPROC>(res);
}
MSG m;
while (GetMessage(&m, NULL, 0, 0))
{
TranslateMessage(&m);
DispatchMessage(&m);
}
return 0;
}
Steve
|
|
|
|
|
|
Thanx Im looking into your suggestions.
|
|
|
|
|
I am having a video decoder application for which I prepared a Release version.
The program crashes with a message "The instruction at 0x77fc8e1 referenced to a memory 0x0000001 which could not be written.
I inserted AfxMessageBox() at different points and finally found the bug pointing to a memory freeing portion. But if I remove one AfxMessageBox() the error code changes(0x0000001 becomes 0xfffffff). If I reposition the code then error occurs for some other memory freeing block. Has anyone come across such a behaviour. If so I need valuable suggestions.
|
|
|
|
|
|
I have gone through this article. The only possibilit that may occur for me is uninitialized local variables and bound errors. I have done with those except for a small doubt. How to initialize pointers such as int *temp_array and int **double_array.
|
|
|
|
|
jossion wrote: How to initialize pointers such as int *temp_array and int **double_array
int *temp_array pTemparray = NULL;
int **double_array pDoublearray = NULL;
Failure is not an option - it's built right in.
|
|
|
|
|
Hi
I have copied some files and dialog resources used in that file to
my application from some other application.Now while building the
application, I got too many errors saying undeclared all the ID's
of the resources.It seems this is mainly because resources Id's are
not defined in the resource.h file.
So, how to solve this problem?
With Regards
Neeraj Sinha
|
|
|
|
|
Update the resource.h file by adding the old ids from the first application to the new one. If there are id conflicts you have to resolve that.
--
======
Arman
|
|
|
|
|
i am getting the dword from read file operation
ReadFile(hFile, dwBuffer, sizeof(DWORD)*256, &dwNumRead,NULL);
where the dwBuffer is "C:\Documents and Settings\fsi_tc1g\Desktop" wil be i n dword format.
and i need to convert the dwBuffer to cstring.
so that i can use it for
ifstream ifs( dwBuffer, ios_base::binary );
and CFile finfo( m_filePath, CFile::modeRead );
how to convert and pass it to ifstreama and to CFile function.
please guide me.
Help Ever Hurt Never
|
|
|
|
|
sonavi wrote: ReadFile(hFile, dwBuffer, sizeof(DWORD)*256, &dwNumRead,NULL);
Second parameter is pointer to data buffer. And not DWORD , as you assumed. So you can use it as it is.
Prasad
MS MVP - VC++
|
|
|
|
|
The prefix 'dw' is misused here. dwBuffer is not DWORD but a buffer of character. So no CString conversion is needed in your case.
--
======
Arman
|
|
|
|
|
hi every one,
i have a problem that i have develop an application on MFC the application is running well on Windows Xp Professional but doesn't working in Windows Vista Home Edition.My application adds some value to registor for security region. can any one help me out why this is happing .
suraj
|
|
|
|
|
In Vista , there are lots of restrictions on how you deal with registry.
This[^] article may give you some idea.
Prasad
MS MVP - VC++
|
|
|
|