|
|
Thanks, that's kind of what I was looking for. I looked up the RFC too but 69 pages is too much. Thanks
|
|
|
|
|
Hello,
Imagine a Client/Server chat program.
How the Server listen to clients for their requests for connecting them to it ?
I know there is Listen() function in MFC socket classes.
But where should i use it ?
Is there any special message in MFC socket classes for listening ?
Thanks in Advance !
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Well, if you use MFC you simply need to call Listen() once after you have set up your socket with Create() and Bind().
Once your app is in listen mode you'll get notified about incoming client connections through the OnAccept() notification of your CSocket-derived class
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
The cursor doesn't change voer any of my windows in a MFC MDI app.
(MDI Child windows, other windows ive created)
I mean, if I put mouse over border to resize it, and then quickly move mouse over the window, the resize cursor stays.
I just wait it to change to the arrow cursor...
MSDN says that the default implementation of the cursor change message is to change to the arrow... why is it not working?
|
|
|
|
|
Try to implement an answer for message WM_SETCURSOR in your child frame (have a look to CWnd::OnSetCursor in MSDN).
HTH,
I hurt so bad inside
I wish you could see the world through my eyes
It stays the same
I just wanna laugh again
|
|
|
|
|
How can I Invalidate() all views in a MFC MDI app?
|
|
|
|
|
|
This doesn't even repaint the current view...
|
|
|
|
|
OK, nevermind that, that was my bad.
But what I need to do is repaint all views of all documents
|
|
|
|
|
AfxGetMainWnd()->Invalidate() is one way.
|
|
|
|
|
I tried, but that didn't seem to update any windows? Hmm maybe I did it a bit wrong.. I'll see...
Nope, doesn't effect the child windows...
|
|
|
|
|
Hi,
I have a windows handle which is returned by third party lib, this handle sometimes is valid, sometimes isn't. I want to know whether there is method or function to judge the validity of a handle?
Thanks,
Jeff Xi
|
|
|
|
|
|
Roman Fadeyev wrote:
GetHandleInformation()
Beware that function only works in Windows NT, it is not supported for Win9x OSs
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
There are ways, but it depends on the type of handle that you are dealing with.
Do you have a window handle, a GDI handle, a file handle, or something else?
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
If it's a handle to a window, you can call IsWindow().
For other handles and Win98 compatibility, you could use DuplicateHandle() and check the error returns (don't forget to close the duplicated handle if successful.)
|
|
|
|
|
I'd like to detect the folder (path) where a my application is running
and put the data in a string. - Can somebody give me some suggestion
(without using the system() funcion)? - Thanks - giovanni.
|
|
|
|
|
If you mean the path where your .exe is located, you can use a function:
GetModuleFileName(...), where you put your exe module instance handle and retrieve the whole path including the exe module ("c:\windows\notepad.exe"). Then you have to simply strip the exe name and voila you have path.
If you mean the current directory for process, use GetCurrentDirectory()
|
|
|
|
|
geo_m is completely right. But I would add little remark: you can pass NULL to GetModuleFileName() to retrieve your app path. It's easier to use. Especially it is important to pass NULL when you get AppPath from DLL.
How to cut filedir from path? All functions for manipulating with filenames are placed in shlwapi.h. Their names are beginning from "Path" word. For example: PathFindFileName (Searches a path for a file name). Also you can use C++ function _splitpath
|
|
|
|
|
An example:
char szDrive[_MAX_DRIVE];
char szDir[_MAX_DIR];
char szFileName[_MAX_FNAME];
char szExt[_MAX_EXT];
char szBuffer[_MAX_PATH];
// get path of executable
GetModuleFileName(NULL, szBuffer, _MAX_PATH);
// split into parts, to get the Path
const char* pFilePath = szBuffer;
_splitpath(pFilePath, szDrive, szDir, szFileName, szExt);
CString strPath;
strPath.Format("%s%s", szDrive, szDir);
TRACE("File Path is %s\n", strPath);
Gaulles
|
|
|
|
|
void getAppDir
(CString& strAppDir)
{
char* pSlash = NULL;
char szFilespec [_MAX_PATH];
::GetModuleFileName (AfxGetInstanceHandle(), szFilespec, _MAX_PATH);
pSlash = strrchr (szFilespec, '\\');
ASSERT (pSlash != NULL);
pSlash++;
*pSlash = '\0';
strAppDir = szFilespec;
} /ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
use GetModuleFileName()
Hari Krishnan
|
|
|
|
|
I came across a math problem that i have no clue how to write a program for it.
It says to arrange the numbers 1 through 30 so that the sum of any 2 consecutive integers is a perfect square (i.e. 4,16,25,36,49...). I found what i think is a small pattern
15 1 24
14 2 23
13 3 22
12 4 21
11 5 20
30 6 19
29 7 18
28 8 17
27 9 16
26 10 25
but anyways, i need to know how to write a prog. that will either arrange these sets of numbers or arrange 1-30 the right way. I would really appreciate help on this one
thanks
aaron barker
|
|
|
|
|
Arranging as circle or floating from the ends?
RJS
|
|
|
|