|
Hello all,
I need to split/unsplit the main window in a SDI app using a menu command. I have the splitter window set up in the OnCreateClient function so that it checks a bool flag to decide whether to split or not to split, but I cant figure out how to recall the OnCreateClient function after changing the flag so that it will redraw the desired state.
Any suggestions?
Thanx
I miss the beach!
|
|
|
|
|
Another question that may help me, who calls OnCreateClient, when is it called, and how do I call it?
Landlocked in Atlanta . . .
I miss the beach!
|
|
|
|
|
Hi,
Don't know enough about splitters to really help, but I think chasing the route of 'recalling OnCreateClient' is the wrong way to go. I think MFC calls this to divide the available client area of a frame window up before creation (then it knows how to create the relevant views).
I made a class that could replace views, and it could split an existing view, so I would have thought it was possible to do the opposite.
I am probably wrong, but maybe try:
1. splitting the main window into 1 (sound stupid, but then you have a splitter created and attached to the frame window)
2. divide the main splitter pane up when splitting
3. replace the main splitter pane with just the single view when unsplitting.
This would be how I would approach the problem, though I admit it seems completely unelegant.
Sorry I couldn't be of more help,
Simon
|
|
|
|
|
hi all,
A little background...
My app processes data received on a serial port and creates a graph based on the data received. I do all processing and thread creation (to do the processing) in the Doc class. The Doc class also captures the message sent when the Start button is clicked. I do this because I need to change the views depending on how the user wants to see the data displayed, so a way to keep the threads from getting destroyed when the view changes is to put them in the Doc class (maybe not best solution, but I'm no guru either Anyway, when the start button is clicked I set a bunch of Timers in the Doc class, but the Timer gets used in the View class for updating a graph.
However, the timers are being set, but the view is not updating. I guess the view is not receiving the timers adn thus doesn't even know they have been set. How can I overcome this??
Thanks
-MDP
|
|
|
|
|
Check UpdateAllViews .
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
No good for my purposes.
The updating of the view is not dependant on the data (ie. the update needs to occur even if the data has not changed).
|
|
|
|
|
I don't see why not..
When the user click the Start button call UpdateAllViews, this way you get rid of the timers and all the views are notified
or
If you need to set the timers cause you want to update the views periodically, then set the timers on views, not the Document.
Andres Manggini.
Buenos Aires - Argentina.
|
|
|
|
|
The only purpose of the timers is to refresh the views every so often then. In that case, you might as well set the timer in the view itself, probably start it in OnInitialUpdate() and kill it in OnDestroy() . This way, OnTimer() in the view will get called and you can perform the refresh. If the update frequency needs to be adjusted by the document, you can provide a public member function in the view to achieve this.
And if words were wisdom, I'd be talking even more. The Offspring, I Choose
|
|
|
|
|
c:\windows\desktop\project3\linkedlist.h(147) : error C2676: binary '==' : 'class Partition' does not define this operator or a conversion to a type acceptable to the predefined operator
C:\Windows\Desktop\Project3\Partition.cpp(188) : while compiling class-template member function 'class Partition &__thiscall LinkedList<class partition="">::find(class Partition &)'
Error executing cl.exe.
HERE IS SOME CODE:
void main()
{
Partition* tempPartition;
MemoryManager* tempManager = new MemoryManager();
LinkedList<partition> L;
bool firstInputLine = true;
int processNumber;
int memoryDesired;
cout << "------------------------------------------" << endl;
cout << "PROCESSING " << endl;
cout << "------------------------------------------" << endl;
do
{
cin>> processNumber >> memoryDesired;
if (firstInputLine)
{
if (memoryDesired <= tempManager->memoryLimit)
{
tempPartition = new Partition(0, memoryDesired-1, false, processNumber);
L.insertAt(*tempPartition, 0);
tempManager->addProcess(*tempPartition, 0);
firstInputLine = false;
}
else
cout <<" THIS PROCESS NEEDS MORE MEMORY THAN WHAT I GOT.";
<\pre>
When i click on that error it takes me to the LinkedList template class
I'm very confused. thanks for unconfusing me.
:confused:
|
|
|
|
|
Compiler Error C2676
binary 'operator' : 'type' does not define this operator or a conversion to a type acceptable to the predefined operator
The specified operator could not be used in its predefined form. To use the operator you must overload it for the apropriate type, or define a conversion to a type for which the operator is defined. If you’ve encountered this error on code which compiled with an earlier version of Visual C++, please read Technote: Improved Conformance to ANSI C++ for more information.
The following is an example of this error:
class C
{
public:
C();
} c;
class D
{
public:
D();
D operator <<( C& );
} d;
void main()
{
d >> c; // error
d << c; // OK, operator << defined
}
--------------------------------------------------------------------------------
Send feedback to MSDN.Look here for MSDN Online resources.
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
1. This is not the code that is causing the problem. The error is found on the line you are shown when you double click on the error message.
2. The reason you get the error is that == is not a defined operation for one or both of the things you are comparing.
e,g,
CString s1, s2;
if (s1 == s2) ...
this works because the CString class has a method named == that performs the comparison. The compiler doesn't know what to do in your case. Basically you need to tell it how to compare two objects of your class.
Look at the CString class definition for hints on how to do this.
|
|
|
|
|
Help me. !I have an exercise:
Build an Active X that allow communicate with COM Ports:
-Allow user choosing port (COM1, COM2, COM3, COM4)
-Allow setting parameters: speed, parity, data bit, stop bit…
-Have methods: Open, Close, Flush ports
-Have method: Send & Receive data (char or string) through ports
-Allow setting time for end of transfer data (time-out transfer)
-Allow setting time for testing port (loop-back tested time)
-Auto enabled when there's an event from ports.
Can you help me !
Hung Son
|
|
|
|
|
I'm trying to find a good way to change the saturation of an image.
I've tried the HSL/T/V colorspace tricks, but they don't really work very well; because of the way things work out when going back to RGB space, increasing S tends to make images more red. Unfortunately, most image procesing packages seem to use some variation on the HS* trick, because they all show this tendency towards red at high saturation levels (and those that you can get the source to, like The GIMP and ImageMagick definitely use HSL).
Of course, Photoshop does an excellent job of preserving hue while increasing intensity/saturation - it has none of that red effect and is able to saturate colors to much higher levels than anything else i've seen. So, there's definitely a way to do it - but how?
Anyone have any other ideas? i've searched google for days and can't find anything but "RGB -> HSL -> RGB".
-c
Smaller Animals Software, Inc.
You're the icing - on the cake - on the table - at my wake. Modest Mouse
|
|
|
|
|
Sorry, I can't help. I just wanted to say I *hate* those Photoshop guys for doing everything so much better. I have spent hours in front of Photoshop applying filters and trying to replicate them.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm thinking of getting married for companionship and so I have someone to cook and clean." - Martin Marvinski, 6/3/2002
|
|
|
|
|
|
The verdict:
It's faster and uses (infinitely) less memory than the RGB->HSV->RGB method. And the results are by-far better.
The thing is, the results aren't exactly the same as Photoshop. What I'm struggling with now is: is that a bad thing? The output is almost more natural than PS - things don't get as blown-out as they can in PS, so that's good. But sometimes you really want things to get crazy; it's half the fun!
Regardless of the fun factor, I'm definitely going to use it for a while, to see if people like it.
Thanks!!!
B.T.W., the algorithm actually came from SGI (http://www.sgi.com/grafica/matrix), the PDF you linked to just repackaged the SGI stuff.
-c
Smaller Animals Software, Inc.
You're the icing - on the cake - on the table - at my wake. Modest Mouse
|
|
|
|
|
i have a mfc application.
i create a modal dialog with a button.
when i press that button, i want the modal to send an user message to the mainframe and the mainframe - in response to the user message - to create a modeless dialog.
strangely, it works on debug configuration but fails on release.
wish for help!
rechi
|
|
|
|
|
(I don't know whether sending a message to a blocked parent should work or not (my guess is it shouldn't), this is only a workaround.)
If your user message is say WM_CREATE_MODELESS_DIALOG and the associated handler OnCreateModelessDialog , just call this method directly with ((CYourMainFrmWnd *)AfxGetMainWnd())->OnCreateModelessDialog() . Maybe this works.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
|
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
|
|
|
|
|
If you only want it to happen once, use adara's suggestion with this key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce
If you want it to run everytime the machine is restarted, a better practice is to put a short cut in the startup folder. All of the systems services will have started before the applications in the Startup folder are run.
BTW: The registry path shown above and those used in the sample below are guaranteed on all MS platforms.
Usage:
CreateShortcutEx("Startup","MyAppShortcut","What ever this thing does","c:\\program files\\MyAppFolder\\MyApp.exe","");
This routine builds the shortcut itself.
CString CHSD30App::CreateShortcutEx(CString szWhere, CString szLinkName, CString szDesc, CString szFile, CString szArguments){
TCHAR szLink[MAX_PATH];
DWORD cchCurDir = MAX_PATH;
DWORD cchStartDir = MAX_PATH;
char *pDot;
TCHAR szStartInDirectory[MAX_PATH];
HRESULT hres;
IShellLink *psl;
HKEY hCU;
DWORD lpType;
ULONG ulSize = MAX_PATH;
BOOL bRetVal;
DWORD dwRetVal = 0;
bRetVal = FALSE;
if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_CURRENT_USER,
"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders",
0,KEY_QUERY_VALUE,
&hCU))
{
RegQueryValueEx( hCU,
LPCSTR(szWhere),
NULL,
&lpType,
(unsigned char *)&szLink,
&ulSize);
RegCloseKey(hCU);
}
bRetVal = FALSE;
pDot = strrchr(szFile, '.');
lstrcat (szLink, LPCSTR(szLinkName));
if (pDot = strstr(szLink, "."))
*pDot = (char)NULL;
lstrcat (szLink, ".LNK");
hres = CoInitialize(NULL);
if( !SUCCEEDED(hres))
bRetVal = FALSE;
else
bRetVal = TRUE;
hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
IID_IShellLink, (void **)&psl);
if (SUCCEEDED(hres))
{
IPersistFile *ppf;
hres = psl->QueryInterface(IID_IPersistFile, (void **)&ppf);
if (SUCCEEDED(hres))
{
WORD wsz[MAX_PATH];
hres = psl->SetPath(szFile);
if (!SUCCEEDED(hres))
bRetVal = FALSE;
else
bRetVal = TRUE;
if (!szArguments.IsEmpty())
{
hres = psl->SetArguments(szArguments);
if (!SUCCEEDED(hres))
bRetVal = FALSE;
else
bRetVal = TRUE;
}
hres = psl->SetDescription(szDesc);
if (!SUCCEEDED(hres))
bRetVal = FALSE;
else
bRetVal = TRUE;
GetCurrentDirectory(MAX_PATH,szStartInDirectory);
hres = psl->SetWorkingDirectory(szStartInDirectory);
if (!SUCCEEDED(hres))
bRetVal = FALSE;
else
bRetVal = TRUE;
MultiByteToWideChar(CP_ACP, 0, szLink, -1, wsz, MAX_PATH);
hres = ppf->Save(wsz, TRUE);
if (E_FAIL == hres)
bRetVal = FALSE;
else
bRetVal = TRUE;
ppf->Release();
}
psl->Release();
}
else
bRetVal = FALSE;
CoUninitialize();
CString retString = szLink;
if( !bRetVal)
retString.Empty();
return retString;
}
Good Luck,
Bill
|
|
|
|
|
Hi all,
I am new to VC++. Here is the question I have:
I need to write a program that can make a call to another machine through modem, like the Hyperterminal.
Should I use TAPI or RAS or other functions?
RASDIAL needs the phone#, userID, password during the dial up process. But I need to send out the user ID when the remote computer prompts "Username". Also, the password will be sent out only if the remote computer prompts for "Password".
Any help would be appreciate.
Sue
Sue
|
|
|
|
|
When I began to study VC++, I had this idea, but I forgot. Now, help me for that problem plz !
Hung Son
|
|
|
|
|
how to get a process name attached to a given udp port?
|
|
|
|
|
I have created a dialog app, which return a debug error meesage that i don't understand. This message is:
Debug error
Program :\CalcRiskPort\Debug\CalcRiskPort.exe
DAMAGE: after Normal block (#81) at 0x00301190
when i pree retry i have this message box:
User breakpoint called from code at 0x1021376f
you could see the following code concerned
void CCalcRiskPortDlg::OnCalcvar()
{
UpdateData(TRUE);
::CoInitialize(NULL);
//LoadTables Table;
//LoadTables Table2(m_dlgSector);
double *pTabVar=new double[(double)pow(2,m_dlgAsset)];
double *pTabMoy=new double[(double)pow(2,m_dlgAsset)];
CString *pTabPortStr=new CString[(long)pow(2,m_dlgAsset)];
CString strValue,strPortOpti,strMaxiSharpe,strMaxiEfficience;
double MiniVar,MaxiSharpe,MaxiEfficience;
int Rang;
double *pMiniVar=new double[2];
//double *pMiniRatio=new double[2];
double *pMaxiRatioSharpe=new double[2];
double *pMaxiRatioEfficience=new double[2];
int *pTabBinPort=new int[m_dlgAsset];
int *pTabNumPort=new int[m_dlgAsset];
int k,i;
try
{
LoadTables Table(1,m_dlgSector,1,m_dlgSector);
_ConnectionPtr pConnection=NULL;
CString strTemp;
strTemp.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\\CalcRiskPort\\Vol&CorrelDB.mdb;");
_bstr_t strCnn(strTemp);
TESTHR(pConnection.CreateInstance(__uuidof(Connection)));
pConnection->Open(strCnn,"","",adConnectUnspecified);
Table.pCorrel=Table.LoadCorrelation(m_dlgSector,Table.pCorrel,"Correlation");
Table.pVol=Table.LoadVolatility(m_dlgSector,Table.pVol,"Volatilité");
Table.pYield=Table.LoadYield(m_dlgSector,Table.pYield,"Ratio");
i=0;
for(k=0;k<=m_dlgAsset-1;k++)
{
*(pTabBinPort+k)=0;
Table.ConvertBinToNum(k,pTabBinPort,pTabNumPort);
}
*pTabVar=Table.CalcVar(pTabNumPort,m_dlgAsset);
*pTabMoy=Table.CalcMoy(pTabNumPort,m_dlgAsset);
Table.pRatioSharpe[0]=(*pTabMoy)/(*pTabVar);
Table.pRatioEfficience[0]=((*pTabMoy+i)-m_dlgRate0)/(*pTabVar);
*pTabPortStr=Table.AgregIntToStr(pTabNumPort,m_dlgAsset);
for(i=1;i<=pow(2,m_dlgAsset)-1;i++)
{
k=m_dlgAsset-1;
while(*(pTabBinPort+k)==1)
{
*(pTabBinPort+k)=0;
Table.ConvertBinToNum(k,pTabBinPort,pTabNumPort);
if(k!=0)
k--;
}
*(pTabBinPort+k)=1;
Table.ConvertBinToNum(k,pTabBinPort,pTabNumPort);
*(pTabVar+i)=Table.CalcVar(pTabNumPort,m_dlgAsset);
*(pTabMoy+i)=Table.CalcMoy(pTabNumPort,m_dlgAsset);
Table.pRatioEfficience[i]=(*(pTabMoy+i))/(*(pTabVar+i));
Table.pRatioSharpe[i]=((*(pTabMoy+i))-m_dlgRate0)/(*(pTabVar+i));
*(pTabPortStr+i)=Table.AgregIntToStr(pTabNumPort,m_dlgAsset);
}
pMiniVar=Table.CalcMin(pTabVar,pMiniVar,(long)pow(2,m_dlgAsset));
pMaxiRatioSharpe=Table.CalcMax(Table.pRatioSharpe,pMaxiRatioSharpe,m_dlgAsset);
pMaxiRatioEfficience=Table.CalcMax(Table.pRatioEfficience,pMaxiRatioEfficience,m_dlgAsset);
MiniVar=pMiniVar[0];
MaxiSharpe=pMaxiRatioSharpe[0];
MaxiEfficience=pMaxiRatioEfficience[0];
Rang=(int)pMiniVar[1];
m_dlgValue=pTabVar[Rang];
m_dlgValue *=100;
m_dlgPortOpti=*(pTabPortStr+Rang);
strPortOpti=m_dlgPortOpti;
m_dlgSharpe=MaxiSharpe;
m_dlgEfficience=MaxiEfficience;
strMaxiSharpe.Format("%.5f",m_dlgSharpe);
strMaxiEfficience.Format("%.5f",m_dlgEfficience);
strValue.Format("%.5f",m_dlgValue);
CEdit* PEdit=(CEdit*)GetDlgItem(IDC_VALUE);
PEdit->SetWindowText(strValue);
CEdit* SEdit=(CEdit*)GetDlgItem(IDC_OPTI_PORT);
SEdit->SetWindowText(strPortOpti);
CEdit* ShEdit=(CEdit*)GetDlgItem(IDC_OPTI_SHARPE);
ShEdit->SetWindowText(strMaxiSharpe);
CEdit* EffEdit=(CEdit*)GetDlgItem(IDC_OPTI_EFFICIENCE);
EffEdit->SetWindowText(strMaxiEfficience);
delete []pMiniVar;
delete []pMaxiRatioSharpe;
delete []pMaxiRatioEfficience;
delete []pTabBinPort;
delete []pTabNumPort;
delete []pTabVar;
delete []pTabMoy;
pConnection->Close();
}
catch(_com_error &e)
{
AfxMessageBox("a pas bon");
}
::CoUninitialize();
// TODO: Add your control notification handler code here
}
so i hope that someone could help me to solve my problem
thanks in advance for your answers
gerald
|
|
|
|
|