|
Hi,
I would like to know if I can I add a CButton to a CScrollView?
If so, how can I do it or is there some sample.
Regards,
Magnus
|
|
|
|
|
Doubtful, but you can add one to a CFormView , which is derived from CScrollView .
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Great!
A CFormView was just what I needed!
Thanks,
Magnus
|
|
|
|
|
hi all,
i am getting this error
error LNK2001: unresolved external symbol "public: __thiscall CMyCrypto::~CMyCrypto(void)" (??1CMyCrypto@@QAE@XZ)
<br />
<br />
class CMyCrypto {<br />
...<br />
CMyCrypto(LPTSTR lpPassword, ALG_ID algorithm);<br />
~CMyCrypto();<br />
<br />
BOOL Encrypt(LPBYTE pData, LPDWORD pdwDataSize, <br />
DWORD dwBufferSize, BOOL bFinal);<br />
BOOL Decrypt(LPBYTE pData, LPDWORD dwDataSize,<br />
BOOL bFinal);<br />
<br />
...
why is this error?
thank you
mani kanth
|
|
|
|
|
~CMyCrypto(); This line declares, not does not define, the destructor of CMyCrypto . If this class is yours (i.e. you have written it) than you'll have to supply the destructor. Possibly a do-nothing destructor will do:
class CMyCrypto {
...
~CMyCrypto()
{
}
Hope this helps.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I want to display the % completed on top of my progress bar.
I was looking around on here and found what seems to be the perfect solution:
http://www.codeproject.com/miscctrl/text_progressctrl.asp
HOWEVER:
That was last updated in VC++ 6.
I'm using VC++ 7 (aka VC++ .NET), and it won't compile it.
There's something wrong with the message map handlers (in that thier typing is incorrect somehow) but I can't figure out for the life of me how to fix it.
I have a fair ammount of C/C++ experience but only 2 weeks of Visual C++ and MFC experience (!) so I'm not entirely sure on all the Microsoft defined types etc.
The other thing that's throwing me is that these are (possibly) scope errors, and so far as I can see the function definitions and declarations are in scope.
Here's an example of what I'm getting:
<br />
c:\Documents and Settings\xxxxxx\Desktop\progress temp\TextProgressCtrl.cpp(158) : error C2440: 'static_cast' : cannot convert from 'LRESULT (__thiscall CTextProgressCtrl::* )(WPARAM,LPTSTR)' to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)'<br />
None of the functions with this name in scope match the target type<br />
That is generated from the following member function/function call.
PLEASE NOTE THAT THE FUNCTION IS DECLARED PRIVATE! But this shouldn't matter because the message map is in the .cpp which is within scope of private for that class, right?
Message map (in .cpp)
ON_MESSAGE(WM_GETTEXT, OnGetText)
Definition (in .cpp)
LRESULT CTextProgressCtrl::OnGetText(WPARAM cchTextMax, LPTSTR szText)<br />
{<br />
if (!_tcsncpy(szText, m_strText, cchTextMax))<br />
return 0;<br />
else <br />
return min(cchTextMax, (UINT) m_strText.GetLength());<br />
}<br />
Declaration (in .h)
afx_msg LRESULT OnGetText(WPARAM cchTextMax, LPTSTR szText);<br />
Any help very much appreciated.
|
|
|
|
|
I think the problem is due to stricter type checking in .NET version of MFC: the message handlers must have the right signature, which is not the case for CTextProgressCtrl::OnSetText and CTextProgressCtrl::OnGetText . I've made the following changes and things seem to work:
...
afx_msg LRESULT OnSetText(WPARAM, LPARAM);
afx_msg LRESULT OnGetText(WPARAM, LPARAM);
...
LRESULT CTextProgressCtrl::OnSetText(WPARAM, LPARAM lParam)
{
LPCTSTR szText=(LPCTSTR)lParam;
LRESULT result = Default();
if ( (!szText && m_strText.GetLength()) ||
(szText && (m_strText != szText)) )
{
m_strText = szText;
Invalidate();
}
return result;
}
LRESULT CTextProgressCtrl::OnGetText(WPARAM cchTextMax, LPARAM lParam)
{
LPTSTR szText=(LPTSTR)lParam;
if (!_tcsncpy(szText, m_strText, cchTextMax))
return 0;
else
return min(cchTextMax, (UINT) m_strText.GetLength());
} Hope this helps.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanks for your reply, I'll definately give that a go.
I came up with my own solution in the end but it's rather dirty and doesn't catch certain events (like the window going being brought to the foreground from behind another window). I was just painting the text onto the progress bar when I needed to update it and in the onpaint function, using a combination of clipping areas and DrawText.
|
|
|
|
|
Hi all,
I am trying to reterive the OCX properties such as string name,index value through HWND of third party applications.Could any one please help me to solve this issue.
Thanks,
Mohan
mohan@tek.com
|
|
|
|
|
when i want to import library - do i have to write all the path?
the reason i asked this question is because i use the
WSALookupserviceBegin() function,so i included the "winsock2.h"
and in Project->Settings->Link tab i added this path:
C:\Program Files\Microsoft Visual Studio\VC98\Lib\Ws2_32.Lib
but i get this message:
LINK : fatal error LNK1181: cannot open input file 'C:\Program.obj'
also,i forgot to say that i'm developing in embedded visual c++,
but it's not working on visual c++ too.
thanks again,eli.
|
|
|
|
|
No, you only need to write the lib file name. Alternativley you can also try following line after #include.
#pragma comment(lib, "Ws2_32.lib.lib")
I have only tried this on VC++, not embedded one.
Arsalan Malik
|
|
|
|
|
Thanks,i will try this...
|
|
|
|
|
I’m successfully manage to run the zipprogram gzip.exe programaticly like this:
<br />
ShellExecute( NULL, "open", "C:\\gzip.exe", strParam, "C:\\Program Files\\Ceco", NULL ) ) )<br />
How do I after this call wait until gzip.exe has returned. (The file that gzip.exe creates do I want to rename.)
_____________________________
...and justice for all
APe
|
|
|
|
|
I would recommend a read of
http://www.codeproject.com/system/newbiespawn.asp
But it would be something like
(Code Taken from the article above)
SHELLEXECUTEINFO ShExecInfo = {0};
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
ShExecInfo.hwnd = NULL;
ShExecInfo.lpVerb = NULL;
ShExecInfo.lpFile = "c:\\MyProgram.exe";
ShExecInfo.lpParameters = "";
ShExecInfo.lpDirectory = NULL;
ShExecInfo.nShow = SW_SHOW;
ShExecInfo.hInstApp = NULL;
ShellExecuteEx(&ShExecInfo);
WaitForSingleObject(ShExecInfo.hProcess,INFINITE);
Regards
Darren
|
|
|
|
|
Another good article is
http://www.codeproject.com/threads/asyncprocnotify.asp
Hope it helps
Darren
|
|
|
|
|
I want to know if I push down the POWER key and my program want to know this message what should I do?
|
|
|
|
|
Depending on what that key is configured to do, you may not get notified at all. On my computers, the power key is always reconfigured to be 'off' rather than the default setting of 'standby' or 'hibnernate'. Therefore, when I press that button, the computer goes off, period.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
|
__try
{
int i=0;
}
__finally
{
}
OK;
__try
{
CFile file;
}
__finally
{
}
Error:Cannot use __try in functions that require object unwinding
|
|
|
|
|
There are nasty interactions between SEH and C++ destructors. Martin Ziacek's article SEH and C++ Exceptions - catch all in one[^] explains how to catch SEH with regular try and catch , which is IMHO the way to go.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
|
hi,
i'm trying to set up BlueTooth communication between 2 devices,
but i need to use "Ws2_32.lib" file and i don't know how to do it.
can someone help me?
thanks,eli
|
|
|
|
|
Go to Project->Settings. Under Link tab, add "ws2_32.lib" in Object/Library modules field. Include appropriate header file, in this I think it is "winsock2.h".
Arsalan Malik
|
|
|
|
|
first,thanks for the quick answer.
do i have do write all the path?
the reason i asked this question is because i use the
WSALookupserviceBegin() function,so i included the "winsock2.h"
and in Project->Settings->Link tab i added this path:
C:\Program Files\Microsoft Visual Studio\VC98\Lib\Ws2_32.Lib
but i get this message:
LINK : fatal error LNK1181: cannot open input file 'C:\Program.obj'
also,i forgot to say that i'm developing in embedded visual c++,
but it's not working on visual c++ too.
thanks again,eli.
|
|
|
|
|
hi
i know how i can create several fonts in c++, but i dont know how to get the seperate coordinates. I want to know how many pixel the seperate letters have, and where they are...
i know that my english is not the best, but i hope you understand me ,-)
is there a class which contains all windows fonts?
thanks for help
|
|
|
|