|
Hello,
In my MDI project, I want to make the child CFormView dialog form unmoveable by the user. When I went to the dialog resources properties I saw that the titlebar property was already unchecked. However it still shows up with the blue caption bar and can be moved around inside the MDI frame. Is there some code I should use to accomplish this? I put in the precreate function of the child frame:
//cs.dwExStyle = WS_EX_DLGMODALFRAME ;
but it didnt seem to do anything different from when the line is commented out...the title bar that moves the window around is still there.....
Thanks very much for your help!
|
|
|
|
|
I got it! Thanks. I had to use cs.style = ~WS_CAPTION
Hurray!
Now to get rid of the Child scrollbars....
~WS_VSCROLL isnt doing it....
|
|
|
|
|
(I asked this in the COM forum, thought this one might get a responce sooner, sorry)
Hi, i appologise if this question has been asked be before but its got me stummped, i need to overwrite one of the function pointers in a COM interface, i dont have access to the COM source nor can i modify it, i simply need to overwrite the pointer, i keep getting access violations.??
Goes something like this.
IInterface * MyInterface= MakeInterface();
unsigned * vTbl = ((unsigned**)MyInterface)[0];
vTbl[THE_FUNCTION_INDEX] = NewFunction;
Hope that gives you the idea of what i want, kinda like hooking a COM interface, i have yet to find an easy/any soloution like simply overwriting the functions pointer.
|
|
|
|
|
Hello
I have a simple app, a CMainFrame with some CDialog derived based members, custom classes. One of the dialogs has a CComboBox. I want the main window to be informed when this drop down selection is changed. I have tried adding a handler in the main window, no luck. I have tried PostMessage, SendMessage, and checking for the message in the main window using 'DefWindowProc' and using ON_MESSAGE maps. Nothing. If I add a handler to the dialog class it does detect the selection change, but this is no use to me, as I want the main window to be able to react also.
I am sure that what I am doing is so simple, so useful and so obvious that there is an easy way that I don't know about. Can anyone help?
Cheers,
solosnake
|
|
|
|
|
If you're launching the dialogs as modals in response of some menu action of mainframe you may block the main thread's message queue.
Try launching some worker thread and communicate to the worker, or launch the dialogs as modelesses.
rechi
|
|
|
|
|
No, they are not modals but continously displayed windows.
Cheers,
solosnake
|
|
|
|
|
the function "DoDataExchange" can be used to update variables in your main CMainFrame. This is called automatically on Exit or you can do it yourself.
I am not sure if this would work but you could use a handler to the dialogue class to detect a change if it is detected then call DoDataExchange to update your CMainFrame
Eric
|
|
|
|
|
OK , but the problem is that the combo box represent the user choosing an item in a internally maintained array of items. The main frame holds this array. When the user changes the combo box I want the main window to be notified so that it can change the required values that the dialog displays. The dialog is never closed, so data must be updated as a response. Thanks for the ideas, but I need some more?
Cheers,
solosnake
|
|
|
|
|
You may try to have in the dialog class a member that is a reference or a pointer to the array in the CMainFrame class. Thus you would be acessing those members directly.
Best regards,
Alexandru Savescu
|
|
|
|
|
Hello
Thanks to everyone who replied. I have solved the problem, which was partially of my own making anyway. I am now registering a new message, and sending it from the deep child window. The difference, which is not well documented in the help, is that SendMessage only sends to its own message queue. By using AfxGetMainWnd()->SendMessage I can get a message back out to the upper level windows. I have added a custon ON_MESSAGE handler, and everything is working fine. Thanks for all suggestions, and I hope my problem and solution can help someone else perhaps.
Cheers!
solosnake
|
|
|
|
|
Hi! I'm trying to create a static box into a FormView derived class, i tryed like this:
void CUnits_Sold::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
{
//This lines had the propose of initialize the pointer, i could not find another way to do it!
CStatic estatico;
CStatic* estatico2;
estatico2=&estatico;
estatico2->Create("Olá", WS_CHILD|WS_VISIBLE|SS_NOPREFIX|SS_LEFTNOWORDWRAP, CRect(30, 30, 100, 100), this);
estatico2->ShowWindow(SW_SHOW);
}
Anyone have a clue why this isn't working?
Thank you
|
|
|
|
|
|
Hi,
I'm trying to port some unix code over to visual c++. Can anyone tell me if there is an equivalent to the unix types sema_t and key_t.
Cheers
Steevie
|
|
|
|
|
You just might want to be a little more specific. Otherwise I could answer like this;
Sure, just typedef int sema_t; and so on. Please explain what these types are used for, and how they are used, and I'm sure you'll get an intelligent answer.
Note however if you're targetting Visual C++ you might get answers referring to the worst "designed" class library of all times (MFC). Perhaps you should initially limit yourself to Win32? Just an idea.
|
|
|
|
|
sema_t is a UNIX POSIX semaphore structure defined as follows
typedef struct {
pthread_mutex_t lock;
pthread_cond_t cond;
int count;
} sema_t;
Then you can define for WIN32
typedef HANDLE pthread_mutex_t;
typedef struct pthread_cond_t {
int waiters_;
CRITICAL_SECTION waiters_lock_;
HANDLE sema_;
HANDLE waiters_done_;
size_t was_broadcast_;
} pthread_cond_t;
|
|
|
|
|
key_t is defined as follows
typedef int key_t
|
|
|
|
|
Hi,
I am trying to make my client area view based on CFOrmView fit exactly into the client area of the parent and resize along with it. ANy ideas would be appreciated. Thanks
|
|
|
|
|
Why not simply rewrite it to fit the client area???
|
|
|
|
|
I found Brian Harts sample code for centering an MDI Child in the MainFrame window and modified it so it works wonderfully now (that part anyways).
Thanks for the response. I'm quite new at this stuff so I wouldnt have known the slightest about how to rewrite it....
|
|
|
|
|
Hi ,
I spawned a modal dialog form from an SDI project and used SetWindowPos to position it and size it the same as the client area of the SDI.. Two odd things happened. First the GetWindowRect function returned funky results (wrong sizing as a result). More seriously, when I dismissed the modal dialog from the OK button or the system cross on the right hand side, I got a debug assert!
However, the same code works great if I use it for a modeless spawned dialog!
ANy ideas why and how to get past the error?
|
|
|
|
|
|
Great! thanks!
ANy clue why the onOk and exit gives me the debug assert?
Thank you so much for the hint.
|
|
|
|
|
|
Hello,
I am trying to access the size of my MainFrame window in an MDI MFC project from the OnSize function. I am trying to fit the child window into the frame when resizing happens and I realise this isnt quite the way since the child gets created only once, but I thought at least what should happen is that the child should fit the frame at startup. In the Childfrm.ppp I wrote:
BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
if( !CMDIChildWnd::PreCreateWindow(cs) )
return FALSE;
cs.x=0;
cs.y=0;
cs.cx=CMainFrame::m_FrameWidth;
cs.cy=CMainFrame::m_FrameHeight;
return TRUE;
}
I got the compile error that CMainFrame was not a class or namespace.
Please help!!!!!
|
|
|
|
|
Your using the CMainFrame class name as a namespace in this case. What you need to do is:
#include "mainfrm.h"
CWnd *pWnd = AfxGetApp()->m_pMainWnd ;
CMainFrame *pMF = static_cast < CMainFrame* > (pWnd) ;
cs.cx = pMF->m_FrameWidth ;
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|