|
You can make the function as Static member of the class(instead of global class) and then pass it to thread function.
Deepak Khajuria
|
|
|
|
|
But then he wont be able to access the non-static members
Nish
|
|
|
|
|
Yes, he has to pass the instance of the class as parameter,or something similar.
But the main difference is that the static function of the class has full access to the class, where as global function cannot access the protected/private members.
Deepak Khajuria
|
|
|
|
|
He can always call the static functions of his class from his global function anyway. Thus he can also access all static members (via the static function, of course)
Nish
|
|
|
|
|
The static functions & global functions are same in sense that you do have instance of the class(this) in it. You need to get instance of the class from somewhere to call its non-static members.
But the main difference is that the static function of the class has access to the protected/private members of the object of same class.
This does not hold true for the global functions.(unless you make them friend)
So in a thread where you require direct access to class protected/private members, it is better to make thread function as static member of the class.
Deepak Khajuria
|
|
|
|
|
the MIME file of eml looks like this:
From: "Doug Sauder" <doug@example.com>
To: "Joe Blow" <jblow@example.com>
Subject: Test message from Microsoft Outlook 00
Date: Wed, 17 May 2000 19:42:10 -0400
Message-ID: <ndbbiakopkhfgplcodiggekfchaa.doug@example.com>
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_NextPart_000_0008_01BFC037.FDD8EE90"
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)
Importance: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
This is a multi-part message in MIME format.
------=_NextPart_000_0008_01BFC037.FDD8EE90
Content-Type: multipart/alternative;
boundary="----=_NextPart_001_0009_01BFC037.FDD8EE90"
------=_NextPart_001_0009_01BFC037.FDD8EE90
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
All cows eat grass=20
=20
------=_NextPart_001_0009_01BFC037.FDD8EE90
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
All cows eat grass =
=20
------=_NextPart_001_0009_01BFC037.FDD8EE90--
------=_NextPart_000_0008_01BFC037.FDD8EE90
Content-Type: image/png;
name="greenball.png"
Content-Transfer-Enco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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAp1fnZAAAAAXRSTlMAQObYZgAAABZ0RVh0U29mdHdhcmUAZ2lmMnBuZyAyLjAu
MT1evmgAAAFtSURBVHicddJtV8IgFAdwD2zIgMEE1+NcqdsoK+m5tCyz7/+ZiLmHsyzvq53zO/cy
+N9ery1bVe9PWQA9z4MQ+H8Yoj7GASZ95IHfaBGmLOSchyIgyOu22mgQSjUcDuNYcoGjLiLK1cHh
0fHJaTKKOcMItgYxT89OzsfjyTTLC8UF0c2ZNmKquJhczq6ub+YmSVUYRF59GeDastu7+9nD41Nm
kiJ2jc2J3kAWZ9Pr55fH18XSmRuKUTXUaqHy7O19tfr4NFle/w3YDrWRUIlZrL/W86XJkyJVG9Ea
EjIx2XyZmZJGioeUaL+2AY8TY8omR6nkLKhu70zjUKVJXsp3quS2DVSJWNh3zzJKCyexI0ZxBP3a
fE0ElyqOlZJyw8r3BE2SFiJCyxA434SCkg65RhdeQBljQtCg39LWrA90RDDG1EWrYUO23hMANUKR
Rl61E529cR++D2G5LK002dr/qrcfu9u0V3bxn/XdhR/NYeeN0ggsLAAAACV0RVh0Q29tbWVudABj
bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII=
------=_NextPart_000_0008_01BFC037.FDD8EE90
Content-Type: image/png;
name="redball.png"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="redball.png"
iVBORw0KGgoAAAANSUhEUgAAABsAAAAbCAMAAAC6CgRnAAADAFBMVEX///8AAAABAAALAAAVAAAa
AAAXAAARAAAKAAADAAAcAAAyAABEAABNAABIAAA9AAAjAAAWAAAmAABhAAB7AACGAACHAAB9AAB0
AABgAAA5AAAUAAAGAAAnAABLAABvAACQAAClAAC7AAC/AACrAAChAACMAABzAABbAAAuAAAIAABM
AAB3AACZAAC0GRnKODjVPT3bKSndBQW4AACoAAB5AAAxAAAYAAAEAABFAACaAAC7JCTRYWHfhITm
f3/mVlbqHx/SAAC5AACjAABdAABCAAAoAAAJAABnAAC6Dw/QVFTek5PlrKzpmZntZWXvJSXXAADB
AACxAACcAABtAABTAAA2AAAbAAAFAABKAACBAADLICDdZ2fonJzrpqbtiorvUVHvFBTRAADDAAC2
AAB4AABeAABAAAAiAABXAACSAADCAADaGxvoVVXseHjveHjvV1fvJibhAADOAAC3AACnAACVAABH
AAArAAAPAACdAADFAADhBQXrKCjvPDzvNTXvGxvjAADQAADJAAC1AACXAACEAABsAABPAAASAAAC
AABiAADpAADvAgLnAADYAADLAAC6AACwAABwAAATAAAkAABYAADIAADTAADNAACzAACDAABuAAAe
AAB+AADAAACkAACNAAB/AABpAABQAAAwAACRAACpAAC8AACqAACbAABlAABJAAAqAAAOAAA0AACs
AACvAACtAACmAACJAAB6AABrAABaAAA+AAApAABqAACCAACfAACeAACWAACPAAB8AAAZAAAHAABV
AACOAACKAAA4AAAQAAA/AAByAACAAABcAAA3AAAsAABmAABDAABWAAAgAAAzAAA8AAA6AAAfAAAM
AAAdAAANAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAD8LtlFAAAAAXRSTlMAQObYZgAAABZ0RVh0U29mdHdhcmUAZ2lmMnBuZyAyLjAu
MT1evmgAAAIISURBVHicY2CAg/8QwIABmJhZWFnZ2Dk4MaU5uLh5eHn5+LkFBDlQJf8zC/EIi4iK
iUtI8koJScsgyf5nlpWTV1BUUlZRVVPX4NFk1UJIyghp6+jq6RsYGhmbKJgK85mZW8Dk/rNaSlhZ
29ja2Ts4Ojkr6Li4urFDNf53N/Ow8vTy9vH18w8IDAoWDQkNC4+ASP5ni4wKio6JjYtPSExKTnFW
SE1LF4A69n9GZlZ2Tm5efkFhUXFySWlZlEd5RSVY7j+TkGRVdU1tXX1DY1Ozcktpa1t7h2YnOAj+
d7l1tyo79vT29SdNSJ44SbFVdHIo9xSIHNPUaWqTpifNSJrZnK00S0U1a/acUG5piNz/uXLzVJ2q
m6dXz584S2WB1cJFi5cshZr539xVftnyFKUVTi2TVjqvyhJLXb1m7TqoHPt6F/HW0g0bN63crGqV
tWXrtu07BJihcsw71+zanRW8Z89eq337RQ/Ip60xO3gIElX/LbikDm8T36KwbNmRo7O3zpHkPSZw
HBqL//8flz1x2OOkyKJTi7aqbzutfUZI2gIuF8F2lr/D5dw2+fZdwpl8YVOlI+CJ4/9/joOyYed5
QzMvhGqnm2V0WiClm///D0lfXHtJ6vLlK9w7rx7vQk5SQJbFtSms1y9evXid7QZacgOxmSxktNzd
tSwwU+J/VICaCPFIYU3XAJhIOtjf5sfyAAAAJXRFWHRDb21tZW50AGNsaXAyZ2lmIHYuMC42IGJ5
IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg==
------=_NextPart_000_0008_01BFC037.FDD8EE90--
the question is :
Can you tell why the line "boundary="----=_NextPart_000_0008_01BFC037.FDD8EE90"
" is required.
and ------=_NextPart_000_0008_01BFC037.FDD8EE90--
???
any suggestions?
thanks in advance!
|
|
|
|
|
To mark the beginning and end of each attachment
Nish
|
|
|
|
|
This is a MIME message that contains binary attachments in addition to plain text. The "boundary=" header defines the string that is used to separate the various parts of the message. The actual separator has "--" prefixed to it, and the final separator has also "--" at the end. All this is defined in RFC 2046. If you are writing an application that creates/receives MIME messages you must read the RFCs 2045 - 2049!
|
|
|
|
|
I have written a application, which use DirectShow
video playback system and DivX video codec to playback the mpeg-4 video.
In "debug" version, all is ok!
but after I compile and link as "Release version", when I test it, it go awry.
here is some code:
HRESULT CVideoWnd::PrePlayVideo()
{
JIF(CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER,
IID_IGraphBuilder, (void **)&m_pGraph));
....
JIF(m_pGraph->QueryInterface(IID_IMediaControl, (void**)&m_pMediaControl));
JIF(m_pGraph->QueryInterface(IID_IMediaEventEx, (void **)&m_pMediaEvent));
JIF(m_pGraph->QueryInterface(IID_IMediaSeeking, (void **)&m_pMediaSeek));
JIF(m_pGraph->QueryInterface(IID_IVideoWindow, (void **)&m_pVideoWnd));
JIF(m_pGraph->QueryInterface(IID_IBasicVideo, (void **)&m_pBasicVideo));
JIF(m_pGraph->QueryInterface(IID_IBasicAudio, (void **)&m_pBasicAudio));
HWND hWnd = GetSafeHwnd();
ASSERT(hWnd != NULL);
JIF(m_pVideoWnd->put_Owner((OAHWND)hWnd));
JIF(m_pVideoWnd->put_WindowStyle(WS_CHILD | WS_CLIPSIBLINGS));
JIF(m_pMediaEvent->SetNotifyWindow((OAHWND)hWnd, WM_GRAPHNOTIFY, 0));
VERIFY(GetDuration(&m_llDuration));
JIF(InitVideoWindow(1, 1));
ShowWindow(SW_SHOWNORMAL);
UpdateWindow();
SetForegroundWindow();
SetFocus();
JIF(m_pVideoWnd->SetWindowForeground(0));
..
}
HRESULT CVideoWnd::OnVideoPlay()
{
ASSERT(m_pMediaControl);
HRESULT hr;
OAFilterState fs = State_Running;
hr = m_pMediaControl->Run();
if (hr == S_FALSE)
hr = m_pMediaControl->GetState(INFINITE, &fs);
m_psCurrent = Running;
m_nTimerID = SetTimer(1, 100, NULL);
return S_OK;
}
....
HRESULT CVideoWnd::OnGraphNotify()
{
LONG evCode, evParam1, evParam2;
HRESULT hr=S_OK;
while(SUCCEEDED(m_pMediaEvent->GetEvent(&evCode, &evParam1, &evParam2, 0)))
{
// Spin through the events
hr = m_pMediaEvent->FreeEventParams(evCode, evParam1, evParam2);
if(EC_COMPLETE == evCode)
{
LRESULT lRepeat = GetParent()->SendMessage(WM_QUERY_IS_REPEAT);
if (lRepeat == 0)
OnVideoStop();
else
{
LONGLONG pos = (LONGLONG)GetParent()->SendMessage(WM_QUERY_BEGIN_POS);
JIF(m_pMediaSeek->SetPositions(&pos, AM_SEEKING_AbsolutePositioning ,
NULL, AM_SEEKING_NoPositioning));
}
}
}
return hr;
}
so, I try as follow:
1. I set "Win32 Release" building mode, but I reserver "debug info" in application
and set debug info is for "Program Database for edit and continue"
I have found the bug is in the function OnGraphNotify()
when I play it, the points "m_pMediaEvent" in function OnGraphNotify become "0", in fact, such as
m_pMediaControl, m_pMediaEvent, m_pMediaSeek, m_pGraph, all become 0.
I have initialized all the pointers in function "PrePlayVideo()", and when I play
it, I have check all the pointers In "Release version" have been initialized.
but, when my video window receive the event of filter graph manager, the pointer became o;
why? who can help me???
2. When I modify project setting, I set "C++ - Code Generation - Use run-time library" is "Debug Multithreaded",
now, all is succeed. why?
once I set this is "Multithreaded" in "Release Version", it run failed.
but I change it to "debug multithreaded", it run succeed.
In "Debug Multithreaded", the pointer "m_pMediaControl", "m_pMediaEvent", "m_pMediaSeek", "m_pGraph", is ok;
but all became 0 in "Multithreaded".
who can tell me the reason?
thank you very much!
|
|
|
|
|
Hi,
I have been trying for a couple of days to get some help with my tooltip problem and it doesn't seem that anyone can help me, so I created a sample project that displays the problem.
Please download the project at http://www.roninkuma.com/ToolTipTest.zip This application uses the Microsoft Date/Time picker ActiveX control, I figured everyone would have that one. If you run the project and put the mouse in the top left hand corner of the date/time control, you will see a tooltip pop up under the mouse that say's "Hello", after a second or two, you'll see another tooltip pop up at the bottom of the window that also say's "Hello".
Can anyone help me to get rid of the "Hello" at the bottom of the screen?
Thanks in advance for any help you can provide
|
|
|
|
|
Hi,
http://support.microsoft.com/support/kb/articles/q141/8/71.asp
says how to add tooltip control to an activeX control. Not sure if this is the problem. Hope this helps.
Cheers
Kannan
|
|
|
|
|
Hi Kannan,
Thanks for the suggestion but I don't think this will work for me. I don't have the source for the ActiveX control, my application is just the consumer of the control.
Thanks again for taking the time to look at this for me,
Craig
|
|
|
|
|
if you are using ifstream and ofstream, how can you ensure that when you use the getline method, you do not overrun your buffer size? (i.e. if you use basic C++ methods and classes, how do you make sure that your program can read a 1000 character line as well as 10 character line, without wasting memory by creating large arrays beforehand?
i.e. what's the best sol'n for this:
while(!fin->eof())
{
fin->getline(x, sizeof(x), '\n');
}
|
|
|
|
|
Use the non-member function istream& getline(istream& strm, string& str, char delim) instead to read the data into a std::string
|
|
|
|
|
Hey, I'm programming Windows in API, I'm new at it, and I don't quite understand how to change the size of a font. I have this under my WM_PAINT procedure.
case WM_PAINT:
hdc = BeginPaint(hwnd, &ps);
GetClientRect (hwnd, &rect);
SetBkMode(hdc,TRANSPARENT);
SelectObject(hdc,GetStockObject(DEFAULT_GUI_FONT));
TextOut(hdc,5,5,"Need help..",25);
DeleteObject(SelectObject(hdc,GetStockObject(DEFAULT_GUI_FONT)));
EndPaint(hwnd, &ps);
return 0;
See the TextOut? How would I make it so it says "Need help..." in, like, 20 font instead of a 10 size font. Any help would be appreciated. Thanks =)
|
|
|
|
|
Use ::CreateFont(..) to create custom sized font.
HFONT hFont = ::CreateFont(..);
::SelectObject(hdc, hFont);
Hope this helps.
// Fazlul
Get RadVC today! Play RAD in VC++
http://www.capitolsoft.com
|
|
|
|
|
font1.CreateFont(20,0,0,0,FW_NORMAL,0,0,0,DEFAULT_CHARSET,
OUT_CHARACTER_PRECIS,CLIP_CHARACTER_PRECIS,
DEFAULT_QUALITY,DEFAULT_PITCH | FF_DONTCARE,"Arial");
SetFont(&font1,TRUE);
|
|
|
|
|
oops!
That's for MFC. And for controls too.
I didnt notice you were doing a non-MFC program.
you can use the SDK call CreateFont that returns an HFONT.
The parameters are same.
and send a WM_SETFONT message with this HFONT as the WPARAM
Nish
|
|
|
|
|
oops again!
as I said that's for controls.
for affecting your TextOut calls
use SelectObject(GetDC(hWnd),hFont)
Nish
|
|
|
|
|
I guess he is already in a WM_PAINT proc. and thus have a valid HDC handle. This should allow him to use
::SelectObject(hdc, hFont);
// Fazlul
Get RadVC today! Play RAD in VC++
http://www.capitolsoft.com
|
|
|
|
|
hi. there's two things bugging my mind recently. The first is this:
i made a win32 dialog based application without MFC. I added a ListView on the dialog and when i tried to run the program it wouldn't show the dialog window. The process was running but it just didn't show the dialog which had the control on it. Now i realise that Active-x controls and things like that cant be used without initializing some things first, but this isn't an active-x control is it??? If it is, please tell me, and possible inform me on how to initialize active-x components in a win32 project.
The second thing is simple, allthough it could be i posted something about it before on this board i'm not quite sure. I just want to know if it is possible to take an MFC class, like for example "CSocket" and use it in a win32 project. I realise you would have to make some changes but for now i just want to know if it is possible.
Thanks
Kuniva
|
|
|
|
|
Without seeing your source code, I can't think what the problem is. You did remember to call BOOL InitCommonControlsEx
Does it show the dialog if the listview32 isn't on it?
Michael
|
|
|
|
|
did you show the window after creating it ShowWindow(SW_SHOW) and is your window class registered.
Some of the MFC classes can be used standalone, particularly the those that do not include a view. CTime and CString are typical ones that would be used.
I haven't done it with a Socket, but I have taken some diagnostic ones. It is a matter of including the right headers (and sub headers) and setting the right #defines to enable the parts your functions need (otherwise done for you by a wizard). You can see a list of these in .h files and the right Linked dlls. Remember that the controls are all based on CObject too so as far as 'visible' objects are concerned you are not able to ignore the MFC4xx.dll's altogether, I'm afraid I don't have my list of whats in each one anymore.
We do it for the joy of seeing the users struggle.
|
|
|
|
|
I have a CFormView and inside it is a CPropertySheet with
5 property pages. The property pages are identical. I typed:
CMyPropertySheet.h
------------------
#include "MyPage1.h"
...
CMyPage1 page1;
CMyPage1 page2;
CMyPage1 page3;
CMyPage1 page4;
CMyPage1 page5;
and then I added the pages. It works, but for awhile. Then I
get a Fatal Exception Handling error and the computer just goes
nuts! I have to reboot. I know I am doing something wrong, but
I don't know how to resolve it unless I have 5 separate classes
and 5 separate IDD_PAGE1, IDD_PAGE2, rather than just 1.
Any way of reusing code without getting massive errors?
Please, any response any one can give me will be greatly
appreciated.
Sincerely,
Danielle (an overworked graduate student)
|
|
|
|
|
I am running DOS on my embedded system and I need to be able to send data back through the net. I am using Borland Turbo C. Does anyone know of any code that I can use to handle the TCP\IP stack, like Windows Socket API for Win32?
Please help.;)
|
|
|
|
|