|
Probably something like:
struct A
{
struct
{
int a;
int b;
} embedded_struct;
int c;
};
embedded_struct is a data member of A with struct type.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hello,
ANy one can guide me with the difference between SetCapture and GetCapture or articles on the same.
thanks
Pritha
|
|
|
|
|
I don't understand why you are confused between the two.
I'm sure you understand what Set and Get means.
The only similarity is in the return value which is the previous or current window that has captured the mouse.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Hello,
Thanks for your reply
BUt I was confused b coz of my problem that I mentioned in my next q . So I wanted to read good articles on SetCapture
|
|
|
|
|
Hi,
I am totally new to WinAPI programming. My requirement is to extract the handler to the current window when the user clicks over it or uses Alt+Tab to navigate to the window. The definition of GetCapture should return a handler to the window that has captured the mouse.
My question is when and how can I call the GetCapture() function? My requirement is to invoke the function whenever a mouse or keyboard event occurs. Can you please guide me how my program can be alerted to a click or keyboard event.
Thanks
-Varun.
|
|
|
|
|
Hello,
I have a child window derived from CMDIChildWnd and the window has a few CRichEditCtrl derived windows displayed properly on them.
But I am confused how to write the mouse capture for this window.
When the mouse moves over the window or left button is pressed on the window the mouse click message is not handled but if I press left mouse button over te minimize,maximize icons of the windows the messsage is andled and OnSize()function is called.
Why the OnLButtonDown()message not handled in the class which is derived from CMDIChildWnd?
Pritha
|
|
|
|
|
I need an algorithm or C program by which I can compute the Strict Avalanche criterion of the nonlinear boolean functions
|
|
|
|
|
|
correlation immunity is an important criterion for boolean functions, I need an algorithm or C program to compute the correlation immunity for any boolean function.
|
|
|
|
|
alaaomar wrote: I need an algorithm or C program...
That's nice for you. Do you think you'll get one?
There are three kinds of people in the world - those who can count and those who can't...
|
|
|
|
|
This [^] may help.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Wow! What are the odds that two people with the same name would be asking the same question?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I am creating an MFC based MDI type app in VS2008. I have a class structure that is mostly based on declaring objects of the lower class in the class above it - so not subclasses - but called from parents as such:
CHostApp ------------> CCommandParser
CMainFrame
COutputWnd (console type display class that I want to call a function in)
So in CMainFrame it does:
COutputWnd m_OutputWnd
and so on up the chain.
I am making a command parser class that I'm thinking really should be a static class from the at the CHostApp level. Ultimately I'm trying to call a function and pass data from
CCommandParser to COutputWnd.
What's the right syntax or methodology to do this? Do I need to make one a friend class of the other?
|
|
|
|
|
You could try the same trick done by ATL.
Make the CMainFrame class a template class.
Pass the class derived from CMainFrame as the template parameter to CMainFrame.
Something like this.
class COutputWnd : public CMainFrame<COutputWnd>
{
};
template<typename T>
class CMainFrame : public CFrameWnd
{
T m_OutputWnd;
};
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
|
Never seen that before! I have used it for years I believe in creational patterns like factory. I'd have to go scare up some old code to verify that but I'm pretty sure.
|
|
|
|
|
Hi
I have written a downloader program that can download files from internet (with resume support).
But after I pass the file address and username and password of my account in rapidshare it can not download it, it just download a html file:
m_pHttpConnection = m_InternetSession.GetHttpConnection(sServer, nPort, sUser, sPassword);
also this function returns FALSE :
file.SendRequest(NULL);
Does anybody know how to pass username and password to rapisdhare or other sharing web sites?
Regards
Hadi
www.logicsims.ir
|
|
|
|
|
IIRC, the GetHttpConnection call lets you do URL authentication[^]. I suspect sites like rapidshare use something like basic authentication, as illustrated by this page[^], where username and password are passed in request headers.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thank you for your answer,
I read those article, semms to be good, I changed my code for this way, but it did not work.
It just downloads a HTML file! not the file itself!
Do you have any other idea, is there any help in rapidshare for this? I searched a lot but did not find anything helpful!
Thanks
www.logicsims.ir
|
|
|
|
|
Try monitoring the HTTP transactions using Fiddler[^] - it's a splendid debugging tool when doing low-level HTTP stuff.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
A popup menu has been created that displays a list of options for insertion into a Item>SubItem cell. The menu comes up fine, but the return value is either 0 or 1, despite the flag being set to return the menu item. It was used in a dialog only previously, and think that the hWnd is the culprit on returning the wrong item number.
Any suggestions?
Many thanks in advance.
<code>void CTab2::OnRclickListCtrl(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
int i, nItem, nSubItem, nSel;
CString s;
POINT point;
HMENU hMenu = ::CreatePopupMenu();
CRect rect;
LPNMITEMACTIVATE temp = (LPNMITEMACTIVATE) pNMHDR;
nItem = temp->iItem;
nSubItem = temp->iSubItem;
if( nSubItem == -1 || nItem == -1 ) return ;
if (NULL != hMenu && nSubItem == 2 && nItem < lLayer ) {
for ( i = 0; i < lBulkMax; i++ ) {
::AppendMenu ( hMenu, MF_STRING, 1, sBulk[i].desc );
}
point.x = 200; point.y = 200;
ClientToScreen(&point);
nSel = ::TrackPopupMenuEx(hMenu,
TPM_LEFTALIGN | TPM_RETURNCMD | TPM_LEFTBUTTON,
point.x,
point.y,
temp->hdr.hwndFrom,
NULL);
::DestroyMenu(hMenu);
s.Format ("item selected is number %d", nSel);
AfxMessageBox ( s );
if ( nSel > 0 && nSel <= lBulkMax ) {
m_cListCtrl.SetItemText( nItem, nSubItem, sBulk[ nSel - 1 ].desc );
}
}
/*
typedef struct tagNMHDR
{
HWND hwndFrom;
UINT idFrom;
UINT code; // NM_ code
} NMHDR;
typedef NMHDR FAR * LPNMHDR;
*/
*pResult = 0;
}
|
|
|
|
|
The third parameter to AppendMenu in your loop is 1. This gives all the mnu options this ID. If you cancel the menu you will get 0 returned, any option you select will return 1. You need to add each item to the menu with a different id number.
Try changing it to i+1
If you vote me down, my score will only get lower
|
|
|
|
|
Thanks. A single append line was clipped from another program that had hard-coded ids, and neglected to change it to a loop based id.
|
|
|
|
|
Hello
I am working on VS2003 and using the above mentioned functions, but the compiler gives me warning saying those functions are #pragma depreciated.
I know VS2008 has functions like sprintf_s, but unfortunately i will not be able to upgrade to 2008.
So now i want to use a wrapper function around sprintf, which will do the additional work that sprintf_s will do and there by making sure that i call sprintf only once.
This new wrapper function should be able to check for buffer over run and then i will call sprintf inside this function.
What it will do is, it will make sure that, i only need to call sprintf once and that will bring down compiler warning to just one.
Is anyone aware of such a wrapper function? Or can anyone help write a wrapper?
Thanks in advance.
|
|
|
|
|
Hi,
here are some thoughts and pointers:
1. for a very long time there have been some string functions that limit the number of bytes written to a buffer. Depending on vendor and compiler they got different names, most often things such as snprintf, strncat, strncpy, ... You really don't need VS2008 to get some of those. The main problem is the names and signatures have not been standardized successfully,
so choose one and locate it or implement it.
2.
snprintf-like stuff from Microsoft:
http://msdn.microsoft.com/en-us/library/2ts7cx93(VS.71).aspx[^]
http://msdn.microsoft.com/en-us/library/ms647541(VS.85).aspx[^]
3.
one needs the "variable arguments" technology to wrap something that takes a variable number of arguments. However accepting and passing on a list of arguments is a bit tricky, there is a special vsnprintf function[^] for that purpose.
As well as this one[^].
4.
if not found, strncpy and strncat can be written from scratch easily, at least when there is no need for maximum performance. They basically are just a loop copying one byte at a time. (Strcat needs to find the end of the current content first, either use another loop or strlen).
5.
the main problem is all these safe functions need the size of the destination buffer, which can be handled in two ways:
(a) when the only purpose is to avoid compiler warnings (sprintf, strcpy, ... being deprecated now), just pass a very large number (or implement the convention that zero means infinite)
(b) look in the source code (where sprintf used to be) for the buffer size, and pass that.
Either way, the source code needs to be changed at every location where the safe version has to be used instead of the unsafe version.
6.
possible extra safety: the safe function could implement a simple check on the destination pointer; in my experience it is useful to reject any address in the range [0, 1023] since that typically is what you get when a class/struct pointer is zero. You could use an assert to report a problem, and/or return null.
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
modified on Saturday, June 20, 2009 2:55 PM
|
|
|
|