|
How does ENC_Create_Overlay_Window() create the new window?
What windows styles ís the window created with?
I suspect you are using the WS_OVERLAPPED style and that requires the window coordinates given in screen coordinates. The coordinates you have provided (0,0,rc.right,rc.bottom) will most certainly create a window in the upper left corner of the screen if it is an overlapped window.
From where do you call ENC_Create_Overlay_Window()?
If you are using the WS_OVERLAPPED style, try GetWindowRect() instead of GetClientRect().
--
Roger
|
|
|
|
|
Just a guess but it sounds as though you are being plagued by screen versus client coordinates.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Hi All
I'm a bit of a network newbie, so sorry if this is a dumb question:
I'm writing a simple proxy server which needs to handle http and ssl tunnelling (for https requests) I've got the basic http stuff done, but I'm having trouble with the tunnelling and wondering if anyone out there can give me some pointers..
I get the request from the client:
CONNECT secure.some_host.com:443 HTTP/1.0
<Some Headers>
CRLF
I connect to secure.some_host.com on port 443, and if successful, return following to the client:
HTTP/1.0 200 Connection Established
CRLF
I then wait for the client to send the data, which in this case will be an SSL stream, but if I understand correctly could be anything at all, it doesn't matter I just forward everything blindly on to the server, Likewise after I've sent this off to the server I then forward everything I receive back to the client. I assume I just carry on doing this until the server closes the socket.
My problem here is: How do I know how big the stream is from the client / server so I can recv() until I've got it all?
Its a windows based app ( Although running in a console for now ) Using c++ / MFC but using my own Socket wrapper rather than MFC's CSocket
Thanks
Pj
|
|
|
|
|
you can send few bytes before you send your effective packet, telling how long will be the following datas. then, you recv() this, and while all the datas are not recv()ed yet, continue waiting for them...
TOXCCT >>> GEII power
|
|
|
|
|
Thanks for the reply.
I'm getting the data from the client app, which will be the web browser requesting the tunnel.
I'm sure the length of the stream *should* be in there somewhere but I dont know where to look for it.
|
|
|
|
|
i general, such info is put at the beginning of the packet (the 2 or 3 - or more, depending of the size needed - bytes)...
TOXCCT >>> GEII power
|
|
|
|
|
Hi, I am a newbie in Network programming. Lets say i hv a tcp server which hv several tcp clients connected to it. How the server retrieve the clients? I know sending message to the clients is the way to detect the connected clients. But is there any different and better way to retrieve the clients? Thanks alot!!!!!!
bamboo
|
|
|
|
|
you have to put their socket descriptor into a list, vector, queue... whatever you want but something that permits you to remember them.
it's to you to know how you store these datas then...
TOXCCT >>> GEII power
|
|
|
|
|
ok...lets say i already hv a list that contain the descriptor. if there are all together 10 clients in the list, but only 8 connected to the server, how the server detect those 2 disconnected clients? Thanks alot....
bamboo
|
|
|
|
|
when you make a recv() , the value 0 is returned when the other part of the connexion has closed (or is not connected anymore).
TOXCCT >>> GEII power
|
|
|
|
|
Thousand thanks...
|
|
|
|
|
usally the server spins off a thread for each connected client to serve the request coming from them.
I'll write a suicide note on a hundred dollar bill - Dire Straits
|
|
|
|
|
As a client, is there any way to detect others clients which connected to the server? **thanks**
|
|
|
|
|
No, unless the server gives some feedback to the client about other clients.
I'll write a suicide note on a hundred dollar bill - Dire Straits
|
|
|
|
|
I have a file and i want to save it in the specified by the user folder, All of this, using Visual C++(MFC dialogbox). I Know how to select a file but I don't know how to browse for a folder.
If anyone can help me, please do so.
Thank you.
|
|
|
|
|
SHBrowseForFolder(...) you can browse for the folders,
I'll write a suicide note on a hundred dollar bill - Dire Straits
|
|
|
|
|
I would like to write a Chat Server, like ICQ, and a saw the simple examle of chat server
that incuded in MSDN. But i noticed one thing - the message recieves from different clients
in one thread, so if one client sends a message, another client waits in the queue. And if
the client have a very slow internet connection it will work very slowly. I tried to make a
thread for this operation, that will handle every messages operations. But i had some
problem - this problem i see in serialization. It shows me the "Debug Assertation Failed" in
file sockcore.cpp 583 str. But I don't see any problem there. And i noticed one thing - when
i make a release everythig works good.
So i'm in the truble . Any suggestions....
And by the way i would like to use a RTF edit control. But streaming that it uses makes me
owfull . Are the any method just to add string to the control without using the streaming.
Because when we use the streaming we should handle all the stream, so get all old content
and add to it new. I don't like this way.Any suggestions....
P.S.
Sorry for my bad english.
|
|
|
|
|
I would like to implement some functionality in my application which is similar to the thumbnail view facility in win2k. My requirement is to show the thumbnail view of all types of files (or atleast those which are supported by win2k thumbnail view). my OS is win2k and using VC++ 6.0
|
|
|
|
|
Those thumbnail views...i'm pretty certain are not generated by the OS (it would have to be pretty smart to do that) but rather by the suppoting application and displayed or delivered to desktop etc via shell extensions or something...
You would have quite a task ahead of you if you rendered thumbs for every known file type
Read Mike Dunns articles on shell extensions...they're great!!!
Cheers
How do I print my voice mail?
|
|
|
|
|
Been trying to make a program to capture and process frames to detect movement, first trying to set up a window with the video capture window. Getting a problem when I try to build the project.
Here is the error:
wmcaptest.obj : error LNK2001: unresolved external symbol _capGetDriverDescriptionA@20
wmcaptest.obj : error LNK2001: unresolved external symbol _capCreateCaptureWindowA@32
Debug/CameraControl.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.
Here is the code:
//File: WM_CAP test.cpp
#include <windows.h>
#include "resource.h"
#include <vfw.h>
#include <commdlg.h>
#include "wmcaptest.h"
HWND captureWindow; //Main capture window handle
HINSTANCE hInstance; //Handle to the instance that contains the window procedure for the class
HMENU hMenuMain; //Handle to the main menu for the class
WORD gwDeviceIndex;
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM); //Required for the WndClass struct
static void CenterCaptureWindow(HWND, HWND);
static void ResizeMainWindow(int, int, HWND, HWND);
static void StartNewVideoChannel(HWND, HWND, WORD);
CAPDRIVERCAPS gCapDriverCaps;
CAPSTATUS gCapStatus;
//Winmain: application entry point function
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
WNDCLASS wndClass;
static TCHAR windowName[] = TEXT ("Camera Motion Detection") ;
HWND cWindow;
MSG msg;
//Setting all the necessary values for the wndClass struct
//First checks to see whether this is the first instance of the application or not
if(!hPrevInstance)
{
wndClass.style = CS_HREDRAW | CS_VREDRAW;
wndClass.lpfnWndProc = WndProc;
wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = 0;
wndClass.hInstance = hInstance;
wndClass.hIcon = NULL;
wndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndClass.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
wndClass.lpszMenuName = NULL;
wndClass.lpszClassName = windowName;
//Attempts to register the class for future calls of the CreateWindow function
//If unsuccessful the program will display a message box letting the user know what happened
if (!RegisterClass (&wndClass))
{
MessageBox (NULL, TEXT ("Could not init Programm"),
windowName, MB_ICONERROR) ;
return 0;
}
}
//Create the applications main window using the create window function
cWindow = CreateWindow(
windowName,
TEXT ("Frame Capture V1.0"),
WS_CLIPCHILDREN |
WS_MAXIMIZE |
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0,
320, 240,
NULL,
NULL,
hInstance,
NULL);
ShowWindow (cWindow, nCmdShow) ;
UpdateWindow (cWindow) ;
while(GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
//Application main window procedure
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HDC hdc;
PAINTSTRUCT ps;
LPSTR szMessage = "First time run";
HMENU hSubMenu;
WORD wDriverCount = 0;
switch(message)
{
case WM_CREATE:
WORD wIndex;
TCHAR achDeviceName[80];
TCHAR achDeviceVersion[100];
TCHAR achBuffer[100];
DWORD dwError;
//Create an instance of the main window
hInstance = (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE);
//Link the menu to the instance
hMenuMain = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_MENU1));
SetMenu (hwnd, hMenuMain);
hSubMenu = GetSubMenu(hMenuMain,1);
//Create the capture window
captureWindow = capCreateCaptureWindow((LPTSTR)TEXT("Capture Window"),
WS_CHILD | WS_VISIBLE,
0, 0, 160, 120,
hwnd, 0);
//Try to connect one of the MSVIDEO drivers
for (wIndex = 0 ; wIndex < MAXVIDDRIVERS ; wIndex++)
{
if (capGetDriverDescription(wIndex,
(LPTSTR)achDeviceName, sizeof(achDeviceName)/ sizeof(TCHAR),
(LPTSTR)achDeviceVersion, sizeof(achDeviceVersion)/sizeof(TCHAR)))
{
// Append driver name to "Options" list in menu
wsprintf(achBuffer, TEXT("&%d %s"), wIndex, (LPTSTR)achDeviceName) ;
AppendMenu(hSubMenu, MF_ENABLED, IDM_O_DRIVERS+wIndex, achBuffer) ;
if (wDriverCount++ == 0)
{
// Only if no other driver is already connected
dwError = capDriverConnect(captureWindow, wIndex);
if (dwError)
{
CheckMenuItem(hMenuMain, IDM_O_DRIVERS+wIndex, MF_BYCOMMAND | MF_CHECKED) ;
gwDeviceIndex = wIndex ;
}
}
} // end of if (capGetDriverDesc..())
}
// Now refresh menu, position capture window, start driver etc
DrawMenuBar(hwnd);
CenterCaptureWindow(hwnd, captureWindow);
StartNewVideoChannel(hwnd, captureWindow, gwDeviceIndex);
break;
case WM_PAINT:
hdc = BeginPaint(hwnd, &ps);
TextOut(hdc, 70, 50, szMessage, strlen(szMessage));
EndPaint(hwnd, &ps);
break;
case WM_CLOSE:
DestroyWindow(hwnd);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, message, wParam, lParam);
}
return 0;
}
static void CenterCaptureWindow(HWND hWndMain, HWND hWndCap)
{
RECT MainRect ;
RECT CapRect ;
WORD wCapXPos ;
WORD wCapYPos ;
// Get the sizes of main and capture windows and
// calculate the location for centering
GetClientRect(hWndMain, &MainRect) ;
GetClientRect(hWndCap, &CapRect) ;
wCapXPos = max(0, ((MainRect.right -MainRect.left) - (CapRect.right - CapRect.left)) / 2) ;
wCapYPos = max(0, ((MainRect.bottom - MainRect.top) - (CapRect.bottom - CapRect.top)) / 2) ;
// Position the capture window at the required location
MoveWindow(hWndCap, wCapXPos, wCapYPos, (CapRect.right - CapRect.left),
(CapRect.bottom - CapRect.top), TRUE) ;
}
static void ResizeMainWindow(int XPos, int YPos, HWND hWndMain, HWND hWndCap)
{
////////////////////////////////////////////////////////////////////////
// hWndM: Application main window handle
// hWndC: Capture window handle
////////////////////////////////////////////////////////////////////////
RECT CapRect ;
// Get the sizes of main window
GetClientRect(hWndCap, &CapRect) ;
// Position the capture window at the required location
MoveWindow(hWndMain, XPos, YPos, (CapRect.right - CapRect.left + 7),
(CapRect.bottom - CapRect.top + 45), TRUE) ;
}
//
// StartNewVideoChannel: Gets Selected Driver's Caps -- Updates menu,
// Checks Image Size -- Resizes display window,
// Enables Preview (at 15 FPS rate)
//
static void StartNewVideoChannel(HWND hWndM, HWND hWndC, WORD wIndex)
{
////////////////////////////////////////////////////////////////////////
// hWndM: Application main window handle
// hWndC: Capture window handle
// wIndex: Selected capture driver index
////////////////////////////////////////////////////////////////////////
// Get capture driver settings and update menu
capDriverGetCaps(hWndC, &gCapDriverCaps, sizeof(CAPDRIVERCAPS)) ;
EnableMenuItem(hMenuMain, ID_SETTINGS_VIDEOFORMAT, MF_BYCOMMAND |
gCapDriverCaps.fHasDlgVideoFormat ? MF_ENABLED : MF_GRAYED) ;
EnableMenuItem(hMenuMain, ID_SETTINGS_VIDEOSOURCE, MF_BYCOMMAND |
gCapDriverCaps.fHasDlgVideoSource ? MF_ENABLED : MF_GRAYED) ;
// Get video format and adjust capture window
capGetStatus(hWndC, &gCapStatus, sizeof(CAPSTATUS)) ;
SetWindowPos(hWndC, NULL, 0, 0, gCapStatus.uiImageWidth,
gCapStatus.uiImageHeight, SWP_NOZORDER | SWP_NOMOVE) ;
capPreviewRate(hWndC, MS_FOR_15FPS) ;
capOverlay(hWndC, TRUE) ;
}
-----------------
Any help on this would be greatly appreciated. As it is proving a great stumbling block and doesn't make any sense to me.
|
|
|
|
|
For link error put Vfw32.lib entry in the lib section in the link tab of your project settnigs.
I'll write a suicide note on a hundred dollar bill - Dire Straits
|
|
|
|
|
Awesome, thanks, that fixed it.
|
|
|
|
|
How do I create that border effect between the bottom of the toolbar and the client area???
I have generated a app wiz SDI app and would like that seperator line, but cannot for the life of me figure out how to acheive it...
See the following link for what I mean exactly...notice under his toolbar there is a line which normally isn't there...
http://www.codeguru.com/Cpp/controls/controls/article.php/c2155[^]
Cheers
How do I print my voice mail?
|
|
|
|
|
Get the window handle of the toolbar and change the style of the window.
I'll write a suicide note on a hundred dollar bill - Dire Straits
|
|
|
|
|
I don't think it's a toolbar style (even if it was which style???)
If you play with the example I linked to you will notice when you remove the toolbar that line seperating client area and menubar is still there...
I am sure menubar don't have a style to do this...it is some other technique i'm sure.
Cheers
How do I print my voice mail?
|
|
|
|
|