|
I know I'm a broken record in this topic, but assuming your question has already been answered, let me add that CArray is CRAP. You should do yourself a favour and read my STL series of articles, starting with the one on vector. Anyone who uses MFC container classes is using stuff written as a stopgap prior to the release of STL, and is selling themselves way short.
Read the articles and I am sure you will agree. CArray cannot do half of what vector does.
Christian
We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum )
|
|
|
|
|
I have the following trouble with !STANDARD! Radio Buttons:
I place 2 or more RadioButtons in Resource-Editor, I give the first element the group-flag via the property sheet and add one int variable to the first element. after that in InitDialog I do the following:
m_radioval = 1;
UpdateData(FALSE);
I get the following warning-messages in the output-window:
Warning: skipping non-radio button in group.
can anybody please explain me what happens? can't find anything on the net to that warning-message.
thanks in advance
silver
I don't want achieve immortality through my work - I want achieve it through not dying - Woody Allen
|
|
|
|
|
All your radio buttons that you want grouped together have to be in the proper tab order, and the first control that comes after your group of radio buttons must have it's group flag set.
CPUA 0x5041
Sonork 100.11743 Chicken Little
"So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies
Within you lies the power for good - Use it!
|
|
|
|
|
Thanks a lot - you helped me very much! (and sorry for my trashing english)
I don't want achieve immortality through my work - I want achieve it through not dying - Woody Allen
|
|
|
|
|
silverspoon wrote:
sorry for my trashing english
You didn't trash it. Your written english is excellent. I really admire all you non english speaking people who manage to use english to get their point across on these forums, because I know that if I had to use german ( or any other language) I would fail miserably.
CPUA 0x5041
Sonork 100.11743 Chicken Little
"So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies
Within you lies the power for good - Use it!
|
|
|
|
|
Hello friends,
i have a CView (fullscreen) on the bottom (in x-axis) and i would like to show a modeless CDialog (fullscreen) on the CView. And then i would like to show an another modeless CDialog (quarder-screen) on the CDialog (fullscreen).
I would like to create (and delete) all dialogs in the CView, and the user should operate with all dialogs at the same time.
I have try that, and my problem is this:
I see the fullscreen dialog and the quarderscreen dialog (that is right), but i don't can operate with quarder-screen dialog (that is the problem). That dialog get no mouse-messages, and the buttons (on the quarderscreen dialog) don't move down when i try to click on it.
Here is a code-snipet (that i use to create one of the dialogs):
void CViewPMain::CreatePFkt3Zeile()
{
CRect DlgPFkt3Zeile, View;
if (!m_DlgPFkt3Zeile)
{
GetClientRect(View);
m_DlgPFkt3Zeile = new CDlgPFkt3Zeile;
if (!::IsWindow(m_DlgPFkt3Zeile->GetSafeHwnd()))
m_DlgPFkt3Zeile->Create(IDD_P_FKT_3ZEILE, this);
m_DlgPFkt3Zeile->GetWindowRect(DlgPFkt3Zeile);
ASSERT(m_DlgPFkt3Zeile->SetWindowPos(NULL
, View.Width() - DlgPFkt3Zeile.Width() //int x
, View.Height() - DlgPFkt3Zeile.Height() //int y
, DlgPFkt3Zeile.Width() //int cx
, DlgPFkt3Zeile.Height() //int cy
, SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOZORDER));
m_DlgPFkt3Zeile->ShowWindow(SW_SHOW);
}
else
{
delete m_DlgPFkt3Zeile;
m_DlgPFkt3Zeile = 0;
}
}
At the SetWindowPos-function i have tryed a lot of parameters for the first and the last parameter, but ever i don't can operate with the second dialog.
What make i wrong at the "create" of the dialogs? Or is "multiple dialogs" not aviable? Is there any other solution that i can do?
Thank you very much for your help!
PS: Sorry for my bad english.
|
|
|
|
|
> PS: Sorry for my bad english.
It's very difficult to understand what you are asking here, but I'll try to answer your question.
First you'll have to answer some questions.
1. Are you using splitters? I don't understand what you mean by "i have a CView (fullscreen) on the bottom (in x-axis)". On the bottom of what?
2. When you say you want a Dialog in the view, do you mean you are using a form view or do you want a dialog whose parent is a CView?
3. Can you provide me with a better explanation of what this application looks like and does?
Let's start there. Just answer these questions and maybe I'll be able to understand better.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
Hello perlmunger,
Thank you very very much that you try to help me!
My answers of your questions:
1. I mean i don't use splitters(but i don't know what splitter is). I have a view (from CView - class), that show a dialog resoucre. With on the bottom i mean, that i create the CView first. "in x-axis" is wrong, i mean in z-axis, sorry.
2. I don't know that the dialog is the right solution (i am new in VC++), i try to explain what i want:
The CView must be the "master", i mean he should create and delete all my dialogs. The dialogs should modeless, without titlebar... and the user should not see/know that the dialogs are not the view(i mean the user should mean that he see only one dialog/view). The view should create some dialogs, that all activate. When the user click a button on a dialog, the dialog should send a user message to the view.
I have try that: the view create a dialog and then he create a second dialog, but i don't can operate with the second dialog (he recieve no messages) but i see the dialog.
3. a little background:
I port a HMI from C and a realtime-OS to win32. This part is the process visualisation. First you see a dialog that the machine is run up. Then you see a a lot of dialogs, what the machine is doing at the moment. Sometimes i show a dialog with function-keys/buttons. The problem is that i don't show only one dialog at the same time.
Do you understand my problem now?
|
|
|
|
|
Are there any STL gurus who can help a newbie? I am trying to pass a vector as an argument to a function. What is the correct way to do this or is it even possible? This is what I've thought of doing(I need the whole vector container in the function).
<br />
<br />
#include "stdafx.h"<br />
<br />
class myclass{<br />
<br />
public:<br />
<br />
myclass(){};<br />
<br />
virtual int myfunction(vector<CString> V1, vector<CString> V2);<br />
<br />
~myclass(){};<br />
<br />
}<br />
<br />
<br />
<br />
<br />
<br />
#include "stdafx.h"<br />
#include "myclass.h"<br />
#include <vector><br />
using std::vector;<br />
<br />
int main(){<br />
<br />
vector<CString> mystring;<br />
vector<CString> myotherstring;<br />
<br />
<br />
myclass classy;<br />
<br />
classy.myfunction(mystring, myotherstring);<br />
<br />
return 0;<br />
<br />
}<br />
<br />
int myclass::myfunction(vector<CString> V1, vector<CString V2){<br />
<br />
<br />
}
I don't want to pass the value of one element of the container, but the whole container as the function parameter. If you can help me, I will consider you an STL Guru of the highest order. Thanks in advance friends!
|
|
|
|
|
Pass by reference:
virtual void myfunction (vector<CString>& v1, vector<CString>& v2)
Thus, you will pass only a reference the containter not the whole container.
Best regards,
Alexandru Savescu
|
|
|
|
|
And even better: If you just want to read the parameters, pass them as const reference:
virtual void myfunction( const vector<CString>& v1, const vector<CString>& v2 )
--
Daniel Lohmann
http://www.losoft.de
|
|
|
|
|
Hi,
If I have a loop that looks like follows:
while(::PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
::TranslateMessage(&msg);
::DispatchMessage(&msg);
}
Would this retrieve messages from other windows also?
Right now, if I minimize another window, it minimizes my window also !
The MSDN says the following ,
"If hWnd is NULL, PeekMessage retrieves messages for any window that belongs to the current thread making the call. (PeekMessage does not retrieve messages for windows that belong to other threads.)"
I am confused !
|
|
|
|
|
try using GetMessage instead... also check the value of msg.hwnd before TranslateMessage in the while loop...
- Roman -
|
|
|
|
|
I don't know if this is the appropriate place to ask this but here goes...
I'm working on the help documentation for my application by writing raw RTF code for the WinHelp compiler.
Can anyone tell me the proper RTF syntax for a hyperlink to an Internet URL?
|
|
|
|
|
|
Thank you for reading my question.
I am trying to program in OLE DB.
Some function have been added,such as m_pSet->delete() and so on.
No bug has been found until I found I can't use m_pSet->Insert() to Insert new data.The return of FAILED(m_pSet->Insert()) is always TRUE.How can I do to solve it?Would anyone like tell me?Thanks.
|
|
|
|
|
1) When using ActiveScript in my app, is it okay to have one class implement both IActiveScript and IActiveScriptSite if only one active script site is to be used?
2) Can I have one class factory create both objects if I can't do the above?
I'm looking for a good explanation if possible from someone who has used Active Scripting before, so that I can get started with it.
- Roman -
|
|
|
|
|
Q1. You don't need to have any implementation of IActiveScript. It means that you have made own script language engine.
Because you are a client of some script engine, you need to implement only a site-object with IActiveScriptSite interface.
Q2. You aren't obliged to need any class factory for a site-object. You can create it internally by CComObject<cactscrsit>::CreateInstance or CActScrSit::_CreatorClass::CreateInstance. Or you can create through original COM way with the coclass of your site-object.
Some example for which CActScrSit class must implement the IActiveScriptSite's function (isn't submitted)
HRESULT hr;
CComPtr<IActiveScriptSite> spScriptSite;
hr = CActScrSit::_CreatorClass::CreateInstance(NULL,IID_IActiveScriptSite, (void**)&spScriptSite);
if( FAILED(hr) )
return E_FAIL;
CComPtr<IActiveScript> spScript;
hr = spScript.CoCreateInstance( OLESTR("VBScript") );
if( SUCCEEDED(hr) )
{
CComQIPtr<IActiveScriptParse> spParser( spScript );
if( spParser )
{
hr = spScript->SetScriptSite( spScriptSite );
hr = spParser->InitNew();
hr = spScript->SetScriptState( SCRIPTSTATE_STARTED );
hr = spScript->AddTypeLib( CComModule::m_libid, 1, 0, 0L );
hr = spScript->AddNamedItem( OLESTR("Me"), SCRIPTITEM_ISVISIBLE );
EXCEPINFO exErr;
DWORD flags = SCRIPTTEXT_ISEXPRESSION;
hr = spParser->ParseScriptText( bstrFormula, OLESTR("Me"),
(IUnknown*)this, NULL,0, 0,flags, pVal, & exErr );
spScript->Close();
}
}
spScriptSite = (IActiveScriptSite*) NULL;
With best wishes,
Vita
|
|
|
|
|
hey thanks for the reply,
what's a "coclass" i am still not to clear about what that is
also, i am not using MFC, so I will have to somehow use CoCreateInstance... or maybe i can just create a new instance like MyScriptSite* pSite = new MyScriptSite with MyScriptSite being derived from IActiveScriptSite
- Roman -
|
|
|
|
|
"MyScriptSite* pSite = new MyScriptSite" is possible if you make the right ref-counting with your MyScriptSite class. So ATL will create this class with ref-counter is equal 0. Therefore you must provide a way to increase it to 1 by AddRef().
The "coclass" is a term which designates a created class outside the server.
With best wishes,
Vita
|
|
|
|
|
i am implementing each method of IUnknown manually, e.g. i have my own ref-count variable and AddRef and Release work properly
- Roman -
|
|
|
|
|
Hi,
Does making a window disabled, make it disappear from the"Alt+Tab" list?
If I do a EnableWindow(FALSE) in a dialog based application, I cannot see it in the Alt+Tab list.
Can this be prevented?
Thanks....
|
|
|
|
|
Loop through and disable all the controls, but leave the window enabled.
---
Shog9
If I could sleep forever, I could forget about everything...
|
|
|
|
|
The windows in the task list, as it's more correctly called, meet the following criteria:
- No parent
- Visible
- No owner and WS_EX_TOOLWINDOW, OR Owner and WS_EX_APPWINDOW
- At least one character of text
Peter O.
|
|
|
|
|