|
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?
|
|
|
|
|
I don't think that "=SUMME(A9:A11)" is an Excel function. Its not listed in the help file.
Try =SUM(A9:A11)
|
|
|
|
|
oh sorry i've got the german version of excel
in your case your right
but its not only a problem of Summe (or Sum) the same problem with Varianz and some other funktions.
if i open the excelfile klick to edit the formula and klick then enter without editing it works
but this is no acceptable solution
the file which i want to create has over 1000 lines and formulas.
i can't klick every cell
who to fix it?
|
|
|
|
|
Sorry.
Have you tried changing the cell format to "General" if it is "Text" it may not calculate. I doubt that is the problem though. This got over my head real quick . If I think of anything else I will let you know.
|
|
|
|
|
yes i've tried changing cell format but without succes
If he(excel) would think it is text then there would be a ' in front of the text but there isn't.
He writes #Name? (i don't know what he would write in the english version)in the cell until i click it then it works
other ideas?
|
|
|
|
|
#Name? is what I got with the English version of Excel.
|
|
|
|
|
The reason will be that "Name" is in english and in german the same word
|
|
|
|
|
I browsed through "Excel Developers Kit" book from Microsoft Press, I did not see anything. Sorry
|
|
|
|
|
@kjessee
Doesn't matter. One could not know anything. Thanks for your tips
Perhaps another one has an idea
|
|
|
|
|
|
I am trying to write a DLL to be called from VB. Thus I had to use SAFEARRAY.
I have a problem that when I am accessing all the elements in the array I can change their values but when I try to access a specific element it seems not to accept the new value I try to assign.
For example, I have these functions:
void Set2DSafeArrayPtr(SAFEARRAY * psaiInOut, long val)
{
long ai[2];
int x,y;
LRESULT hres;
int xMin = psaiInOut->rgsabound[0].lLbound;
int xMax = xMin + (int)psaiInOut->rgsabound[0].cElements - 1;
int yMin = psaiInOut->rgsabound[1].lLbound;
int yMax = yMin + (int)psaiInOut->rgsabound[1].cElements - 1;
// Set up dimension array and pointer to receive value.
long * piInOut;
if (hres = SafeArrayLock(psaiInOut)) throw hres;
for (x = xMin; x <= xMax; x++) {
ai[0] = x;
for (y = yMin; y <= yMax; y++) {
ai[1] = y;
hres = SafeArrayPtrOfIndex(psaiInOut, ai, (void **)&piInOut);
if (hres) throw hres;
// Equivalent to: aiInOut(x, y) = aiInOut(x, y) + 1.
(*piInOut) = val;
}
}
if (hres = SafeArrayUnlock(psaiInOut)) throw hres;
}
void SetElementPtr(SAFEARRAY * psaiInOut, int x, int y, long val)
{
LRESULT hres;
long * piInOut;
long ai[2];
if (hres = SafeArrayLock(psaiInOut)) throw hres;
ai[0] = x;
ai[1] = y;
hres = SafeArrayPtrOfIndex(psaiInOut, ai, (void **)&piInOut);
if (hres) throw hres;
(*piInOut) = val;
if (hres = SafeArrayUnlock(psaiInOut)) throw hres;
}
my program
void main{
...
SAFEARRAYBOUND bDim[2];
bDim[0].lLbound = 0;
bDim[0].cElements = 6;
bDim[1].lLbound = 0;
bDim[1].cElements = 6;
psaiNew = SafeArrayCreate(VT_I4, 2, bDim);
if(psaiNew == NULL){
cout << "Unable to initialize array. Not enough memory" << endl;
return;
}
hres = SafeArrayLock(psaiNew);
Set2DSafeArrayPtr(psaiNew, 15);
SetElementPtr(psaiNew, 1,2,30);
hres = SafeArrayUnlock(psaiNew);
...
}
The Set2DSafeArrayPtr seems to work fine but the SetElementPtr doesn't seem to work.
Any idea why? What am I doing wrong?
I'd also like to know of a good place I can find references/examples (other then MSDN)...
|
|
|
|
|
I added a menu to a dialog application, and can't seem to get the UPDATE_COMMAND_UI behavior to work. If I break on my OnUpdate... handler, it's called after the menu item has been selected, not before. I've been poking around on Code Project, and I'm starting to get the "impression" that it might not be possible.
Is that true, or is there a way to update a menu item in a dialog app?
|
|
|
|
|
One solution is to implement OnInitMenuPopup().
-----
void CDlgApp::OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu)
{
// Enables this dialog based app to handle ON_UPDATE_COMMAND_UI messages.
// For updating items in menu.
CDialog::OnInitMenuPopup(pPopupMenu, nIndex, bSysMenu);
CCmdUI cmdUI;
cmdUI.m_pMenu = pPopupMenu;
cmdUI.m_nIndexMax = pPopupMenu->GetMenuItemCount();
for (cmdUI.m_nIndex = 0; cmdUI.m_nIndex < cmdUI.m_nIndexMax; cmdUI.m_nIndex++)
{
cmdUI.m_nID = pPopupMenu->GetMenuItemID(cmdUI.m_nIndex);
if (cmdUI.m_nID == 0)
continue;
cmdUI.DoUpdate(this, FALSE);
}
}
-----
Kuphryn
|
|
|
|