|
In my MFC MDI project I've got two views V1 and V2.
V1 spawns two modeless CDialogs. C1 and C2
Now I do a switchview and V2 is showing in the mainframe.
C1 and C2 remain floating on top of V2.
I want V2 to be on top of C1 and C2.
Now I switchview back to V1.
Now I want C1 and C2 to be back on top of V1.
What functions will do my first requirement?
What must I do to the already spawned C1 and C2 when I go back to V1, to make them pop up?
Appreciate your help,
ns
|
|
|
|
|
ns wrote:
Now I do a switchview and V2 is showing in the mainframe.
C1 and C2 remain floating on top of V2.
I want V2 to be on top of C1 and C2.
You can have C1 and C2 behind the MAINFRAME, that is the Application window, but not between MainFrame and View.
Simply send them a message to set themselves to the last place in the Z-Order (or better, hide them?).
ns wrote:
Now I switchview back to V1.
Now I want C1 and C2 to be back on top of V1.
This is the normal behaviour of dialogs, sitting atop of their parent window.
Probably you have to send them a message to tell them to undo the first step.
--
"My opinions may have changed, but not the fact that I am right."
Found in the sig of Herbert Kaminski
|
|
|
|
|
That sounds like a plan. Now I need to know what the message looks like:
BasicallY i switchview fromn V1. So when I am doing this I sjphoulshave V1 send message to c1 and c2 right?
Something like C1->SendMEssage(" What goes here to make it hide? ")
Then in V2 whn I switch back to V1 I do again:
C1->SendMessage(" Come back into view - unhide..what command is this ? ")
I guess is there something like WM_HIDE or something? and WM_UNHIDE?
Appreciate your help,
ns
|
|
|
|
|
ns wrote:
BasicallY i switchview fromn V1. So when I am doing this I sjphoulshave V1 send message to c1 and c2 right?
I have thought about a user defined message (look for RegisterWindowMessage in MSDN, or some WM_APP+const ) that are handled by the Dialogs by hiding/showing themselves using MoveWindow() .
But you are right, maybe sending WM_SIZE is enough?
LRESULT result = pC1->SendMessage(WM_SIZE, (WPARAM)SIZE_MINIMIZED, (LPARAM)0);
But somehow I doubt it.
Maybe you have to search MSDN and/or Codeproject to find an examle for hiding a dialog from the outside.
"My opinions may have changed, but not the fact that I am right."
Found in the sig of Herbert Kaminski
|
|
|
|
|
Guess that will handle it
WM_SHOWWINDOW
"The WM_SHOWWINDOW message is sent to a window when the window is about to be hidden or shown.
WM_SHOWWINDOW
fShow = (BOOL) wParam; // show/hide flag
fnStatus = (int) lParam; // status flag
Parameters
fShow
Value of wParam. Specifies whether a window is being shown. It is TRUE if the window is being shown or FALSE if the window is being hidden. "
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
I am under the impression that neither WM_SIZE nor WM_SHOWINDOW are actually showing or hinding the window. Instead, they notify the window (its WindowProc) that it is about to be shown or hidden.
I think calling CWnd::ShowWindow() would be the way to go: It does not need more than SendMessage() needs (a pointer to the window class), but is much less work.
This would then probably result in WM_SIZE and/or WM_SHOWWINDOW sent to the window.
"My opinions may have changed, but not the fact that I am right."
Found in the sig of Herbert Kaminski
|
|
|
|
|
Hi,
I'm currently developping an activex in one session of visual c++ and so I often add some new methods, events, properties.
I build an exe project (to test it )in an other session (project) where I use the activex, and then use a Wrapper class to manage to access the activex methods...
I don't know how to upgrade the version of activex wrapper (add new added method in activex) to have the recent wrapper class version to be able to access new methods when I had some ni the activex project.
can anyone help me ?
Thank you so.
VinZ
|
|
|
|
|
Describe the wrapper. What is wrong with "#import", why do you need your own?
|
|
|
|
|
Currently, I use the visual context to "insert" an acitvex control in my project, in class wizard visual build automatically the wrapper that make me have access to the methods and properties of my activex, without need to insert it as a part of the project.
when I had new methods and properties in the activex (other project) I don't, the wrapper in the project that uses the activex doesn't include new methods and properties...and so I have to suppress it and recreate....
Thanks for your help.
VinZ
|
|
|
|
|
VinZ wrote:
Currently, I use the visual context to "insert" an acitvex control in my project, in class wizard visual build automatically the wrapper that make me have access to the methods and properties of my activex, without need to insert it as a part of the project.
when I had new methods and properties in the activex (other project) I don't, the wrapper in the project that uses the activex doesn't include new methods and properties...and so I have to suppress it and recreate....
The easiest way that I have found to upgrade the MS generated wrappers is to create a throw-away MFC application EXE project and insert the ActiveX control as you described. Then take the new generated wrapper cpp/h files from the throw-away project directory and copy them into your development project replacing the previous version of the files. You then have access to the new methods, events, etc. without dropping all references and re-inserting.
The bad thing is that you have to create a new throw-away project each time a new version of the ActiveX component that contains new methods, events, etc. is created or released. However, this technique is much faster than suppressing and recreating.
Roger Stewart
"I Owe, I Owe, it's off to work I go..."
|
|
|
|
|
Thanks, I going to do that, it seems to be the best time saving solution to find.
Bye.
VinZ
|
|
|
|
|
dynamically use ActiveX/COM will not cause your case.
"dynamically" means 2 ideas:
1. use #import, but u have to re-compile if need upgrad.
2. use LoadLibraryEx with Invoke method, u even don't need to re-compile ur exe to upgrad.
but, in both cases, use COM is better, do not use ActiveX.
ActiveX is not really "very standard" as COM is.
idea 2 needs much more knowleges than idea 1.
if insist using wrapper classes, delete all of them if need upgrad, new classes will be re-generated when add the control.
includeh10
|
|
|
|
|
Thank you for those lighting advises...
But a question: maybe it is more difficult to build a com project than an activeX one, I mean in time and volume of code to produce ?
I don't have a lot of time to supply a prototype of the implementation of my project, even if I agree with you concerning the better quality of a com project.
Thanks for all.
VinZ
|
|
|
|
|
in ur case, the COM (full control) is just a little bit harder than ACtiveX - it is worth to spend few hrs to learn.
but dynamical methods are quite trick: microsoft calls them "language indepandent", actually just can be used in VB and C++ (much more trick if in java).
once our lovely C++ downs toword VB, it becomes worse, that is why advanced c++ programmers don't like COM at all even they have to use and may be experts on COM.
includeh10
|
|
|
|
|
???
|
|
|
|
|
I realy thank you for advises. and so I don't know if for my actual project (it's a shame) I will use the com techno, but maybe sooner in an other project for which I will get some more time to do.
I have, if you have time to answer me, a little more question. What do you think about .net services (web services) compared to the com techno to allow access to several resources through the network ?
VinZ
|
|
|
|
|
Hi,
I have developed a dialog based application under W2k using Visual C++ 6.0 to print a table. In W2k and Windows XP professional works well, but it doesn't work in W9x & WMe. I'm using MM_ISOTROPIC map mode because I need to print some graphics. In W9x and WMe, when I print, I haven't obtain any results. I thought, "I'm doing something wrong", so I generate a SDI with Print Preview option and I wrote inside OnDraw(...):
....
pDC->SetMapMode(MM_ISOTROPIC);
pDC->Rectangle(100,-100,300,-300);
then I executed the program, I choose Print Preview from File menu. The Print Preview showed me a sheet with a rectangle. I printed this and i obtained the same results. Everything its Ok under W2k and WXP, but in W9x and WMe it's a disaster.
Can somebody help me!!!!!
Thanks.
Daniel Remedi
ARGENTINA
dremedi@hotmail.com
or
dremedi@cheeseinteractive.com.ar
|
|
|
|
|
What does your print code look like?
Where is your:
cdc.StartDoc(pinfo);
cdc.StartPage();
...
cdc.EndPage();
cdc.EndDoc();
Are you attaching your DC properly? Are you rendering correctly?
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
Could someone please help! I dont seem to be able to find anywhere that explains how to use callback functions with in MFC.
Being an MFC novice I'm a bit stuck. I get the idea behind it, but I dont understand how to code it. How are static functions used in callbacks?
Would appreciate some idiot-proof help from someone who understands it all.
Thanks,
|
|
|
|
|
How are static functions used in callbacks?
whole process of MFC is exactly as Win32 story.
key part to develop a lib as MFC is not "How are static functions used in callbacks", but how are classes connected to a cllback function (it is not a class member even it can be static function of a class).
view Windows' creation if interested - pass class pointer as parameter, otherwise just use MFC as it is - callbacks are hidden behind somewhere.
includeh10
|
|
|
|
|
What I'm trying to do is to read in a MIDI file (That works no probs), then during the playback go through each instrument, and create alist of events to be outputted, then call back to a function inside my View class to output the messages. However code that works on the same lines uses callback functions they have written themselves, and I can't seem to find anywhere that really explains whats going on in the code. I've tried writing static functions that deal with the callback, but since I'm not too sure whats going on I get errors.
Really could do with an article that explains how to do the call back syntax.
Does anyone know where I could find one. Can't find much in MSDN.
|
|
|
|
|
For MFC's AfxBeginThread() I recommend a global function.
AfxBeginThread() :: UINT theCallBackFunc(LPVOID lParam);
For C++ thread callback I recommend a static function.
_beginthreadex() :: static unsigned __stdcall theCallback(void *pParam);
Kuphryn
|
|
|
|
|
hi,
I have a formview (in splitter window)
after OnInitialUpdate()
i do a load bitmap, but the size of bitmap is greater than the form
i like to draw scrollbars of the formview
m_static_picture.GetWindowRect(&rect); //beholder of bitmap
GetWindowRect(&rectWindow);
if(rectWindow.bottom < rect.bottom)
{
//to small a scroll bar is needed
int cx = rectWindow.Width();
int cy = rectWindow.Height();
int iDif = rect.bottom - rectWindow.bottom;
cy += iDif;
ScreenToClient(&rectWindow);
SetWindowPos(this, 0, 0, cx, cy, SWP_NOMOVE);
}
i wonder why this code is not working (i see no scollbar)
even if after adding
SCROLLINFO si;
GetScrollInfo(SB_VERT,&si);
si.nMin = 0;
si.nPage = rectWindow.Height();
si.nMax = cy;
si.nPos = 0;
si.nTrackPos = 0;
si.fMask = SIF_ALL;
si.cbSize = sizeof(si);
SetScrollInfo(SB_VERT, &si, TRUE);
ShowScrollBar(SB_VERT, TRUE);
give no result,
any ideas??
dan oudijk
|
|
|
|
|
after you loaded your bmp, if the image dimesion of this bmp is imageWidth x imageHeight, try the following code:
CSize sizeTotal;
sizeTotal.cx = imageWidth;
sizeTotal.cy = imageHeight;
SetScrollSizes(MM_TEXT, sizeTotal);
|
|
|
|
|
Hola,
I'm wondering whether any of you gurus out there have ever come across this problem before.
Our company develops and have been using this data processing software for a while now. However, last week when a sister company tried to run the software, it bombed.
After much testing, we found that the bug was due to the Rich Edit control embeded in a particular view.
Now this is the weired bit. We have used the rich edit control (via loading the RichEd32.dll) with success, but this bug occurs when we try to use the control via the Rich Edit control provided by Visual Studio.
It ran fine on our side, but crashes on there machine! Yes I know of the 'works on my system' headache, but this really is puzzling! :<
Anyone know of any problems or specific requirements why this would happen specifically to the riched control placed on the dialog via the resource editor?
Using VC6. Compiled on Win2k.
one ring to rule them all
|
|
|
|