|
pankajdaga wrote:
However, I have no idea what a member template is.
Well, the name is self exlaining. Member template == template method.
template <class T>
class Ptr
{
public:
Ptr(T* pp = NULL) { p = pp; }
template <class T2>
void Assign(T2 *pp)
{
p = pp;
}
private:
T *p;
};
Ptr<CWnd> pw;
CDialog d;
pw.Assign(&d);
CString s;
pw.Assign(&s);
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
I'm writing a server based on sockets and i want to use asynchronous accept calls. By default they are synchronous.
Do you know how to set them up?
rechi
|
|
|
|
|
Is it possible to create a CMDIFrameWnd with a CSplitterWnd in it? Or is that only done in CFrameWnd and CMDIChildWnd?
Bla bla bla
|
|
|
|
|
Create a new CView derived class named CNewView (for example) and modify OnDraw like this
void CNewView::OnDraw(CDC* pDC)
{
} Now overwrite these two methods:
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
if (!m_split.CreateStatic(GetParentOwner(), 1, 2))
AfxMessageBox("Failure on split creation!");
m_split.CreateView(0, 0, RUNTIME_CLASS(CNewView), CSize(0, 0), pContext);
m_split.CreateView(0, 1, RUNTIME_CLASS(CNewView), CSize(0, 0), pContext);
PostMessage(WM_SIZE);
return CMDIFrameWnd::OnCreateClient(lpcs, pContext);
}
void CMainFrame::OnSize(UINT nType, int cx, int cy)
{
CMDIFrameWnd::OnSize(nType, cx, cy);
m_split.SetWindowPos(&wndTop, 50, 50, 100, 100, SWP_SHOWWINDOW);
} where m_split is the CSplitterWnd member.
rechi
|
|
|
|
|
I find hard to compile my code.
I don't know the command such as bcc32 then....what else more...I don't know how to go about... Please help. Thanks!
From Aaron
|
|
|
|
|
[ Update - I figured it out...sorry i'm a moron ]
Sorry to confuse anyone who may have read my last message and now i've erased it, but I figured i'd try it make it more to the point...
I want to use a UINT as a series of 32 bit flags
* *
00000000 00000000 00000000 00000000
I have the following flags/masks defined
#define COLUMN7 0x0040L
#define COLUMN9 0x00FFL
Why does the following not work...?
UINT nFlags |= COLUMN7
nFlags |= COLUMN9
Why does nFlags yield FF(255) after the following...???
Doesn't FF require only a single bit...??? How would I accomplish setting both columns instead of just over writting all others...?
|= operator doesn't work like += or similar...???
Thanx
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
#define COLUMN9 0x00100L
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
0xFF or 255 has 8 low bits set, so everything works as advertised.
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
I want to create some file mapping with CreateFileMapping() API.My problem is that when a file is open by other procces it can not create mapping and return NULL handle for it.So how can I map shared files or how can I find out is open by other process?
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
Hi,
I have a data structure as followings. I need that insert some
data in order to make the data looks completely. In the data,
the x[0], x[1], x[2] and x[3] are timecode: represents hour, minutes, second and frame (here 1 second = 30 frames), respectively. The other important data is x[5], when you insert some new timecode with contimuous frame, the x[5] should also be inserted with a Linear insert method. The rest data should be same with others.
I found that it is slowly when the length of the data is large. So
is there a fast method for doing this ?
The data looks like this:
------------------------------------------------------------
x[0] x[1] x[2] x[3] x[4] x[5] x[6], ... x[13]
00 02 14 19 0 41 0 4 2 3 0 15 15 0
00 02 14 20 0 42 0 4 2 3 0 15 15 0
00 02 14 22 0 44 0 4 2 3 0 15 15 0
00 02 14 23 0 46 0 4 2 3 0 15 15 0
00 02 14 25 0 47 0 4 2 3 0 15 15 0
00 02 14 26 0 48 0 4 2 3 0 15 15 0
00 02 14 27 0 49 0 4 2 3 0 15 15 0
00 02 14 28 0 50 0 4 2 3 0 15 15 0
00 02 15 00 0 51 0 4 2 3 0 15 15 0
00 02 15 01 0 53 0 4 2 3 0 15 15 0
00 02 15 02 0 54 0 4 2 3 0 15 15 0
00 02 15 03 0 56 0 4 2 3 0 15 15 0
00 02 15 04 0 57 0 4 2 3 0 15 15 0
00 02 15 05 0 58 0 4 2 3 0 15 15 0
00 02 15 06 0 59 0 4 2 3 0 15 15 0
00 02 15 07 0 60 0 4 2 3 0 15 15 0
00 02 15 08 0 61 0 4 2 3 0 15 15 0
00 02 15 09 0 63 0 4 2 3 0 15 15 0
00 02 15 10 0 64 0 4 2 3 0 15 15 0
00 02 15 12 0 68 0 4 2 3 0 15 15 0
00 02 15 13 0 69 0 4 2 3 0 15 15 0
00 02 15 14 0 71 0 4 2 3 0 15 15 0
00 02 15 15 0 72 0 4 2 3 0 15 15 0
00 02 15 16 0 73 0 4 2 3 0 15 15 0
00 02 15 17 0 74 0 4 2 3 0 15 15 0
00 02 15 18 0 75 0 4 2 3 0 15 15 0
00 02 15 19 0 77 0 4 2 3 0 15 15 0
00 02 15 24 0 89 0 4 2 3 0 15 15 0
00 02 15 25 0 90 0 4 2 3 0 15 15 0
00 02 15 26 0 91 0 4 2 3 0 15 15 0
00 02 15 27 0 93 0 4 2 3 0 15 15 0
00 02 15 28 0 95 0 4 2 3 0 15 15 0
00 02 15 29 0 96 0 4 2 3 0 15 15 0
............
---------------------------------------------------
For example, for the first three raws:
it should be changed as follows:
00 02 14 19 0 41 0 4 2 3 0 15 15 0
00 02 14 20 0 42 0 4 2 3 0 15 15 0
00 02 14 21 0 43 0 4 2 3 0 15 15 0 ==> inserted line
00 02 14 22 0 44 0 4 2 3 0 15 15 0
=======================================
Thanks in advance!
|
|
|
|
|
If you have many data you could use a linked list structure.
If you want to use arrays, use memmove.
|
|
|
|
|
Thanks!
for example, how to do that?
chen
|
|
|
|
|
There are lots of implementation of linked lists, you could try STL containers, they are very fast if they are used in a good way. There must be examples & tutorials here at CodeProject.
You could also implement it yourself.
Basically it should look like this :
<br />
struct myList {<br />
long somedata;<br />
struct myList *next;<br />
};<br />
"640K ought to be enough for anybody."
Bill Gates
|
|
|
|
|
I am making a little program that recieves ascii commands from the serial port. I want to make the program play an audio file when it recieves a specific string. Does anyone know how to just play an audio file in the background without pulling up windows media player?
Thank you very much.
Mavrock
|
|
|
|
|
http://www.codeproject.com/audio/mp3player.asp[^]
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
u can try with "mciSendString" API function ...
anju
|
|
|
|
|
This should do:
HWND hWnd = MCIWndCreate(GetSafeHwnd(),
AfxGetInstanceHandle(),
MCIWNDF_NOMENU | MCIWNDF_NOPLAYBAR |
MCIWNDF_NOERRORDLG | MCIWNDF_NOOPEN,
szFilename);
MCIWndPlay(hWnd);
To stop playing:
MCIWndStop(hWnd);
MCIWndDestroy(hWnd);
|
|
|
|
|
Hello,
I'm working on WIA and trying to aquire image/audio/video from a digital camera. Everything looks fine like select the device and image. However, I still not problem tranfering file from the camera to the target machine. What I want is transfer the file from the camera to a file in the target, then I would like to get the file name from a STGMEDIUM and move to another location. According to MSDN, I set lpszFileName member of the pMedium structure to NULL to allow WIA to determine the file name and location for the new file. However, pIWiadataTransfer->idtGetData always returns STG_E_MEDIUMFULL and IWiaEventCallback::ImageEventCallback never be called. Do you know why? Thanks!
IWiaDevMgr* g_pIWiaDevMgr = NULL;
if (SUCCEEDED(CoCreateInstance(CLSID_WiaDevMgr, NULL, CLSCTX_LOCAL_SERVER,
IID_IWiaDevMgr, (void**)&g_pIWiaDevMgr)))
{
IWiaItem* pIWiaRootItem = NULL;
if (g_pIWiaDevMgr->SelectDeviceDlg(m_hWnd, StiDeviceTypeDefault, 0, NULL, &pIWiaRootItem) == S_OK)
{
LONG lItemCount = 0;
IWiaItem** ppWiaItem = NULL;
if (pIWiaRootItem->DeviceDlg(m_hWnd, 0, WIA_INTENT_NONE, &lItemCount, &ppWiaItem) == S_OK)
{
CWaiDataCallback* pWaiDataCallback = new CWaiDataCallback;
pWaiDataCallback->AddRef();
for (int i = 0; i < lItemCount; i++)
{
#if 0 // Do I have to setup some parameters for WriteMultiple?
IWiaPropertyStorage* pIWiaPropStg = NULL;
if (SUCCEEDED(ppWiaItem[i]->QueryInterface(IID_IWiaPropertyStorage, (void**)&pIWiaPropStg)))
{
PROPSPEC PropSpec;
PropSpec.ulKind = PRSPEC_PROPID;
PropSpec.propid = WIA_IPA_FORMAT;
PROPVARIANT PropVar;
PropVar.puuid = &WiaImgFmt_BMP;
pIWiaPropStg->WriteMultiple(1, &PropSpec, &PropVar, 2);
pIWiaPropStg->Release();
}
#endif
IWiaDataTransfer* pIWiadataTransfer = NULL;
if (SUCCEEDED(ppWiaItem[i]->QueryInterface(IID_IWiaDataTransfer, (void **)&pIWiadataTransfer)))
{
STGMEDIUM StgMedium = { 0 };
StgMedium.tymed = TYMED_FILE;
if (pIWiadataTransfer->idtGetData(&StgMedium, pWaiDataCallback) == S_OK) // *** Always return STG_E_MEDIUMFULL
{
pIWiadataTransfer->Release();
ReleaseStgMedium(&StgMedium);
}
}
ppWiaItem[i]->Release();
pWaiDataCallback->Release();
}
CoTaskMemFree(ppWiaItem);
}
pIWiaRootItem->Release();
}
g_pIWiaDevMgr->Release();
}
|
|
|
|
|
I dunno, but this months MSDN has a huge story on DirectShow to do exactly this, and it's available online at msdn.microsoft.com
It may be last months now, it's just come out in newsagents in Australia.
Christian
We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum )
Cats, and most other animals apart from mad cows can write fully functional vb code. - Simon Walton - 6-Aug-2002
|
|
|
|
|
I have emebedded a header control inside my main control but the header flickers madly despite having WS_CLIPCHILDREN specified in the main control. I have tried using SetRedraw() but that didn't work either...
These I figure are my options:
1) I owner draw the header control, but I'd really like to avoind this
2) I use InvalidateRect() somehow inside OnPaint handler of main control and invalidate the client rect - the header control height??? is this a possible solution...?
-----------------
| header control| <-- Ignore this part of client rect using InvalidateRect()...???
-----------------
| main control |
| |
| |
-----------------
Would this solve the header flicker problem...?
I've already double buffered the main control and handled OnEraseBkgnd() of main control properly
Ideas...?
Thanx!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
1 possibility springs to mind:
in both your OnPaint() and OnEraseBkgnd() handlers you call ExcludeClipRect() on the device context to clip out the header rect.
|
|
|
|
|
Throughout my code, after creating an application, I see comments in the header files such as:
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_XMAINWINDOW_H__CB25AA97_9522_4128_9EAE_946D14A1C1EB__INCLUDED_)
What purpose do they serve and I am required to keep them there? I'd prefer to remove them to keep my code as clean as possible for my own organization.
Thanks,
-Matt
|
|
|
|
|
There's an option when you start a new project...
"Would you like to generate source file comment?"
Yes, please
No, thank you
Selecting no generates a project without all the of the source code comments like you described...
|
|
|
|
|
Perhaps it's becuz i use learners edition, I can't afford the full package, but even when I select no comments I still get the comments mentioned by the original poster...
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
I think it only turns off the big comments like the stuff in InitDialog and InitInstance. The small stuff mentioned above is kept, especially the classwizard related stuff.
Michael
Time flies like an arrow. Fruit flies like a banana
|
|
|
|