|
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.;)
|
|
|
|
|
|
The link from Nish sums it up well.
From DOS 5 upwards there is built in calls to help in this sort of communications. I have a DOS Bible (somewhere arround here) if you can get hold of one of those then you will see a list of all DOS calls and the parameters used. You can speedup your embedded systems no end if you use these rather than allowing the C interface to do it.
A typical one that the C compilers did was to use the indirect functions of DOS to write to the screen, it is legal in DOS to use one its more direct screen writeing calls.
There is also a FileIO function (off the top of my head call 24 or 42) that covers just about any communications you could need, including IP.
We do it for the joy of seeing the users struggle.
|
|
|
|
|
I have the need to access a named pipe over a network where both sides are Windows NT 4.0 machines. The pipe server is implemented as an NT service while the client request will originate from an ATL COM dll. I have zero problems if I invoke the COM object from my test application; the two machines "talk" to each other, transfer data back and forth, etc.
My problem is when the COM object is invoked as a result of IIS activity. In this case, my cgi application (written in VC++) creates the COM object. The COM object then attempts to connect to the pipe using CreateFile(). I am sure this is a problem with the security attributes setting for the client side, at this point the arguement is set to NULL.
BTW - the named pipe is created WITH security attributes... A SD is declared, then initialized using InitializeSecurityDescriptor() and set using SetSecurityDescriptorDacl(). sa.lpSecurityDescriptor is then set to the SD.
So, any ideas on how I might resolve this little problem??
TIA,
Barry
|
|
|
|
|
Barry, I think security attributes defined by your server prohibit access to pipe. When you create named pipe (server side) you specify, who can access it. However, local system account from another machine has no right to access resources on the remote machine (your scenario, when COM object created by IIS access named pipe).
I would recommend two solution:
1. set security attributes to allow access for everyone (bad, not secure solution)
or
2. impersonate client COM object to proper user account to access remote resources (your named pipe).
I hope this will help you.
Kind regards.
Martin
|
|
|
|
|
When you "execute" a COM object from a cgi application, it is running in the local anonymous web-user's security context (IUSER_something), that user normally dont have the rights to access the remote machine. The problem is the same with the system account when running from a server.
The most easy way, AFAIK, is to get people to log on the webserver, instead of being anonymous users, then the COM object executes in their security context, and then it might have the rights to access the remote server.
I *think* there is a way to say to IIS that "this application (your CGI app) should run as this user", but right now I don't remember how to do it...
You can also say that anonymous users on IIS should run as a domain user that you select, then they have the rights to access other computers on the network, but then you have a huge security risk...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Hi
Does anybody knows how to make the following only with bit operations
if( a1==b1 )
a1 = c1;
|
|
|
|
|
Is this sufficient solution?
if (!(a1 ^ b1)) a1 = c1;
|
|
|
|
|