|
I suspect there is some SQL command for this but it's nothing to do with C++; try asking your question in the Database forum.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
|
Hi,
can someone please have a look at this:
http://social.msdn.microsoft.com/Forums/en/vcgeneral/thread/01187549-46ce-4d9a-bd08-e1b478daf7ed
I am a little desperate on that issue, because i dont know how to pass the interface to the function.
On Vista+ it is the "CreateVssBackupComponentsInternal" in vssapi.dll
On XP it is the "?CreateVssBackupComponents@@YGJPAPAVIVssBackupComponents@@@Z" in vssapi.dll
Both expect a IVSSBackupComponents Interface, but with different guids (microsoft changed the interface from XP to vista, so they are incompatible) and slightly different implementation, which of course made the interface mutually exclusive on the platforms. As long as i use the implementation with the known guid from the headers on vista, seven and eight, all is perfectly fine, but the function call on the XP system does not accept my interface and says that the IID
"{A4B0621E-CA3F-34A1-AD56-E9C4A2F56E8D}" does not support the interface (HRESULT: 0x80004002 (E_NOINTERFACE)). So i cant use the implementation with the "665C1D5F-C218-414D-A05D-7FEF5F9D5C86" on the XP function on the vssapi.dll
The definitions can be found in the Volume Shadow Copy Service SDK 7.2 here:
http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=23490[^]
Thanks in advance
K.
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
Visit: http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."
|
|
|
|
|
I'm a beginner with VC++. I tried to do program to communicate with COM port of PC but I failed to use the MSComm lib. After that, I changed to use the "Serial library for VC++" which was written by Ramon de Klein but now I had an error I dont know how to solve.
The following sentence is the error:
"{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0 Arial;}}
{\*\generator Msftedit 5.41.15.1512;}\viewkind4\uc1\pard\f0\fs20 H:\\Program Files\\Microsoft Visual Studio\\MyProjects\\TestXbee\\TestXbeeDlg.cpp(130) : error C2664: 'Open' : cannot convert parameter 2 from 'class CTestXbeeDlg *const ' to 'unsigned long'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
}"
Now is the part of my program which informed about that error
"CString m_strComPort;
m_strComPort.Format(TEXT("COM2"));
CSerial port;
if (port.Open(m_strComPort,this) != ERROR_SUCCESS
{
AfxMessageBox(TEXT("Unable to open COM"),MB_ICONSTOP | MB_OK);
GetParent()->PostMessage(WM_CLOSE);
return 0;"
Thank you very much
|
|
|
|
|
I believe the second parameter to the Open function is a window handle.
You're trying to pass it a CWnd* .
Try this - port.Open(m_strComPort, m_hWnd);
|
|
|
|
|
It doesnt work.
|
|
|
|
|
Please make your posts readable by putting code extracts within <pre> tags, indenting the code and removing unnecessary control or meta characters. Something like the following:
This uses <pre lang="c++"></pre>
CString m_strComPort;
m_strComPort.Format(TEXT("COM2"));
CSerial port;
if (port.Open(m_strComPort,this) != ERROR_SUCCESS
{
AfxMessageBox(TEXT("Unable to open COM"),MB_ICONSTOP | MB_OK);
GetParent()->PostMessage(WM_CLOSE);
return 0;
}
This uses <pre lang="text"></pre>
H:\\Program Files\\Microsoft Visual Studio\\MyProjects\\TestXbee\\TestXbeeDlg.cpp(130) : error C2664: 'Open' : cannot convert parameter 2 from 'class CTestXbeeDlg *const ' to 'unsigned long'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
As to your error message, the Open() function requires some value which is an unsigned long not a pointer to your enclosing class. You should check the documentation for the Open() function for specific details.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
So give the Open() func the correct parameter.
I havent a clue what it is, Ramions API doesnt have a second param, other APIs have baudrate, so look at the documentation.
==============================
Nothing to say.
|
|
|
|
|
How to use that library if it is so bad documented?
We do alot of serial programing. At the end it pays 10x using a good commercial library with technical support. We successfuly replaced MSComm with SuperCom ActiveX and it also solved us a lot other issues we had with Bluetooth devices.
|
|
|
|
|
I'm building a WCHAR Array, of server names to write to a REG_MULTISIZE Registry Key, But I'm unsure if I did the right thing.
The rule was a ServerName\0ServerName\00, but I get
"﷽﷽ꮫꮫꮫꮫﻮﻮﻮﻮﻮﻮDELLC521-01\SQLEXPRESSDELLC521-01\SQLEXPRESSWSA1\SQLEXPRESSDELL760\SQLEXPRESS2"
I'm not sure if my \0 went in, and I need to fix the prefix
WCHAR *pzServerNames = new WCHAR[0];
for ( int i = 0; i < sqlCount; ++i ) {
pzServerName = sqlSrvCollection[i];
wcsncat(pzServerNames, pzServerName, wcslen(pzServerName) );
wcsncat(pzServerNames, L"\0", wcslen(L"\0") );
}
_wcsncat_l(pzServerNames, L"\0\0", wcslen(L"\0\0"), NULL);
|
|
|
|
|
I guess first of all you're lucky it didn't crash since you allocated an array of 0 length.
Mark Salsbery
|
|
|
|
|
I guess that wasn't a good idea. I think I'm going to abandon that idea, and change the registry program to add 1 server name at a time. Read the key, and if the name is not there, then add the name and write the key back.
|
|
|
|
|
Try this:
int length = 0;
for ( int i = 0; i < sqlCount; ++i )
{
length += wcslen(sqlSrvCollection[i]);
length += 1; }
WCHAR* pzServerNames = new WCHAR[length + 1]; PWSTR pNext = pzServerNames; for ( int i = 0; i < sqlCount; ++i )
{
wcscpy_s(pNext, length, sqlSrvCollection[i]); int nlen = wcslen(sqlSrvCollection[i]); pNext += nlen; *pNext++ = L'\0'; length -= nlen + 1; }
*pNext = L'\0';
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Yeah, I thought I was going to have to do a per-calculation. I changed the format of the program, and opted for adding the server name 1 at a time. So when I add the name to the collection, I add the name to the registry key, which is multi-size. Sort of like the MimeMap Program, in which I read the key, look for a duplicate, if no duplicate, add the name, write the key back.
I will take your wisdom, and mix the 2 together. I wrote this yesterday, which is better than the the one I had in question. I know it has issues, in which I will straighten out today, on this rainy day.
I'm going to dump the wcsncmp for a straight value = value.
TCHAR szAddServerName[120];
WCHAR *pzServerNames = NULL;
int idx = wcslen(pzServerName);
for (int i = 0; i < idx; i++) {
szAddServerName[i] = pzServerName[i];
}
szAddServerName[idx] = L';';
szAddServerName[idx+1] = L'\0';
pzServerNames = CA_Registry::_get_Enumerated_SQLServers();
int iCompare;
wchar_t *token1, *nextToken;
wchar_t seps[] = L";";
token1 = wcstok_s(pzServerNames, seps, &nextToken);
do {
iCompare = wcsncmp(szAddServerName, token1, wcslen(szAddServerName)-1 );
if (iCompare != 0) {
wcsncat(pzServerNames, L";", wcslen(L";") );
wcsncat(pzServerNames, szAddServerName, wcslen(szAddServerName)+1 );
}
token1 = wcstok_s(NULL, seps, &nextToken);
if (token1 == NULL)
break;
} while (TRUE);
int iLength = wcslen(pzServerNames)+1;
pzServerNames[iLength+1] = L'\0';
WCHAR *szServerNames = new WCHAR[iLength+1];
wcsncpy_s(szServerNames, pzServerNames, wcslen(szServerNames) );
szServerNames[iLength] = L'\0\0';
|
|
|
|
|
I give your suggestion a spin, I don't understand this line. I know the pNext++ is a method to add a wchar to a const, but it goes backwards.
pNext += nlen; // The pNext goes Null
*pNext++ = L';'; // I wanted to add a ; to tokenize
*pNext++ = L'\0'; // takes a wchar off the front
int sql_Count = sqlSrvCollection.Count();
int length = 0;
for ( int i = 0; i < sql_Count; ++i )
{
length += wcslen(sqlSrvCollection[i]);
length += 2;
}
WCHAR* pzServerNames = new WCHAR[length + 1];
PWSTR pNext = pzServerNames;
for ( int i = 0; i < sql_Count; ++i )
{
wcscpy_s(pNext, length, sqlSrvCollection[i]);
int nlen = wcslen(sqlSrvCollection[i]);
pNext += nlen;
*pNext++ = L';';
*pNext++ = L'\0';
length -= nlen + 1;
}
*pNext = L'\0';
|
|
|
|
|
Incrementing the pNext pointer, merely moves it along the array, by a number of characters (pNext += nlen ) or a single character (pNext++ ). After incrementing it will appear to point to either an empty cell or some garbage. This is fine as long as the next statement fills that cell, by adding a new string or termination character. In my sample I was adding a NULL (L'\0' ) character after each string to create a REG_MULTISZ array. What you have done above is to add a semi-colon before each NULL which is superfluous. If you want a string that is tokenisable then put the semi-colon instead of the NULL, but make sure you still put the NULL at the very end.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
jkirkerx wrote: ...But I'm unsure if I did the right thing.
Anytime you are needing to deal with the '\0' character, functions like strcpy() , strcat() , strlen() and the like are off limits.
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
This code removes the caption from the frame, however, it also removes all the title data from the Window – New view, only the number of the new window is there, but the document string (title) does not change.
strTitle = pDocument->GetTitle();
DWORD style = pFrame->GetStyle();
pFrame->ModifyStyle(style,WS_CHILD | WS_THICKFRAME ); // remove all , and no caption
strTitle = pDocument->GetTitle();
How do I access the standard Windows menu to put the title back in ?
As always, your help is appreciated.
Thanks Vaclav
I have modified
pFrame->ModifyStyle(WS_CAPTION,NULL);
It keeps the menu document title, but Window tiling does not work wihtout the caption. No surprise here.
I do not need tiling anyway.
I am still looking for ways to replace the New view "serial number " with
title preferably from menu.
-- modified 13-Nov-11 7:35am.
|
|
|
|
|
I do not think that removing all styles from your frame window and replacing by WS_CHILD | WS_THICKFRAME is what you want to do here.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Yes I do want to do that, but it may be the wrong place to do this.
I need to have a multiview of a single document and do not want to have title bar in these secondary views.
I may use it only to initialy let the user reposition these views, than I do not need / want the title bar to clutter the destop.
I think the answer must be somewhere in CDocument "title" string.
But I have not found how to change the string at run time.
As far as clearing all the styles - it would be nice to find out what exactly are the default / framework generated styles.
|
|
|
|
|
But it seems to me that you are changing the style of your FrameWnd window rather than the MDIChild . If you want to remove the title from a child window then you need to modify each one's properties individually.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
I'm trying to do programming C++ for my project.
I got into trouble when I tried to do program for communicating with COM port(reading information in ComboBox).
The error " overloaded member function 'class CString(class CComboBox &a) not found in 'CXeedlg'. Could someone help me to overcome ?
overloaded member function not found in 'class'
The following is my code:
"
CString getCurStrInComboBox(const CComboBox &a)
{ CString str;
a.getLBText(a.GetCurSel(),str);
return str;
}
"
And the 2nd one is I dont know the reason why the complier informed that InsertString, AddString, GetCursel() arent members of ComboBox.
The deadline for my project is coming soon so I will really appreciate all your helps.
Thank you very much
|
|
|
|
|
Don't you need a class name in front of that function? As in, CXeedlg::getCurStrInComboBox
|
|
|
|
|
That was my bad in typing. I also have that part.
I also wanna ask you guys more questions.
"void CXbeefixedDlg::InitComboBox()
{
// ComboBox ComPort
m_cboComport.ResetContent();
m_cboComport.AddString("COM1");
m_cboComport.AddString("COM2");
m_cboComport.AddString("COM3");
m_cboComport.AddString("COM4");
m_cboComport.SetCurSel(2);
// ComboBox BitRate
m_cboBitrate.ResetContent();
m_cboBitrate.InsertString(0,"1200");
m_cboBitrate.InsertString(1,"2400");
m_cboBitrate.InsertString(2,"4800");
m_cboBitrate.InsertString(3,"9600");
m_cboBitrate.InsertString(4,"19200");
m_cboBitrate.InsertString(5,"38400");
m_cboBitrate.InsertString(6,"57600");
m_cboBitrate.InsertString(7,"115200");
m_cboBitrate.InsertString(8,"230400");
m_cboBitrate.SetCursel(3);
// Combobox Databit
m_cboDatabits.ResetContent();
m_cboDatabits.AddString("4");
m_cboDatabits.AddString("5");
m_cboDatabits.AddString("6");
m_cboDatabits.AddString("7");
m_cboDatabits.AddString("8");
m_cboDatabits.SetCurSel(0);
//Combox Stopbit
m_cboStopbits.ResetContent();
m_cboStopbits.AddString("1");
m_cboStopbits.AddString("1.5");
m_cboStopbits.AddString("2");
m_cboStopbits.SetCurSel(0);
//Combox Paritybit
m_cboParitybit.ResetContent();
m_cboParitybit.InsertSring(0,"None");
m_cboParitybit.InsertString(1,"Odd");
m_cboParitybit.InsertString(2,"Even");
m_cboParitybit.InsertString(3,"Mark");
m_cboParitybit.InsertString(4,"Space");
m_cboParitybit.SetCursel(0);
}
void CXbeefixedDlg::Settings()
{
// Check whether port was openned, Close port to setup parameter
if (m_mscomm.SetPortOpen())
m_mscomm.SetPortOpen(false);
// Initialize Port name
m_mscomm.SetCommPort(m_cboComport.GetCursel()+1);
// Initialize parameters, databits, stopbits, parity bits, flowcontrol
CString strBitrate = getCurStrInCombobox(m_cboBitrate);
CString strParitybit = getCurStrInCombobox(m_cboParitybit);
CString strStopbits = getCurStrInCombobox(m_cboStopbits);
CString strDatabits = getCurStrInCombobox(m_cboDatabits);
//Cstring strflowcontrol = getCurStrInCombobox(m_FlowControl);
CString strSetting;
strSetting.Format("%s,%c.%s,%s",strBitrate,strParitybit[1],strStopbits,strDatabits);
m_mscomm.SetSettings(strSetting);
// Other initializations
m_mscomm.SetRThreshold(1);
m_mscomm.SetInputlen(2); // Read 2 characters per once time
m_mscomm.SetInputBufferSize(1024);
m_mscomm.SetInputMode(0); // 0 - Text mode, 1 - Binary Mode
m_mscomm.SetPortOpen(true); // Open COM port
}
CString CXbeefixedDlg::getCurStrInCombobox(const CComBoBox &a)
{ CString str;
a.GetLBText(a.GetCurSel(),str);
return str;
}
"
The above is my code but I dont know the reason why my VC++ informed that GetCurSel is not a member of ComboBox class. And in the getCurStrInCombobox, it informed that missing "," before "&". Could you help me to solve this problem ?
The deadline for my project is coming so now I'm really rushed.
Thank you very much.
|
|
|
|
|
is this in your code or is this more "typo" during entry:
Quote: CComBoBox
you have too many capital "B"s in your CComboBox
|
|
|
|
|