|
I removed the ES_left and ES_MULTILINE, and now it works as a ListBox.
As far as the (HMENU) cast goes, I'm not sure what the proper way to do it is. And I'm not sure why the Listbox works now in detail.
|
|
|
|
|
My theory:
ES_LEFT resolves to 0 and ES_MULTILINE resolves to 4 . When you were using a combobox, a value of 4 was the same as CBS_DROPDOWNLIST|CBS_SIMPLE . When you were using a listbox, a value of 4 was the same as LBS_NOREDRAW . So, the items were likely being added to the listbox but since redraw was turned off, you could not see them.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
OOOOh
I was thinking yesterday, I know the names are being added, but it looks like the listbox is not being repainted. I looked into the WM_DRAWITEM and WM_PAINT, and checked all the Proc's, they were firing, so finally I changed the Listbox to a ComboBox and it worked.
Thanks a million times over for the help David. I would of never figured it out by myself.
I changed the ES_LEFT and ES_MULTILINE before I tried the SendDlgItemMessage.
|
|
|
|
|
Hi friend,
I am working with Client Server windows(VC++ and MFC) project which is connceted via TCP IP concept. it is working fine with in a organization(LAN).but my requierment, server in one location, client in another location.
How to connect Client and Server.
Can i use virualiztion concept?
I do not know how to start.
Do you have any virualiztion concept reference website link?
Please teach me.
|
|
|
|
|
If you're using TCP/IP already, your application can already support separate server and client machines/locations. Your question doesn't exactly make sense.
|
|
|
|
|
No what he means is that it does not work across internet, it's because of firewall/router/port redirection going on between client and server.
However, I don't have time to help on this, it depends on too much parameter, device, and network policy of his company.
What I can advice is to pick a book on how tcp/ip work, and basic networking class that cover firewall, port redirection, and public/private IP.
|
|
|
|
|
My five.
He should contact the network administrators on the client and server sides.
|
|
|
|
|
Wouldn't you think it would have been more helpful to answer the OP instead of posting all this for me?
|
|
|
|
|
D.Manivelan wrote: Do you have any virualiztion concept reference
A pretty efficient concept is to switch off your antivrus software, open the SPAM folder in your email client, and open every single mail and URLs provided therein. That should virualize your machine nicely.
Or did you mean virtualization? 
|
|
|
|
|
I want to open the child application form outside my parent form. I am using MDI application,
The way the application currently opening a child form is pretty simple, straight out from the MFC library.
AddDocTemplate( new CMultiDocTemplate( IDR_SCRIBTYPE,
RUNTIME_CLASS( CScribDoc ),
RUNTIME_CLASS( CMDIChildWnd ),
RUNTIME_CLASS( CScribView ) ) );
Thanks,
Ash
asdasdadadasd
|
|
|
|
|
What's the question? There's nothing that resembles a question in there. Multiple monitor support is managed by the operating system, what exactly do you want to be able to do?
|
|
|
|
|
Sorry if I couldnot make you clear. Question is very simple, currently in our application
we are not able to drag the child window outside the main frame window. If I move the main frame window my child window is also moving along with it. So I need to move my child window free out of main window
Hope I make it more clear than earlier. Waiting for your reply
asdasdadadasd
|
|
|
|
|
You can't do that with a CView derived class, without heavy modification of the MFC code.
It's easier to create a non-CView window and write your own linkages to the document class to manage creation and destruction.
|
|
|
|
|
Sorry if I couldnot make you clear. Question is very simple, currently in our application
we are not able to drag the child window outside the main frame window. If I move the main frame window my child window is also moving along with it. So I need to move my child window free out of main window
Hope I make it more clear than earlier. Waiting for your reply.
asdasdadadasd
|
|
|
|
|
I understood you.
MFC doesn't support what you're doing.
You'll have to write that yourself.
You might base this on the docking technology introduced in 2008/2010.
|
|
|
|
|
In MDI application we cannot move single window to another monitor.
I think if you create view using SDI method,then you can move that particular view to next monitor.
Anu
|
|
|
|
|
I Have a derived class Ownerdraw CListboxAdv derived from Clistbox On a CDialog
It handles records with multiple fields
View field by 'formatted" string
Reads/Writes to file
reads/writes to clip
in place edit of fields or record
Sorts records by any field/combination of fields
Can View any Field (Listbox columnar) or switch
to std View with fields in neat columnar format
Can search for records by any field or
combination of fields
Etc
Bascally it can eat any file with fields in each
record seperated by "Delimiter" char
Simply I'm trying to add a toolbar to the blasted thing
Tried adding toolbar directly to Clistbox - Always comes in client area and can't adjust "Listbox" not to update right over it.
Tried tinkering with ondraw to ignore that area -That worked until the window was scrolled. It also mucked the record selection on mouse down.
Gave up on that line
created the toolbar on the parent -- Tried subclassing toolbar to the listbox -- again failure
Seems you can't subclass to a window that exists or is on permanent map
Now I could easily intercept/push the messages from the parent to the derived class via parents WndProc -- But then
its not a stand-alone class UGLY
So now I'm looking for a way to basically derive a class from "something" comprising 2 controls a listbox and a toolbar
And there I'm lost
Any help/links/examples will be appreciated
|
|
|
|
|
A basic construction could be designed as following
class CYourListFrame : public CFrameWnd
{
CYourToolBarChild m_cYourToolBar;
CYourListCtrlChild m_cYourListCtrl;
public:
protected:
};
Then - just place such a frame onto a dialog or view surface...
They sought it with thimbles, they sought it with care;
They pursued it with forks and hope;
They threatened its life with a railway-share;
They charmed it with smiles and soap.
|
|
|
|
|
Thanx -- I thought it might work that way -- still seeking a more elegant solution though
Trying not to create to many layers of classes between parent and the meat operations of the derived listbox
MFC does it Re Combobox (Listcontrol+edit) and they probably did it that way
|
|
|
|
|
A bit stuck on placing frame on dialog
Added Cframewnd LBA Via class wizard to project
Edited in the following
LBA.h
pragma once
#include "listboxadv.h"
#include "afxwin.h"
#include "MediaPlayer.h"
class LBA : public CFrameWnd
{
DECLARE_DYNCREATE(LBA)
public:
LBA();
virtual ~LBA();
protected:
DECLARE_MESSAGE_MAP()
public:
CToolBar m_toolbar;
ListBoxAdv m_list;
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnSize(UINT nType, int cx, int cy);
CComboBox m_combobox;
CEdit m_searchfor;
CEdit m_sortstring;
};
LBA.cpp
/ LBA.cpp : implementation file
#include "stdafx.h"
#include "MediaPlayer.h"
#include "LBA.h"
IMPLEMENT_DYNCREATE(LBA, CFrameWnd)
LBA::LBA()
{
}
LBA::~LBA()
{
if(IsWindow(m_toolbar.GetSafeHwnd()))m_toolbar.DestroyWindow();
if(IsWindow(m_list.GetSafeHwnd()))m_list.DestroyWindow();
if(IsWindow(m_searchfor.GetSafeHwnd()))m_searchfor.DestroyWindow();
if(IsWindow(m_combobox.GetSafeHwnd()))m_combobox.DestroyWindow();
if(IsWindow(m_sortstring.GetSafeHwnd()))m_sortstring.DestroyWindow();
}
BEGIN_MESSAGE_MAP(LBA, CFrameWnd)
ON_WM_CREATE()
ON_WM_SIZE()
END_MESSAGE_MAP()
int LBA::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
CRect rec;
int i;
.... all the toolbar code
Then used dialog editor -- added Picturebox as a placeholder,and control variable m_ctrllist
Edited dialog header so
LBA m_ctrllist
And ran the code
resized m_ctrllist in dialog::OnInitDialog --LBA::OnSize was called worked fine
BUT -- Had a break in LBA::OnCreate it was never tripped
and dialog shows a picture box (as you would expect since OnCreate was never invoked)
So tried deleting the picturebox and added to Dialog::OnCreate() the following
CRect rec;
m_ctrllist.Create(_T("FrameWnd"),NULL,WS_VISIBLE|WS_CHILD,rec,this,NULL,0);
Heap errors up the yazoo
I'm Missing something very basic
|
|
|
|
|
OnCreate() is not called for controls created by dialog templates. So overriding LBA::OnCreate() does not help here.
|
|
|
|
|
Yes I thought it was a hail mary.
The first answer in this tree was Just "place on dialog or view surface"
and I'm betting adding m_ctrllist.OnCreate(... to OnInitialDialog isn't the right way either
No it isn't --So I'm stumped
modified 8-Feb-12 8:57am.
|
|
|
|
|
Fallen123 wrote: The first answer in this tree was Just "place on dialog or view surface"
That should be best way.
May be this notes are useful:
You added a picture box as placeholder. I would use a simple control (e.g. static text) as placeholder. This should have the same size as your overlayed bar and be hidden by default. The only reason to add a member var for this control would be to get its size. Don't touch this var/control elsewhere (especially, don't try to delete it).
An overlayed control should be created on the heap from within OnInitDialog() (you tried to use a member var):
CMyBar* m_pBar;
m_pBar = new CMyBar;
m_pBar->Create(this, WS_CHILD, ...);
You may also check if you can implement your bar using a CDialogBar derived class. This is perfect for such tasks and provides auto delete.
|
|
|
|
|
Nope
m_ptrlist=new LBA;
rec.left=7;rec.right=1607;rec.top=70;rec.bottom=752;
if(!m_ptrlist->Create(_T("LBA"),NULL,WS_VISIBLE|WS_CHILD,rec,this))
{
MessageBox(_T("Failed"));
long k=GetLastError();
k=k;
failed kicks with no error return
changed windowclassname to null -- It created sucessfully
But throwing exceptions -- Will have to wade through
modified 8-Feb-12 10:15am.
|
|
|
|
|
::GetLastError() is only set by API functions, not by MFC functions.
You may set a breakpoint and trace into the Create() function to check where it fails.
You are passing 'LBA' as class name. I'm not really sure, but I think the name must be registered for frame windows.
Think about the CDialogBar option. It uses a normal dialog template. However, if you want toolbar like symbol buttons, they must be added to the template.
|
|
|
|