|
In the dialog design view, right click on the dialog and select properties, there are checkbox where you can remove the titlebar.
MSN Messenger.
prakashnadar@msn.com
|
|
|
|
|
Hello,
That chap is asking about SDI Application and not Dialog based application...dont confuse him....
|
|
|
|
|
Sorry for the wrong answer before here what you need to do, in the mainframe window, add the virtual funtion for PreCreateWindow(..) if it is already there then in that method the paramter CREATESTRUCT has a member variable called dwExStyle. if you modify the style here you will get the corresponding style of your window.
MSN Messenger.
prakashnadar@msn.com
|
|
|
|
|
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
cs.style = WS_DLGFRAME | ~WS_BORDER | WS_OVERLAPPED ;
cs.hMenu = NULL;
// Create a window without min/max buttons or sizable border
// cs.style = WS_OVERLAPPED ;
return CFrameWnd::PreCreateWindow(cs);
}
|
|
|
|
|
Balkrishna Talele wrote:
cs.style = WS_DLGFRAME | ~WS_BORDER | WS_OVERLAPPED ;
most of the bits will be set.
MSN Messenger.
prakashnadar@msn.com
|
|
|
|
|
I am using MFC and am having a bit of a problem with accessing a control in a generic class I created. I am using FormView as it has both dialog and menus in it. This may be a simple problem, but I am still new to MFC and I can't seem to figure it out.
I created a formview class with an edit box, then subclassed the edit box so I could trap the enter key. Now, I need to access a list box on the form from a generic class that I created. I know I need to create a pointer to the formview class, but I am unsure as to how to do this or how to access the list box control variable. I tried using getparent() as in:
(CFormView*)GetParentOwner()->GetDlgItemText(IDD_ITEMSLIST, model);
and could not access the control. I get errors saying the control is an undeclared variable. Any help or a web site that explains this would be greatly appreciated.
Roger
|
|
|
|
|
MFC creates automatic class hiearchies, and has a set of functions that allow you to traverse and manipuate the hiearchy.
Consider the following example:
1. An application object is created
2. The application object creates and initializes it's main window (usually a frame window), and saves this into m_pMainWnd pointer on the CWinApp -class
3. The frame window, if it is an SDI frame, first creates a set of possible bars (toolbar, statusbar, menubar, rebar etc). Then it creates the view context, and places itself as a parent of the view.
This having said, you can find the form view class object by asking the frame window to enumerate through it's child windows. Alternatively, you can use GetDlgCtrl with the ID of the child window (by default, AFX_IDW_PANE_FIRST , unless you have given it a different ID while creating it). Here is what MSDN says about the function call:
You can use the GetDlgItem function with any parent-child window pair, not just with dialog boxes. As long as the hDlg parameter specifies a parent window and the child window has a unique identifier (as specified by the hMenu parameter in the CreateWindow or CreateWindowEx function that created the child window), GetDlgItem returns a valid handle to the child window
As you can see, the MFC implementation of this function always returns a CWnd* to the requested object. Now, when you ask for the view class pointer, you can cast it down from CWnd* to CFormView* . Again, by using this pointer, you can use GetDlgCtrl to request for a pointer into the CListCtrl object.
The reason why your code call fails is that although the form view is a child of the frame window, the list box control is NOT. It is the child of the form view. You need to use a pointer to the form view class instance if you wish to request for the listbox.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
I don't suppose you could show me how to do this. I tried using CFormView* pDiag = (CFormView*)GetParentView()->GetDlgItem(IDC_DATA),
but it still does not give me access to my ListBox and I cannot insert data into it since I cannot access the control variable on my viewform. I know I am being a bit dense here, but this is still new to me. If I was dealing with just a console based Application I probably would not have as much trouble, but I don't really know how to do this in MFC and the explanations I have read so far have not really shed any light on how I need to do this other than I now know I need to create a pointer which is what I am having trouble with at the moment.
Roger
|
|
|
|
|
Hello Friends !!
i am developing a sdi application..on that i am using two CListView Classes and swithching between them when needed ..
i want to display a dialog box while one of the two view is selected ..i don't know where to write the code .. i tried using OnviewActivate handler it's not working ..so if any body knows pls help to which handler to choose ,, and also
pls explain me in which order message handlers are called ..
Thanks in advance
"The thought that Guids ur intelligence in more important than how intelligent u r "
|
|
|
|
|
Hello !
First I need to ask you the simplest of all questions: what do you use to switch between the views ? If it is a button or anything that accepts messages, write a handler for it and create/show a modeless dialog box when a click on this item designates that the "view with the dialog" should be shown. When a click on the item occurs that says "show the other view", you command the modeless dialog to either hide itself or destroy it.
The message order is dependant on the phase of your window object. Usually, different events on the Windows OS can be grouped by the messages sent. The only reasonable way to track the message order on a window is to use Microsoft Spy++, or a similar message hooking program.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Thanks a Lot i got it
"The thought that Guids ur intelligence in more important than how intelligent u r "
|
|
|
|
|
Can anybody tell me how can i call the member function of one class through the other class using Send/Post Message?
Vidya
|
|
|
|
|
2 ways that I am aware of.
1 make the member function static and call it as CMYCLASS::Memberfunction(...) on the message handler for the posted message.
2. In the message paramneter cast the this pointer ta a long and pass it with the message. Cast it back to the class in the message handler. I think this breaks some of the concepts of proper OO
tcss
|
|
|
|
|
Hello,
In stdafx.h put the following stuff
#define WM_TALELE_CLICK 3000
..
..
..
---------------------------------------------------------------------------
then in XYZ.CPP put following stuff
.
GetParent()->PostMessage(WM_TALELE_CLICK,m_id,0); //e.g m_id is paramater to be passed
.
.
.
---------------------------------------------------------------------------
Implementation.h
void OnTaleleBtnClick(WPARAM wp, LPARAM lp);
---------------------------------------------------------------------------
then in Implementation.cpp
BEGIN_MESSAGE_MAP(CIMP, CXyz)
ON_MESSAGE(WM_STATICBTN_CLICK, OnTaleleBtnClick)
END_MESSAGE_MAP()
void CIMPL::OnTaleleBtnClick(WPARAM wp, LPARAM lp) //wp ==m_nID
{
switch(wp)
{
case NEWS_BTN:
::MessageBox(0,"Newsx btn","News",0); break;
case ALERT_BTN:
::MessageBox(0,"Alert btn","News",0); break;
default : break;
}
}
---------------------------------------------------------------------------
you are done..... I had actually implemented...and executed successfully, dear vidya
regards
Balkrishna Talele
|
|
|
|
|
Technically, you can't use SendMessage() or PostMessage() to call functions. The message handler can, however.
#define PM_STARTPROC 123
BEGIN_MESSAGE_MAP(CMyDialog, CDialog)
ON_MESSAGE(PM_STARTPROC, OnStart)
END_MESSAGE_MAP()
BOOL CMyDialog::OnInitDialog()
{
CDialog::OnInitDialog();
PostMessage(PM_STARTPROC);
return TRUE;
}
LRESULT CMyDialog::OnStart( WPARAM wParam, LPARAM lParam )
{
return (0);
}
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Hey
I have an icon. I would like to insert the icon into a toolbar.How to do?
Thanks
JP
|
|
|
|
|
Insert an icon means to insert a new toolbar button if so use TB_INSERTBUTTON message to do it.
MSN Messenger.
prakashnadar@msn.com
|
|
|
|
|
Use...
TB_INSERTBUTTON
AddButton(...);
which has following paramater
HRESULT AddButtons(
int nButtons, // number of buttons
LPMMCBUTTON lpButtons // pointer to an MMCBUTTON structure
);
LPMMCBUTTON .....
typedef struct _MMCBUTTON
{
int nBitmap ;
int idCommand;
BYTE fsState;
BYTE fsType;
LPOLESTR lpButtonText;
LPOLESTR lpTooltipText;
} MMCBUTTON;
typedef MMCBUTTON* LPMMCBUTTON;
regards
Balkrishna Talele
|
|
|
|
|
access violation 0xC0000005 when calling func in dll
hi,guys:
ask for your kind help. thanks in advance.
typedef int (WINAPI * _DLL_FOO)(int, char **, int, char **, LPDCL, LPUSERFUNCTIONS);
......
_DLL_FOO m_PFoo;
......
LoadLibrary successfully。
m_PFoo = (_DLL_FOO)GetProcAddress(m_hDll, "Foo"); //successfully
326: retval = (*m_PFoo)(infc, infv, exfc, exfv, m_lpDCL, m_lpUserFunctions);
004440D2 mov esi,esp
004440D4 mov eax,dword ptr [ebp-4]
004440D7 mov ecx,dword ptr [eax+0B8h]
004440DD push ecx
004440DE mov edx,dword ptr [ebp-4]
004440E1 mov eax,dword ptr [edx+0BCh]
004440E7 push eax
004440E8 mov ecx,dword ptr [ebp-10h]
004440EB push ecx
004440EC mov edx,dword ptr [ebp-8]
004440EF push edx
004440F0 mov eax,dword ptr [ebp-14h]
004440F3 push eax
004440F4 mov ecx,dword ptr [ebp-0Ch]
004440F7 push ecx
004440F8 mov edx,dword ptr [ebp-4]
004440FB call dword ptr [edx+0B0h] <== here access violation 0xC0000005
00444101 cmp esi,esp
00444103 call __chkesp (00451fa0)
00444108 mov dword ptr [ebp-11Ch],eax
327:
when failure edx+0B0h == 0x009796b0
009796b0:B0 D4 11 02 CD CD CD CD 38 7B 14 00 78 A4 14 00 00 00 11 02 CD CD CD CD 38 7B 14 00 78 A4 14 00
The address of func m_PFoo is 0x0211D4B0, it's all right.
What 's the problem with my program and how to fix it ?
Thank you very much !
|
|
|
|
|
I don't think you need that pointer to call the function since it's already a pointer, so 326 becomes:
retval = (m_PFoo)(infc, infv, exfc, exfv, m_lpDCL, m_lpUserFunctions);
|
|
|
|
|
Hello,
I have some questions about declare functions, when I declare a function,
what is the different between
const char* f();
and
char* const f();
Thank for your help!
Nachi
|
|
|
|
|
|
I am using a message box in my application. When it appears and I click OK, it hangs my application. I am running in debug mode, and I have to stop debugging to recover.
I would like to have a modeless message box where the user does NOT need to press any buttons in response to the message box. All the message box would do is notify the user that some event has occured. Can some one help me with such a message box?
Jerry
|
|
|
|
|
Not possibe to hae modeless message box, one thing you can do is press F5 and put a breakpoint after the messagebox.
MSN Messenger.
prakashnadar@msn.com
|
|
|
|
|
Indeed, It is Possible,
You might have surfed CP..then you must have seen this stuff
"Balloon Help as a non-modal replacement for MessageBox() " by Shog 9
Just click this
URL http://www.codeproject.com/miscctrl/balloonhelp.asp?target=Balloon
regards
Balkrishna Talele
|
|
|
|
|