|
How would I go about trying to get two programs to communicate over a LAN.
I intend to live forever... so far so good.
|
|
|
|
|
That depends...
If one of the programs is runnning on Windows NT/2000 Named Pipes are good and easy, you can also use MailSlots or Sockets...
If you really need an answar, you need to be more specifik about what the programs are doing...
You could also get hold of the book "Network Programmong for Microsoft Windows" from Microsoft Press, it's a great book about Network Communication.
- Anders
|
|
|
|
|
Where can I find more about named pipes using JNI?
BRH
|
|
|
|
|
You can look at the function CreateNamedPipe() in MSDN, or look at the book I recomended in my last post...
- Anders
|
|
|
|
|
Is there a way to add a menu to a Dialog?
Thanks for any help
|
|
|
|
|
it is very easy
follow these steps :
1- add a menu resource ( Insert-->resource-->menu)
2- give to ur menu an ID ( properties-general)
3- now in ur dialog properties choose in the (menu) combo box the ID of the menu u have created .
good luck
|
|
|
|
|
Hi,
I need to access a mailbox (I have access to) and read a certain folder to see if mail has arrived (where it came from and what the message says). Is there anyone who knows how to do this???
Dan
|
|
|
|
|
Has anyone got a fix for the MFC Docking Bug when you have got a large number of Hidden toolbars??
Cheers,
Martin
|
|
|
|
|
What is the bug ?
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
Hello,
Is there a way to add a view to an application without using
the SDI or MDI?
|
|
|
|
|
I just noticed that the AppWizard has a checkbox for Document/View support when selecting
the type of project.
I guess I answered my own question.
|
|
|
|
|
Hi,
I made a project to read event log (very good project about this on this site !), but i have a big pb : my FormatMessage function return the error code 317 (ERROR_MR_MID_NOT_FOUND) every time i tri to read in the message file.
If anybody has a suggestion !
Thanks
tatazou
|
|
|
|
|
The error is
"The system cannot find message for message number 0x%1 in message file for %2"
The event log does not store the text of the error messages it displays. what it knows is that the following application had the error number xxx . To show the error it queries the registry for the corresponding resource DLL path.
This DLL has a Tabel that Maps the error code to the strings that the Event Log program shows.
This DLL is pre compiled and used by the application. To compile the resource DLL use the message compiler MC from the command line.
So you either missing the reource DLL
or the Registry key is not updated correctly
Cheers
G. ALfadhly
<marquee>
It is not polite to point. Don't interrupt. Say `please' and `thank you'. Keep your head, your temper, your cool. Smile!
Try to remember the names of people you are introduced to. Listen.
etiquitte
|
|
|
|
|
Hi,
I made a lot of test, and there's the result :
My EventID value is not all the time valid : sometime (for DrWatson event ie), i have to make or (|) if i want to get the right message (for DrWatson, it's 0x40000000). Do you know if exist a variable i have to check to resolve my pb !
Thank's a lot !
Tatazou
|
|
|
|
|
I am having a lot of trouble with this.
In an MDI App trying to detect when the user has let go of the view window after resizing.
I found WM_EXITSIZEMOVE, but it only detects when re-sizing the Frame has finished and doesn't work in the view even if you create your own message handler.
|
|
|
|
|
Put this in CChildFrame, and this should sort out your problem
Regards
Norm
afx_msg LRESULT OnExitSizeMove(WPARAM wParam, LPARAM lParam);
BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd)
//{{AFX_MSG_MAP(CChildFrame)
//}}AFX_MSG_MAP
ON_MESSAGE(WM_EXITSIZEMOVE, OnExitSizeMove)
END_MESSAGE_MAP()
LRESULT CChildFrame::OnExitSizeMove(WPARAM wParam, LPARAM lParam)
{
return 0;
}
|
|
|
|
|
How can I change a color of an existing pen without creating a new one ?
I found a function like SetDCPenColor for NT. Is there in simular one for Win9x ?
Greatings Mario ///
----------------------
www.klangwerker.de
mario@klangwerker.de
----------------------
|
|
|
|
|
Actually, SetDCPenColor is only in Win2k and only applies to the DC_PEN stock object.
What is it that you're trying to do that prohibits you from creating a new pen?
|
|
|
|
|
I`m trying to implement a class that simulates a LCD-display --- during constructor call i need several pens with different colors to draw a scolled-frame around the rect of the display. That function works but create,reselect and delete pens takes a lot of time and my member-function is not the fastest.
What i want is getting one pen in a loop - change the pen-color during every loop-cycle and put a new frame-rect around the previous one.
Greatings Mario
P.S.: I don`t use MFC !
--------------------
www.klangwerker.de
rocknix@lycos.de
--------------------
|
|
|
|
|
I want to get a snapshot of the desktop, so I am trying to 'hide' the calling window, get the snapshot and then show the window and blit the snapshot to it's DC.
It works, but it seems to be capturing the calling DC (the one I'm hiding)....?
Here's the code:
///////////////////////////////////////////////////////////////////////////////////////////////////////////Function Header
void CDCUtils::PaintDesktop( CDC *pDC, CWnd* pWnd, CRect rect, bool bHideWindow )
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
{
CDC dcDesktop;
CDC dcBuffer;
CBitmap bmpBuffer;
CBitmap bmpDesktop;
CRect LastRect;
CWnd* pFrameWnd = pWnd->GetParentFrame();
pFrameWnd->GetWindowRect( LastRect );
//CPoint Point( rect.left, rect.top );
//HWND hWnd = pWnd->GetSafeHwnd();
//ClientToScreen(hWnd, &Point);
CPoint Point( LastRect.left, LastRect.top );
// Get the Calling Window out the way, so that we can get a clean snapshot...
if ( bHideWindow)
{
pFrameWnd->SetWindowPos( NULL, -100,0,0,0, NULL );
Sleep(400);
}
//
// Get the Desktop's Device Context
//
dcDesktop.m_hDC = ::GetDC(NULL);
//
// Initialise the bitmap according to the Desktop DC
//
bmpDesktop.CreateCompatibleBitmap( &dcDesktop,
GetSystemMetrics(SM_CXSCREEN),
GetSystemMetrics(SM_CYSCREEN));
//
// Create a buffer DC that has a bmp associated with it
//
dcBuffer.CreateCompatibleDC(&dcDesktop);
dcBuffer.SelectObject(bmpDesktop);
//
// Blit from the Desktop's (point.x, point.y) to the buffer's rectangle: 0,0,width,height
//
dcBuffer.BitBlt( 0,
0,
rect.Width(),
rect.Height(),
&dcDesktop, // From DC
Point.y,
Point.y,
SRCCOPY);
if ( bHideWindow)
{
pFrameWnd->SetWindowPos( NULL, LastRect.left, LastRect.top, LastRect.Width(), LastRect.Height(), NULL );
}
pDC->BitBlt( rect.left,
rect.top,
rect.Width(),
rect.Height(),
&dcBuffer, // From DC
0,
0,
SRCCOPY);
dcDesktop.DeleteDC();
dcBuffer.DeleteDC();
bmpDesktop.DeleteObject();
bmpBuffer.DeleteObject();
}
|
|
|
|
|
>if ( bHideWindow) { pFrameWnd->SetWindowPos( NULL, -100,0,0,0, NULL ); Sleep(400);
I dunno, but why do you do the above ? Why the wait, and why not pFrameWnd->ShowWindow(SW_HIDE); ?
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
Thanks for the reply,
Yes, I had started out with a simple SW_HIDE, but when it still didn't work, I went overboard just to MAKE SURE , and put the wait so that even I could tell with my own eyes that the window was not being shown while the snapshot was taken.
|
|
|
|
|
This is just a copy->paste from MSDN:
You can use a bitmap to capture an image, and you can store the captured image in memory, display it at a different location in your application's window, or display it in another window.
In some cases, you may want your application to capture images and store them only temporarily. For example, when you scale or zoom a picture created in a drawing application, the application must temporarily save the normal view of the image and display the zoomed view. Later, when the user selects the normal view, the application must replace the zoomed image with a copy of the normal view that it temporarily saved.
To store an image temporarily, your application must call CreateCompatibleDC to create a DC that is compatible with the current window DC. After you create a compatible DC, you create a bitmap with the appropriate dimensions by calling the CreateCompatibleBitmap function and then select it into this device context by calling the SelectObject function.
After the compatible device context is created and the appropriate bitmap has been selected into it, you can capture the image. The BitBlt function captures images. This function performs a bit block transfer — that is, it copies data from a source bitmap into a destination bitmap. However, the two arguments to this function are not bitmap handles. Instead, BitBlt receives handles that identify two device contexts and copies the bitmap data from a bitmap selected into the source DC into a bitmap selected into the target DC. In this case, the target DC is the compatible DC, so when BitBlt completes the transfer, the image has been stored in memory. To redisplay the image, call BitBlt a second time, specifying the compatible DC as the source DC and a window (or printer) DC as the target DC.
The following example code, from an application that captures an image of the entire desktop, creates a compatible device context and a bitmap with the appropriate dimensions, selects the bitmap into the compatible DC, and then copies the image using the BitBlt function.
hdcScreen = CreateDC("DISPLAY", NULL, NULL, NULL);
hdcCompatible = CreateCompatibleDC(hdcScreen);
hbmScreen = CreateCompatibleBitmap(hdcScreen,
GetDeviceCaps(hdcScreen, HORZRES),
GetDeviceCaps(hdcScreen, VERTRES));
if (hbmScreen == 0)
errhandler("hbmScreen", hwnd);
if (!SelectObject(hdcCompatible, hbmScreen))
errhandler("Compatible Bitmap Selection", hwnd);
ShowWindow(hwnd, SW_HIDE);
if (!BitBlt(hdcCompatible,
0,0,
bmp.bmWidth, bmp.bmHeight,
hdcScreen,
0,0,
SRCCOPY))
errhandler("Screen to Compat Blt Failed", hwnd);
ShowWindow(hwnd, SW_SHOW);
Hope it helps...
- Anders
|
|
|
|
|
Hi,
I would like to give my window it's own unique class name. However, because I'm using MFC I have to use AfxRegisterWndClass() which makes up a name for itself. I want to be able to give it a more 'user-friendly' name.
Does anyone know how to get around this?
Cheers
James
|
|
|
|
|
You can use AfxRegisterClass() instead. You provide a WNDCLASS struct to this function, so you can name your class anything you like.
--Mike--
http://home.inreach.com/mdunn/
Is history an illusion caused by the passage of time, or is time an illusion caused by the passage of history?
|
|
|
|
|