|
1: This is not Rent-A-Coder.
2: Even if it was, I see no cash offering for doing work for you.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
It seems to be your homework. Do you homework and learn programming.
Greetings from Germany
|
|
|
|
|
Simple programmer wrote: You may refer to page 2 and 3...
I don't have this book (must've been absent that day). Can you send it to me?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
It was better you asking about your problem not write a program that...
|
|
|
|
|
for example n=4.
i would get 6 combination out of 4.[1,2][1,3][1,4][2,3][2,4][3,4]
how do i display out those combination?
|
|
|
|
|
Simple programmer wrote: how do i display out those combination?
printf ? std::cout ? CWnd::SetWindowText ? CDC::TextOut ?
or are you thinking about how to compute the combinations ?
|
|
|
|
|
Can you explain your problem properly?
Steve
|
|
|
|
|
i am using the microsoft directX 9.0 for my video capture. Now my problem is i want to detect single face on the webcam (suppose using square size line) and i dont know how to program it in visual C++. Anyone can help me or tell me about related sources~ Thank you very much and God bless...
love-peace-joy
|
|
|
|
|
It will be very difficult to detect a face on the webcam, perhaps it would be better for you to detect movement instead.
|
|
|
|
|
I am working on Dialog based application using MFC in VC++.
In that i have handled Row change message of Grid (GRID_WMUSER_ROWCHANGE) its user defined message and I have written handler :
for example
**CDlg.cpp**
ON_MESSAGE( GRID_WMUSER_ROWCHANGE, fun)
void Cdlg::fun(int n)
{
MessageBox(.....
}
**Cdlg.h**
void fun(int n=0)
now in the Debug build of the Program this works fine. But when i run the application in the Release build the Program crashes as soon as row change of event of Grid occurs.
Now if I correct the above code as
**CDlg.cpp**
ON_MESSAGE( GRID_WMUSER_ROWCHANGE, OnRowChangeGrdLoad)
void Cdlg::fun(int n)
{
MessageBox(.....
}
LRESULT CDlg2701::OnRowChangeGrdLoad( WPARAM wParam, LPARAM lParam )
{
fun();
}
**Cdlg.h file**
afx_msg LRESULT OnRowChangeGrdLoad( WPARAM wParam, LPARAM lParam );
After doing this my application works fine in both Debug and Release build.
I want to know what is the reason behind this?? why such difference in Debug and Release build ??
|
|
|
|
|
|
FWIW, I love the "Ask a friend" link...
The easter egg section also has some interesting content.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
If you are too lazy to even write your own name into account, then I ( and I am sure many others ) will not even bother to read your posts. PLEASE FIX IT!!!
|
|
|
|
|
wrote: I want to know what is the reason behind this?? why such difference in Debug and Release build ??
Stack corruption causes the crash. The correct signature of a message handler, the function takes a WPARAM and an LPARAM (which are pushed onto the stack when the function is called) and returns an LRESULT (which is popped from the stack when the function returns). In the incorrect version of your code, the fun() function is being called as if it had this signature, even though the fun() function does not, and as a result there is stack corruption.
The fact that it works in debug mode is a coincidence, possibly due to padding added by the compiler in debug compilations.
Incidentally, are you still using VC 6.0? The error in signatures for message handlers is flagged as a compiler error in newer versions of Visual Studio.
Mike
|
|
|
|
|
Hi,
I do not really understand the intricacies of MFC messages , especially with Dialog boxes and their controls.
Could you please explain me what does not work with the following example?
I use a Dialog box containing a ListCtrl control.
I derived MYDlgClass class from CDialog.
At first I overloaded OnLButtonDown function because I would like to intercept Mouse events from within the ListCtrl.
I realized that mouse events are captured only when the mouse is outside the controls.
Then I tried to derive a new Class from CListCtrl. Before doing so I removed OnLButtonDown from MYDlgClass.
The first issue is that no ClistCtrl class was available for derivation therefore I derived from CDialog and mofified code within the new class that I Call MyListCtrl.
Finally I overloaded OnLButtonDown but the message is not captured.
Please could you tell me what should I do?
Many thanks for your help.
|
|
|
|
|
Arris7 wrote: I realized that mouse events are captured only when the mouse is outside the controls
You need to see OnNotify handler of parent(dilaog in this case) class.
Arris7 wrote: The first issue is that no ClistCtrl class was available for derivation
What ? Strange !
Which version of VS you are using ?
|
|
|
|
|
What ? Strange !
Which version of VS you are using ?
I use VS2003. Actually When I right click the ListCtrl control and I select Add Class, There are only 3 or classes available ( CDialog, Cpropertypage etc..) but no CListCtrl.
|
|
|
|
|
Use class view to add class, instead.
|
|
|
|
|
That's ok. I've got the solution.
thanks anyway.
|
|
|
|
|
You have derived from CDialog, but the trouble is mouse messages are sent to the controls ( your list control ) not the dialog itself. You need to derive a class from the list control and handle the messages from there.
Another way you could handle this is checking the message paramater of the MSG struct after each call to GetMessage(). Though I'm not exactly sure how you adjust the message loop in MFC.
|
|
|
|
|
You have derived from CDialog, but the trouble is mouse messages are sent to the controls
Actually, the messages are correctly routed to the CDialog. But when the mouse is within the control, I do not know where the messages are routed.
You need to derive a class from the list control and handle the messages from there
I derived a class from CListCtrl but no messages are routed to this class.
Though I'm not exactly sure how you adjust the message loop in MFC.
What is the procedure to do this? What is entry point in VC++ to setup this?
|
|
|
|
|
Hi..
I am having trouble passing a string of a file name (from VB to my c++ DLL)
the function StgOpenStorage requires a "const WCHAR*" for the filename. so what type should i pass to it. I would prefer to pass a VB string and let the DLL do the relevant transulation of types (i don't want to use strPtr(filename) in VB
many thanks
sample code
//-------------------------------------------------------------
SSFILEDLL_API bool __stdcall OpenEmail(fileName)
{
if (bIsopen == false)
{
HRESULT hr;
hr = MAPIInitialize(NULL);
if (FAILED(hr))
return false;
hr = OleInitialize(NULL);
if (FAILED(hr))
return false;
//get storage from msg file
//here is the bit where the filename is used
//hr = StgOpenStorage(L"C:\\Email.msg" works but i want to pass it from vb
hr = StgOpenStorage(filename ,
NULL,
STGM_READWRITE | STGM_TRANSACTED | STGM_SHARE_EXCLUSIVE,
NULL,
0,
&pStorage);
if (FAILED(hr))
return false;
//open a IMessage session
hr = OpenIMsgSession (pMalloc, 0 , &pMsgSession);
if (FAILED(hr))
return false;
//open an IMessage on the IStorage object
hr = OpenIMsgOnIStg(pMsgSession,
MAPIAllocateBuffer,
MAPIAllocateMore,
MAPIFreeBuffer,
pMalloc,
NULL,
pStorage,
NULL,
0,0,&pSourceMsg);
if (FAILED(hr))
{
return false;
}
else
{
bIsopen = true;
return true;
}
}
else
{
return false;
}
}
|
|
|
|
|
read the posting guidelines[^], especially when you post huge code blocks.
Calvin Streeting wrote: Pass a sting
wow, that'll be hard
|
|
|
|
|
I was under the impression that VB strings were wide/Unicode by default, and would be in the form of a BSTR (BSTR == B ASIC Str ing, IIRC), which is already a wide string.
You can pass a BSTR in place of a const wchar_t* or const WCHAR* just fine. As far as how to get that BSTR directly to the function in the DLL, I cannot help you there - I do not do VB, nor am I 100% certain that the internal format of the BSTR is exactly the same as its external/COM format.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
I thought so but if I...
SSFILEDLL_API bool __stdcall OpenEmail(BSTR FileName)
then the StgOpenStorage fails but if i hard code in the filename L"c:\\email.msg" it works...
am i missing some thing
|
|
|
|