|
Hi,
is there some trick to add a string at the top of the dropdown and not at the bottom? If so, how?
Thanks!
|
|
|
|
|
comboboxcontrolvariable.InsertString(index, string);
or something like that.
good luck.
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
No trick, just use InsertString() .
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Yeah I know... that was pretty dumb from my part
Thanks guys!
|
|
|
|
|
Hi!
I can't derive my CBaseRenderer class from CD3DBase, here's my code:
#pragma once
class CD3DBase;
class CBaseRenderer : public CD3DBase
{
public:
CBaseRenderer(void);
~CBaseRenderer(void);
public:
void OnLostDevice();
void OnResetDevice();
void OnFrameMove();
void OnRender();
void OnInitVolatileResources();
void OnFreeVolatileResources();
};
and these are the errors:
------ Build started: Project: DXProject, Configuration: Release Win32 ------<br />
<br />
Compiling...<br />
CBaseRenderer.cpp<br />
e:\C++\DXProject\CBaseRenderer.h(7) : error C2504: 'CD3DBase' : base class undefined<br />
DXProject.cpp<br />
e:\C++\DXProject\CBaseRenderer.h(7) : error C2504: 'CD3DBase' : base class undefined<br />
CD3DBase.cpp<br />
e:\C++\DXProject\CBaseRenderer.h(7) : error C2504: 'CD3DBase' : base class undefined<br />
CApplication.cpp<br />
e:\C++\DXProject\CBaseRenderer.h(7) : error C2504: 'CD3DBase' : base class undefined
What's wrong with this code?
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
You must include the header for the definition of CD3DBase. If you are deriving from a class then it is not enough just to have a forward reference, you need the full class available.
|
|
|
|
|
Ok thanks, but if I include the header, I get even more errors, since CBaseRenderer and CD3DBase include each other, because CD3DBase needs to create an object of CBaseRenderer
modified 12-Sep-18 21:01pm.
|
|
|
|
|
You could put a forward declaration of CBaseRenderer into CD3DBase.h
|
|
|
|
|
Ok, next errors
#pragma once
class CBaseRenderer;
class CD3DBase
{
private:
CBaseRenderer gRenderer;
};
And here the errors:
e:\C++\DXProject\CD3DBase.h(46) : error C2079: 'CD3DBase::gRenderer' uses undefined class 'CBaseRenderer
modified 12-Sep-18 21:01pm.
|
|
|
|
|
You're missing #include "BaseRenderer.h" or you can make gRenderer a pointer.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
tried both. this eliminated all errors, except that now I get this one again:
e:\C++\DXProject\CBaseRenderer.h(5) : error C2504: 'CD3DBase' : base class undefined
#pragma once
#include "CD3DBase.h"
class CBaseRenderer : public CD3DBase
{ ...
but well...since I only need a pointer to an IDirect3DDevice9 from CD3DBase, I might also create a function to pass this one as a parameter and make CBaseRender not to inherit from CD3DBase.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
you have a dependecy loop.
"a.h" file includes "b.h"
and "b.h" file includes "a.h"
when you derive the derivated class has to know the type tou derive from so you need the definition of the type not the declaration
of that type.
|
|
|
|
|
How come that this line will compile in VS 6.0 but not in VS 7.0?
strOut += strData[iPos] ^ strKey[iKeyPos++];
strOut, strData and strKey are Cstring.
IPos and iKeyPos is int.
I got the compiler error: C2593: 'operator +=' is ambiguous (watch my code)
Thanks
_____________________________
...and justice for all
APe
|
|
|
|
|
d00_ape wrote:
How come that this line will compile in VS 6.0 but not in VS 7.0?
Actually, with warning level 4, VS6 also complains.
d00_ape wrote:
I got the compiler error: C2593: 'operator +=' is ambiguous (watch my code)
Of the various CString += operators, more than one of them matches the strData[iPos] ^ strKey[iKeyPos++] return value. Does this help:
strOut += (char) (strData[iPos] ^ strKey[iKeyPos++]);
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
DavidCrow wrote:
strOut += (char) (strData[iPos] ^ strKey[iKeyPos++]);
It really helped. And still work with that XOR. THANKS!!
_____________________________
...and justice for all
APe
|
|
|
|
|
Don't know why you get the error but try this:
strOut += strData[iPos];<br />
strOut += strKey[iKeyPos++];
Could be that this works. (else you still can use strOut.append(...))
Good luck.
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
He lost the XOR operation this way
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Hi..
Plz help me..
How to Hide column from listview.
even one drag width of other col. then it'll not display..
means... if we setWidth=0, then even your cannot show that fields..
Bye
---Sumit Kapoor--- sumit_kapoor1980@hotmail.com
|
|
|
|
|
Hi
I am calling a dialog box including a list control window.
This dialog box has computer names in local network.
I'ts using 'WNetOpenEnum' and 'WNetEnumResource' APIs.
Now I have used this code successfully in Windows 2000/XP.
But these codes got empty in Windows 98.
Nothing in list control.
Is a problem of network setting or not enough APIs to get names?
How can I do that?
anyone any ideas ?
Help me plz.
---- source list ---
void CNetworkDlg::SearchLocalPc(void)
{
// WNetOpenEnum parameter
DWORD dwScope = RESOURCE_CONTEXT;
NETRESOURCE *NetResource = NULL;
HANDLE hEnum;
// WNetOpenEnum for Windows 98. but Nothing in return value
unsigned long strWNetMSG = WNetOpenEnum(dwScope, RESOURCETYPE_ANY, NULL, NULL, &hEnum);
// for error
switch(strWNetMSG)
{
case NO_ERROR:
break;
case ERROR_NOT_CONTAINER:
AfxMessageBox("ERROR");
break;
case ERROR_INVALID_PARAMETER:
AfxMessageBox("ERROR");
break;
case ERROR_NO_NETWORK:
AfxMessageBox("ERROR");
break;
case ERROR_EXTENDED_ERROR:
AfxMessageBox("ERROR");
break;
default :
AfxMessageBox("ERROR");
return ;
}
// SOCKET creation
WSADATA wsaData;
WSAStartup(MAKEWORD(1, 1),&wsaData);
// if WNetOpenEnum success
if (hEnum)
{
// for WNetEnumResource
DWORD dwCount = 0xFFFFFFFF;
DWORD dwBufferSize = 16384;
LPVOID lpBuffer = new char[16384];
// continues a network-resource enumeration but Nothing in return value
unsigned long strWNetResourceMSG = WNetEnumResource(hEnum, &dwCount, lpBuffer, &dwBufferSize);
NetResource = (NETRESOURCE*)lpBuffer;
// for error
switch(strWNetResourceMSG)
{
case ERROR_MORE_DATA:
AfxMessageBox("ERROR");
break;
case ERROR_INVALID_HANDLE:
AfxMessageBox("ERROR");
break;
case ERROR_NO_NETWORK:
AfxMessageBox("ERROR");
break;
case ERROR_EXTENDED_ERROR:
AfxMessageBox("ERROR");
break;
default:
break;
}
if(m_ListSearchPc.GetItemCount() != 0)
m_ListSearchPc.DeleteAllItems();
m_dwCountTotalPc = 0;
for(unsigned int i = 0; i < dwCount; i++, NetResource++)
{
if (NetResource->dwUsage == RESOURCEUSAGE_CONTAINER && NetResource->dwType == RESOURCETYPE_ANY)
{
if (NetResource->lpRemoteName)
{
CString strFullName = NetResource->lpRemoteName;
if (strFullName.Left(2).Compare("\\\\") == 0)
strFullName = strFullName.Right(strFullName.GetLength() - 2);
if(strFullName.IsEmpty())
continue;
// 1. add number to list contorl
CString pcNo;
pcNo.Format("%d", m_dwCountTotalPc + 1);
m_ListSearchPc.InsertItem(m_dwCountTotalPc, pcNo);
// 2. add pc aname to list control
strFullName.MakeLower();
m_ListSearchPc.SetItemText(m_dwCountTotalPc, 1, (LPCTSTR)strFullName);
m_dwCountTotalPc++;
}
}
}
delete lpBuffer;
WNetCloseEnum(hEnum);
}
WSACleanup();
CString total;
total.Format("%d", m_dwCountTotalPc);
CString PopupMessage;
PopupMessage = "Number of Total Pc :";
PopupMessage += total;
SetDlgItemText(IDC_TEXT_LOCALPC_EA, LPCTSTR (PopupMessage));
UpdateData(FALSE);
}
|
|
|
|
|
When you say "nothing in return value," does that mean that WNetOpenEnum() is returning NO_ERROR ?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Yes. WNetOpenEnum() is returning NO_ERROR.
|
|
|
|
|
I did not find anything exceptionally wrong. See if any of these minor changes make a difference:
void CNetworkDlg::SearchLocalPc(void)
{
WSADATA wsaData;
CString strText;
DWORD dwResult = 0,
dwCount = 0xffffffff,
dwBufferSize = 16384,
dwIndex = 0;
int nItem;
LPNETRESOURCE lpNetResource = NULL;
HANDLE hEnum;
LPVOID lpBuffer;
m_ListSearchPc.DeleteAllItems();
dwResult = WSAStartup(MAKEWORD(1, 1), &wsaData);
if (0 == dwResult)
{
dwResult = WNetOpenEnum(RESOURCE_CONTEXT, RESOURCETYPE_ANY, NULL, NULL, &hEnum);
if (NO_ERROR == dwResult && NULL != hEnum)
{
lpBuffer = new BYTE[dwBufferSize];
dwResult = WNetEnumResource(hEnum, &dwCount, lpBuffer, &dwBufferSize);
if (NO_ERROR == dwResult && dwCount > 0)
{
lpNetResource = (LPNETRESOURCE) lpBuffer;
while (dwIndex < dwCount && NULL != lpNetResource)
{
if (RESOURCEUSAGE_CONTAINER & lpNetResource->dwUsage && RESOURCETYPE_ANY == lpNetResource->dwType)
{
if (lpNetResource->lpRemoteName)
{
strText.Format(_T("%lu"), dwIndex);
nItem = m_ListSearchPc.InsertItem(dwIndex, strText);
strText = lpNetResource->lpRemoteName;
if (_T("\\\\") == strText.Left(2))
strText.Delete(0, 2);
strText.MakeLower();
m_ListSearchPc.SetItemText(nItem, 1, strText);
dwIndex++;
}
}
lpNetResource++;
}
strText.Format(_T("Number of Total PC: %lu"), dwIndex);
SetDlgItemText(IDC_TEXT_LOCALPC_EA, strText);
}
delete [] lpBuffer;
}
dwResult = WSACleanup();
}
if (dwResult != 0)
{
strText.Format(_T("Error: %lu"), dwResult);
m_ListSearchPc.InsertItem(0, strText);
}
}
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
hi all
i use the below to create a modeless dialog which works ok
CCPServerWait* m_pWaitDlg;
m_pWaitDlg = new CCPServerWait;
m_pWaitDlg->Create(IDD_DCPSERVER_WAIT);
m_pWaitDlg->m_wait_mes = "Connecting to CMIS Please
m_pWaitDlg->UpdateData(FALSE);
m_pWaitDlg->ShowWindow(SW_SHOW);
m_pWaitDlg->UpdateWindow();
m_pWaitDlg->DestroyWindow();
but before i use this code; i need to call the function
ok = SQLCreateDataSource(m_hWnd,"CP_CMIS_CON");
with this in, the code for the modeless dialog doesnt work
if i take it out then the code for the modeless dialog does work,
obviously i need it in, can ne1 help ???
si
|
|
|
|
|
si_69 wrote:
m_pWaitDlg->UpdateWindow();
There is no need to call UpdateWindow() here.
si_69 wrote:
the code for the modeless dialog doesnt work
Define "doesnt work." Have you single-stepped through each line of code?
The code you've shown does not appear to do anything other than create a dialog object and then destroy it. I can't imagine it being on the screen any longer than a quick flash, if that long. The last time I used one, there was some (lengthy) processing going on in between the calls to ShowWindow() and DestroyWindow() .
http://www.codeproject.com/script/comments/forums.asp?forumid=1647&select=857875&df=100&fr=101#xx857875xx
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Does anyone know how to detect a CDatabase disonnection?
I'm inserting rows into a database and when it disconnects it throws a CDBException with return code of type 'SQL_ERROR'. This is the same error code for all SQL errors e.g. primary key violation etc.
I want to detect a disconnection, then attempt a reconnect but can't figure out how to specifically detect a disconnection?
Can anyone help?
|
|
|
|