|
I'm trying to build an application that has multiple(child) windows that are identical, but they are in different states of operation.
Each of these windows really is just a lot of the common controls.
Is this the correct approach
1 base CWnd
then Create a new Class based on CWnd and place my controls on a new CWnd owned by this class, then attach it the the base CWnd
or is there a better approach?
I'm really struggling with what I would have thought was quite easy or is it not??
I can't seem to find many articles etc on this kind of thing
I've already built the application using lots of ATL components, and VB to provide the UI.
The UI currently consists of 8 frames containing Progress bar for current status, and details of the current modem connection speed, the file that is being copied and the state that the program(thread) is in.
UI for each cell looks kinda like this and there are 8 of them (4cols x2 rows).
<br />
Store: [ readonly] Tel: [readonly] Bps:[readonly]<br />
Start: [readonly starttime] IP: [readonly] Err:[readonly]<br />
Status: [readonly]<br />
[Caption showing the current state of the program] [%complete as text]<br />
File: [filename readonly] Bytes: [x of y]<br />
[..............progress bar..............].br />
[Text box for messages to the user]<br />
Sorry for the loss of formatting.
|
|
|
|
|
It's hard to judge without more details. One alternative might be to use MDI app with CFormView-based windows. Another might be to have your app create multiple modeless dialogs.
Maybe if you described what you're trying to do in more detail, and what (if any) requirements there are, you would get better answers.
Best wishes,
Hans
|
|
|
|
|
sorry.. i'll add more detail to the original question.
|
|
|
|
|
hello
actually i m working on one project while running that programme in MFC it is giving error "cannot open mfc42u.lib".......what should i do.....
Regds
vipin
|
|
|
|
|
The error means that your project configuration is trying to link with MFC's Unicode library - that's what the "u" in mfc42u.lib stands for.
There might be an ANSI configuration for your project - to check, go to Build | Set Active Configuration. See if there is a "<project> - Win32 Debug" listed. If there is, select it, and do a rebuild all. This should get rid of the error.
If there is no ANSI configuration, you can either create one (it's not that hard), or you can install the MFC Unicode libraries on your machine (note that Unicode builds will only work on NT-based systems). To install the Unicode libraries, go back to the VS CD, and select the Unicode libraries when it offers you the choice - you may have to drill down through several screens to get to it, I don't remember. You probably chose the default when you installed VS the last time, which does not install the Unicode stuff.
Best wishes,
Hans
p.s. You can customize the VS toolbar so that the "Select Active Configuration" combobox is always displayed on your toolbar. Saves lots of confusion.
|
|
|
|
|
|
i want to know is there any tool availble which will convert win32 programme into mfc....
Regds
Vipin Bokariya
|
|
|
|
|
Long Answer:
MFC provides C++ wrappers for the Win32 SDK functions plus classes, not related to GUI, to help simplify development. When you are accessing Win32 directly, much of the GUI must be designed (drawn) by you. Therefore, in order to convert from Win32 to MFC you would, at the very least, have to rewrite the interface using MFC and import all the code which is not directly dependent on the interface design (a.k.a. drawing interface).
Short Answer:
No.
Trust in the code Luke. Yea right!
|
|
|
|
|
The following program is all right,but if I change the second sentence to such m_bitmap.LoadBitmap("c:\\windows\\cibab.bmp") then
m_bitmap.GetBitmap(&bm) crash. I want to know why.
CBitmap m_bitmap;
m_bitmap.LoadBitmap(IDB_BITMAP);
BITMAP bm;
m_bitmap.GetBitmap(&bm);
//**************
Your answer is greatly appreciated
WuWenGuo
David wu
|
|
|
|
|
|
Hi David,
try this perhaps it helps
CString szFilename;
szFilename="bild.bmp";
HBITMAP hBmp = (HBITMAP)::LoadImage(NULL,szFilename, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE|LR_CREATEDIBSECTION);
CBitmap bild;
bild.Attach(hBmp);
CWnd* wp = GetDlgItem(IDC_STATIC_BITMAP_GLASROHR); //name of the control on which you want to display the bitmap
CDC *pDC = wp->GetDC();
CDC imageDC;
imageDC.CreateCompatibleDC(pDC);
imageDC.SelectObject( &bild);
pDC->BitBlt(0, 0, 400 , 200, &imageDC, 0, 0, SRCCOPY);
imageDC.DeleteDC();
wp->ReleaseDC(pDC);
|
|
|
|
|
if m_bitmap.LoadBitmap("c:\\windows\\cibab.bmp") failed then m_bitmap.GetBitmap(&bm) will fail.
1) How do you know cibab.bmp exist.
2) Check return values to make sure bitmap was loaded (it does not sound like it was).
3) When you say crash what do you mean? If GetBitmap() failed that does not mean you program CRASHED, it means that you have an invailid bitmap handle. Which causes GetBitmap() to fail. Therefore, see items (1) and (2) above.
4) "c:\\windows" is not portable between Windows operating systems (on WinNT it is "c:\\winnt", before XP).
Trust in the code Luke. Yea right!
|
|
|
|
|
How can I do content of CEdit vertical center?
This quesiton puzzle me for a long time.
Hope anyone to answer!
|
|
|
|
|
lvvvww wrote:
How can I do content of CEdit vertical center?
You can't. The edit control has no provision for this. You would have to roll your own custom edit control. See here to get started.
Best wishes,
Hans
|
|
|
|
|
Just in case someone is searching for a solution.
void CCCenterText::CenterText(CString Text)
{
m_wndEdit.SetWindowText(Text);
m_wndEdit.CenterWindow(&m_wndStatic);
CDC *pDC = m_wndEdit.GetDC();
CFont *pEditFont = m_wndEdit.GetFont();
CFont *pFont = pDC->SelectObject(pEditFont);
TEXTMETRIC tm;
pDC->GetTextMetrics(&tm);
int LineHeight = tm.tmHeight;
pDC->SelectObject(pFont);
ReleaseDC(pDC);
CRect pos;
m_wndEdit.GetWindowRect(pos);
ScreenToClient(&pos);
int LineCount = m_wndEdit.GetLineCount();
int posHeight = LineHeight * LineCount;
m_wndEdit.SetWindowPos(&m_wndStatic,pos.left,pos.top,pos.Width(),posHeight,0);
m_wndEdit.CenterWindow(&m_wndStatic);
}
|
|
|
|
|
I'm currently researching overlapped socket I/O. I see that the WSA stuff basically copies the "ordinary overlapped I/O" functionality. What if I want to wait for ordinary events as well as socket I/O events? It doesn't look like WSAWaitForMultipleEvents is compatible with ordinary HANDLEs.. or is it? The docs doesn't say anything about it..
--
I was quite impressed until I hit the floor
Isn't that what friends are for?
Pain looks great on other people
That's what they're for
|
|
|
|
|
From the almight MSDN Library...
Blocking and Waiting for Completion Indication
Applications can block while waiting for one or more event objects to become set using the WSAWaitForMultipleEvents function. In Windows implementations, the process or thread truly blocks. Since Windows Sockets 2 event objects are implemented as Windows events, the native Windows function, WaitForMultipleObjects can also be used for this purpose. This is especially useful if the thread needs to wait on both socket and nonsocket events.
Hmmm... I expected more from you, Jörgen
"was wir auch tun, wohin wir gehen
die illuminaten sind im system
sie kontrollieren überall
und 23 ist ihre zahl!"
23, welle: erdball
|
|
|
|
|
Hi,
I am trying to use SQL with DISTINCT to search the distinct string in a table, but always have an error that shows it can open the table!
Here what i did: I use a table RoomList and in that table there is a column RoomType. In the colums there are a lot of strings but only 3 different types: Single, Double &Suite ... so I would like to scan this table and hope it will return me only 3 times that contains "Single", "Double" and "Suite"!
So I use the following:
<br />
CRoomList rList(pdb);<br />
CString strSQL;<br />
<br />
strSQL.Format ("SELECT DISTINCT RoomType FROM RoomList");<br />
rList.Open (AFX_DAO_USE_DEFAULT_TYPE, strSQL, 0);<br />
while (!rList.IsEOF())<br />
{<br />
m_typeRoom.AddString (rList.m_RoomType);<br />
rList.MoveNext();<br />
}<br />
rList.Close();<br />
*) Any time it reaches: rList.Open
(AFX_DAO_USE_DEFAULT_TYPE, strSQL, 0) ---> error "GetRow
failed, the Requested column is not a member of this
recordSet!
*) This means the: strSQL.Format ("SELECT DISTINCT RoomType FROM RoomList"); ---> is somehow not correct! I did check the table name RoomList & column RoomType ... they are ok!
By any chance, someone knows I missed some thing here?
Thanks to any help!
|
|
|
|
|
Hello all,
I'm using a CHtmlView derived view to create my user interface. It's cool, and accessing the elements works now after some experimenting, but I'm having two problems that I cannot figure out:
- How do I get rid of the (disabled) vertical scroll bar on the right hand side?
- How do I display images in my view? I know I can use the res:// protocol in the 'src' attributes of my 'img' tags, but I want to display images that are in the same directory as the executable of my program, and I don't want to hardcode the path into the html (ofcourse). Maybe I should mention that in my OnInitialUpdate of the view, I do Navigate2(_T("about:blank"),NULL,NULL); because otherwise the calls to get the DOM object later on fail.
Any ideas? Thanks a bunch!
cheers,
roel
|
|
|
|
|
I assume that if you don't specify a path for the images, they aren't found, even though they are in the same directory as the executable. One way to handle this is to give each img tag a unique id, locate that, and then set the path as required. Do this when the page loads.
eg.
MSHTML::IHTMLElementPtr e;
pDoc->Getall()->item( pszFieldID );
if ( e != NULL )
e->setAttribute( _T("img"), FullPath, TRUE );
Hope that helps.
I'd be interested to know something about your cool UI.
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
Bummer, I was hoping I could avoid that Ah well. And the 'cool' part was referring to 'using IE as user interface', not so much to my user interface itself It's a frontend for geological modelling software, not very interesting for us software guys, but if you're really interested I can send you some screenshots when it's done
|
|
|
|
|
There may well be another way, but that's the only suggestion I have.
Yep screenshots would be of interest.
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
need example or document about how to unzip a zipped file programmatically.
thx
includeh10
|
|
|
|
|
|
I've succeded in writing into an excelfile from c-application
My problem ist that i want to write an formula into an excelcell.
Many Excel-formulas like =LN(C9) or =PI() do their work
But wenn i use e.g. =Summe(A9:A11) it only writes the text into the cell but it doesn't calculate the sum.
codeexample:
pExcel->Range["Tabelle1!C7"]->Formula="=SUMME(A9:A11)"; //this doesn't work
pExcel->Range["Tabelle1!C7"]->Formula="=LN(C9)"; //this does the job
any ideas why this doesn't work with summe?
|
|
|
|