|
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?
|
|
|
|
|
This is where it is done.
BOOL CGfxSplitterWnd::OnEraseBkgnd(CDC* pDC)
{
CRect rectClient;
GetClientRect(rectClient);
rectClient.InflateRect(-m_cxBorder, -m_cyBorder);
rectClient.bottom = rectClient.top + m_upBorder;
pDC->FillSolidRect(rectClient, GetSysColor(COLOR_3DFACE));
return true;
}
I'll write a suicide note on a hundred dollar bill - Dire Straits
|
|
|
|
|
I thought it was done in the splitterwnd...but when I removed that code, compiled...everything went to sh** on me...not even an assert...just an WinXP general exception
That control really pissed me off
Thanks though, i'll add that code to my own splitterwnd
Cheers
How do I print my voice mail?
|
|
|
|
|
how to chang the foreground/background color of selected text in a Edit Box?
Hello World
|
|
|
|
|
selected text???
Well you can handle WM_CTLCOLOREDIT which will change the color of all your text and background inside the edit, which I think might change your selection color (if selection is drawn using an XOR)
Actually I think those colors are stored in GetSysColor() so I think your out of luck without resorting to subclassing it's WM_PAINT message...however be forewarned...from personal experience...WM_PAINT is not the only place edit controls draw from...atleast it seemed to me
They paint inside WM_CHAR and everything...it's really quite annoying...
p.s-You could maybe intercept the selection of an edit control (using a hi-res timer to repeat check if selection has changed and if it has) change the global settings of foregroudn and text selection colors. This should work because only a single control can have focus at any given time...then when your done with the control return colors back to default.
Cheers
How do I print my voice mail?
|
|
|
|
|
emmm... it looks a bit complex. i will take your constructive advice. While, a great thanks.;)
Hello World
|
|
|
|
|
It'll pose for an interesting challenge...
How do I print my voice mail?
|
|
|
|
|
This article indirectly shows how to do that.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Dear All,
I am developing a dialog based application using MFC VC++ Version 6.0 for Windows 2000. The application consists of a TabControl derived from CTabCtrl Class having three tab pages in it. Also, the tabControl has Apply, Cancel , Ok button.
My query is how to communicate between the tabpages data and OK,Apply button ??
Similiar case, like "Display properties" dialog box which appears upon right clicking on the desktop. When we select a background and click on apply or ok button to make the changes, the background color gets changed.
Following is the code to create the tab pages. I have radio buttons in first CGeneralSettings page and I want to do various operation after user selects one of the radio button and clicks OK or APPLY button
///////////////////////////////////
The CMyTabCtrl has following datamember:::::::
class CMyTabCtrl : public CTabCtrl
{
public:
CMyTabCtrl();
CDialog *m_tabPages[3];
int m_tabCurrent;
int m_nNumberOfPages;
...
..};
CMyTabCtrl::CMyTabCtrl()
{
m_tabPages[0]=new CGeneralSettings;
m_tabPages[1]=new CAuthorization;
m_tabPages[2]=new CUnInstallation;
m_nNumberOfPages=3;
}
CMyTabCtrl::~CMyTabCtrl()
{
for(int nCount=0; nCount < m_nNumberOfPages; nCount++){
delete m_tabPages[nCount];
}
}
///////////////////////////
Please feel free to ask further clarifications in this regards,
Regards,
Rohit
|
|
|
|
|
All you need is apply,ok method implemented in each tab pages, can call them when you clicked on apply button on the tabcontrol (in a loop maybe).
I'll write a suicide note on a hundred dollar bill - Dire Straits
|
|
|
|
|
Im a BIG NEWBIE so sorry....
I have 5 command sets for doing different tasks in cmd
(Using ---ShellExecute--- in each command set)
This is a simulation of what i am trying to do.
Run the command sets in different order
********
RUN Command set in order of = 2-3-5-4-1
}
Command set-#1
}
{
Command set-#2
}
{
Command set-#3
}
{
Command set-#4
}
{
Command set-#5
}
********
Iv tryed it in class's but failed
How can i write that code ?
|
|
|
|
|
contemptx wrote:
I have 5 command sets for doing different tasks in cmd
What is a "command set?"
contemptx wrote:
(Using ---ShellExecute--- in each command set)
What is it that you are trying to get ShellExecute() to do?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I have created a microsoft chart graph. I need to plot around 1400 rows in x- axis which makes graph unclear. Can anybody suggest what solution i can find out to solve the problem?
How can i add a scroll bar to graph so that all the 1400 values can be seen clearly....?
OR is there any other active-x control in MFC which i can use to plot a 3D and 2D graphs.?
Please let me know ASAP.
Thanks in advance
vidya
|
|
|
|
|
Hai frens,
I dono how to insert an JPG image file in the picture control of MFC in VC++.If possible give me an example.
Any one knows plz help.
baljeedurai
|
|
|
|
|
not possible with default image control
look around CP for a subclass which does this...
Actually, thats a darn good idea for a control if one doesn't already exist
Cheers
How do I print my voice mail?
|
|
|
|
|
Do we Have Any Chance of using "Picture" class and loadpicture function as in VB here.If so How to use that class.
Thanks
Balajeedurai
|
|
|
|
|
Probably not using the picture tool inside the dialogbox editor...you'd have to use an activex or subclass that picture tool and render a jpeg instead
How do I print my voice mail?
|
|
|
|
|