|
That's just a char *, isn't it ? Use strcat, assuming you can't turn them into strings.
Christian
NO MATTER HOW MUCH BIG IS THE WORD SIZE ,THE DATA MUCT BE TRANSPORTED INTO THE CPU. - Vinod Sharma
Anonymous wrote:
OK. I read a c++ book. Or...a bit of it anyway. I'm sick of that evil looking console window.
I think you are a good candidate for Visual Basic. - Nemanja Trifunovic
|
|
|
|
|
Actually LPTSTR is an LPWSTR if UNICODE is defined, an LPSTR otherwise, so use _tcscat() ... assuming of course that the first LPTSTR points to a buffer large enough to hold the result.
...cmk
|
|
|
|
|
strcat will do the trick, even if youre using UNICODE
|
|
|
|
|
Ernesto D. wrote:
even if youre using UNICODE
No it won't. First of all, an LPTSTR is a wchar_t* is you've compiled for UNICODE, and strcat is prototyped for char * strings. Second, and more importantly, even if you type-cast away the compiler warnings, strcat still won't work. In a UNICODE string, characters are two bytes. If either the upper or lower byte of the character in a UNICODE string is zero, the strcat will terminate early. The terminator for a wchar_t string is 0x0000 (a word, not just a byte). Therefore, you should use _tcscat(...) .
Software Zen: delete this;
|
|
|
|
|
Hi!
Please, help me to resolve a simple problem. I can't catch OnClose() notification in the CSocket-derived class. What's wrong? However, OnSend() and OnReceive() work fine.
Maybe, Does anybody know useful trick?
/////////////////////////////////////////////////////////////////////////////
// CNetClientSock command target
class CNetClientSock : public CSocket
{
// Attributes
public:
// Operations
public:
CNetClientSock();
virtual ~CNetClientSock();
// Overrides
public:
CWinThread* m_pThread;
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CNetClientSock)
public:
virtual void OnClose(int nErrorCode);
virtual void OnSend(int nErrorCode);
virtual void OnReceive(int nErrorCode);
//}}AFX_VIRTUAL
// Generated message map functions
//{{AFX_MSG(CNetClientSock)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_MSG
// Implementation
protected:
};
void CNetClientSock::OnClose(int nErrorCode)
{
// TODO: Add your specialized code here and/or call the base class
m_pThread->PostThreadMessage(WM_QUIT,0,0);
CSocket::OnClose(nErrorCode);
}
Yours sincerely,
Alex Bash
|
|
|
|
|
I want to import a function from vb dll in VC. Is it possible? How should I import it?
|
|
|
|
|
Hi!, im not shure about this but, you could try loading it with LoadLibrary() and use it with GetProcAddress(), (check out the documentation for this functions on MSDN)
HTH
|
|
|
|
|
Is it a regular DLL or an ActiveX/COM dll.
If it is an ActiveX dll, you can use #import
Michael
'War is at best barbarism...Its glory is all moonshine. It is only those who have neither fired a shot nor heard the shrieks and groans of the wounded who cry aloud for blood, more vengeance, more desolation. War is hell.' - General William Sherman, 1879
|
|
|
|
|
I am using CListCtrl. I want to display yhe icon along with the item I have done it in following way But it is not displaying the image What could be the problem?
HICON hIcon;
CImageList m_imageList;
m_imageList.Create(16, 16, 0, 1, 1);
hIcon = AfxGetApp()->LoadIcon(IDI_ICON1);
m_imageList.Add(hIcon);
pList->SetImageList(&m_imageList, LVSIL_SMALL);
pList->InsertItem( 0, "RED", 0 );
|
|
|
|
|
Perhaps the icon is not a 16x16 icon? Try using a 16x16 bitmap resource instead.
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
I have made a struct as shown below, and I want to create an array of this struct
struct PASSACCOUNT {
CString sGroupName;
CString sAccountName;
CString sUsername;
CString sPassphrase;
CString sAccountNotes;
CString sUrl;
CTime ctCreationDate;
CTime ctExpiresDate;
CTime ctModifiedDate;
};
When I attempt to declare it: CArray<PASSACCOUNT,PASSACCOUNT> pg; I get the error:
error C2059: syntax error : '<'
Is it possible to create an array of a struct this way? Is there an alternative way, if not?
Thanks.
|
|
|
|
|
A struct is just a class with default access of public, so there's no reason for this not to work. CArray does no sorting, so it can't need operator <, therefore the problem is probably with the code that I can't see because you didn't tick 'show this message as is' below. My suspicion is that your CArray can't see the definition of the struct.
CArray is, in any case, crap. You should use std::vector by preference and CArray only if you have a compelling reason to ( I can't imagine what that would be ).
Christian
NO MATTER HOW MUCH BIG IS THE WORD SIZE ,THE DATA MUCT BE TRANSPORTED INTO THE CPU. - Vinod Sharma
Anonymous wrote:
OK. I read a c++ book. Or...a bit of it anyway. I'm sick of that evil looking console window.
I think you are a good candidate for Visual Basic. - Nemanja Trifunovic
|
|
|
|
|
I don't see any reason why it would not be able to see the struct, it is defined in the right place... I did check show as is That's the entire error message, and the entire line of code.
Okay, I just tried doing a CArray with CString, and then with int, and I get the same error... I don't know what's going on here. There must be some other problem.
|
|
|
|
|
Dan Savilonis wrote:
I did check show as is
Maybe later, the < > was not there when I first read the post
Anyhow, I think the second parameter may need to be a pointer to the object, or a reference. I forget, like I said, CArray is crap and I don't use it.
Christian
NO MATTER HOW MUCH BIG IS THE WORD SIZE ,THE DATA MUCT BE TRANSPORTED INTO THE CPU. - Vinod Sharma
Anonymous wrote:
OK. I read a c++ book. Or...a bit of it anyway. I'm sick of that evil looking console window.
I think you are a good candidate for Visual Basic. - Nemanja Trifunovic
|
|
|
|
|
Problems of this kind usually are usually caused by the line of code immediately above the one highlighted. I copied your code as shown, and it compiled fine for me, so my suspect is the code above the CArray line.
I sometimes experience similar problems when the compiler cannot find the CArray definition. In those case, I just include "afxtempl.h" in the header.
btw Parameter passing in your array won't be efficient because you are passing by value rather than by reference/pointer.
|
|
|
|
|
I think you're right on about that...
I didn't actually try your suggestion because I already coverted to vectors. However, when I initially tried vector<>, I found that I had the same exact error if I did not explicitly say std::vector<arg>.
|
|
|
|
|
CArray may be crap, but some of us have no choice, due to history and company policy, i.e. "Everyone else uses CArray, so you should too. After all, we include all the MS dlls with the installation"
In any case, you can only learn how crap CArray is by actually using it.
|
|
|
|
|
I am using CListCtrl . I want to select complete row in clistctrl. how should I do it?
|
|
|
|
|
HWND hWnd = myListCtrl.GetSafeHwnd();
ASSERT (hWnd != NULL);
DWORD dwStyle = ListView_GetExtendedListViewStyle (hWnd);
dwStyle |= LVS_EX_FULLROWSELECT;
ListView_SetExtendedListViewStyle (hWnd, dwStyle);
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
After the control is created, (like inside initdialog) call this:
m_MyListCtrl.SetExtendedStyle(LVS_EX_FULLROWSELECT);
HTH
|
|
|
|
|
Who can tell me how to solve this problem?
How to realize a Sequential-Verify test on floppy disk in VC?
Thank you!
LeonOrient
|
|
|
|
|
In MDI program , five documents have beed opened , Now the current document is fifth , How do I change the current document is first or else , of course I mean that I use program to do it ,not mouse . in a word ,I want to realize the WINDOW menu function.
Thank you !
|
|
|
|
|
You need to call MDIActive() on the view of the document you want to be active. If your in doc5, you can get a pointer to doc1 through the CDocTemplate object
CDocTemplate *pTemplate = GetDocTemplate();
iterate it to get the correct document pointer using GetFirstDocPosition() and GetNextDoc(). From there you can use the GetFirstViewPosition() and GetNextView() to get the view for the document you want to active. If you use GetParent() on this and cast it to a CChildFrm object I think you can call MDIActivate on that.
This is all from memory, so some or all of the steps may be slightly incorrect.
Hope its of help.
Roger Allen
Sonork 100.10016
Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
|
|
|
|
|
|
I created an ActiveX control including a property sheet in it.
in the method COleControl::OnCreate()
I create a property sheet with 3 pages as child and show it.The property sheet is not wizard-mode.
When I use the control in a modal dialog,the dialog cannot DoModal() and the control is dead.When in a modaless dialog,the control displays right ,but if I use a method of the control ,it is dead again!
why???
|
|
|
|