|
Hi,
im able to calculate the font height based on the give FontSize as follows...
LOGFONT lf;
int nFontSize=20;
SecureZeroMemory(&lf, sizeof(lf));
lf.lfHeight = -MulDiv(nFontSize, GetDeviceCaps(hDC, LOGPIXELSY), POINTSPERINCH);
but how can i calculate the width of the font for the give FontSize ie..
lf.lfWidth...?..
|
|
|
|
|
The width of each character in a font is different, unless it is a monospaced font.
You can use GetTextMetrics[^] to get the average width of the characters of a font.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Thanks for ur Reply...
Pls have a look over the post which i have posted just 5 hrs back...regarding
SetcolumnWidth
|
|
|
|
|
Hi,
if i debug my application, and want to close them, i receive sometimes this strange error in
void CDatabase::Close()
{
ASSERT_VALID(this);
AfxLockGlobals(CRIT_ODBC);
TRY
{
while (!m_listRecordsets.IsEmpty())
{
CRecordset* pSet = (CRecordset*)m_listRecordsets.GetHead();
pSet->Close();
pSet->m_pDatabase = NULL;
}
}
CATCH_ALL(e)
{
AfxUnlockGlobals(CRIT_ODBC);
THROW_LAST();
}
END_CATCH_ALL
AfxUnlockGlobals(CRIT_ODBC);
if (m_hdbc != SQL_NULL_HDBC)
{
RETCODE nRetCode;
AFX_SQL_SYNC(::SQLDisconnect(m_hdbc));
AFX_SQL_SYNC(::SQLFreeConnect(m_hdbc));
m_hdbc = SQL_NULL_HDBC;
_AFX_DB_STATE* pDbState = _afxDbState;
AfxLockGlobals(CRIT_ODBC);
ASSERT(pDbState->m_nAllocatedConnections != 0);
pDbState->m_nAllocatedConnections--;
AfxUnlockGlobals(CRIT_ODBC);
}
}
But the best is i dont habe any kind of database in my project included????
Does any one have a answer for this issue???
thanks for any help!
Arrin
|
|
|
|
|
Look at the call stack and you can figure out the sequence of functions that are being called.
From this you can understand how the control reached that particular function.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Hi,
thanks for answer!!
arrin
|
|
|
|
|
Hello community,
how to create a second window that is always on top of a main window,
so if i click on the main window that this pop up window stay on top until my function is finished??!?
I create a simple dialog with the resource editor and set "Set Foreground" to true,
but even if i click on the main dialog this new little dialog is in the background, how to avoid this?
If i set "Topmost" to true, than is my pop up dialog always on top, but for all other windows too,
and i like that hi is only for my main dialog in the foreground!?
Thanks for help
Arrin
EDIT: after i show my child dialog and bring him to top i disable my main dialog to make him unklickable and when my funktion is finished i enable him again,
but im not sure that this is the right way!?
dlgProgress.ShowWindow(SW_SHOW);
dlgProgress.SetForegroundWindow();
EnableWindow(FALSE);
EnableWindow(TRUE);
|
|
|
|
|
Looks like you need a modal dialog.
If you're using MFC, call CDialog::DoModal[^].
Otherwise call DialogBox[^].
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
I may have had a similar problem back several months ago. I have a modeless PropertySheet (a modeless tabbed dialog window) separate from my main Doc-View window.
I created my modeless PropertySheet window:
<br />
m_pSettings->Create(this, WS_SYSMENU | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | DS_MODALFRAME | DS_CONTEXTHELP, WS_EX_DLGMODALFRAME);<br />
m_pSettings->SetWindowPos(this,0,0,0,0,SWP_NOMOVE | SWP_NOSIZE);<br />
I do recall that there was something special to this (modeless property sheet) and the peeps here helped me out!
|
|
|
|
|
Hi,
I pushed some string values in to the STL Queue.
Now i need to pop the values from that queue using thread in MFC application.
Thanks,
Ratheesh.
|
|
|
|
|
ratheeshnair123 wrote: I pushed some string values in to the STL Queue.
Now i need to pop the values from that queue using thread in MFC application.
Nice to know. And what is the question?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi,
i am using MFC application in this application i need to display the received messages from the server (may be a chance for receiving more than one messages at a time) i need to display the received and send messages in the Listbox.
i tried it in normal way, but the UI getting freezed after some time. I can able to log that message. So i tried it in some other way, like using queue
the received messages are added in the queue and at thet time timer is running and one thread will pop the pushed messages in to the ListBox.
Using thread how can i get the pushed value?
Thanks,
Ratheesh.
|
|
|
|
|
You should add the messages to the queue using a worker thread, then notify it to the GUI thread (using, for instance PostMessage ). The GUI thread eventually pops messages from the queue and displays them. of course you've to lock in same way queue access.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
it's probably not safe AS-IS. (stl is not by design thread-safe)
I suggest you implement a simple synchronization mechanism (see Thread Synchronization for Beginners[^] )
This signature was proudly tested on animals.
|
|
|
|
|
|
thats nice .. but you might have missed the fact this is primarily a SOURCE CODE/PROBLEM SHARING SITE .. so if you wish to advertise your product, please pay for doing so !!!
'g'
|
|
|
|
|
May I politely ask you to avoid advertising in this forum?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Sorry, the goal is not to add spams to CodeProject but to contribute to encourage developers to focus more in design ( a free version is sufficient for many c++ projects to detect design problems).
anywhay i deleted the message.
falconI
|
|
|
|
|
Humm ? what are you saling anyways?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hi all,
I m creating my application MFC,When i run this application on my PC than its working fine,but when i run this application on diffrent PC than its crash at many diffrent locations.
Please can u tell me how can i get crashing location of application.
is there any software or utility which helps me?
please help me for this.
thanks in advance.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
Read this article very carefully:
http://www.flounder.com/debug_release.htm[^]
It lists many common errors that show up in Release rather than Debug mode, and also how to add symobols so you can work out where things are actually crashing.
As for "many different locations", then try and get just one location at a time by being very consistent in how you get to the crash.
Good luck,
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need cotract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
Use Process Dumper tool to get the dump file and analyze it.
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
Create a crash dump and send it. Will try and analyze it.
Check this link to create a crash dump - Capturing Application Crash Dumps[^]
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
The name of the module and the offset of the exception will be in the users Application Log of the event viewer. Although a crash dump is certainly useful there is no reason to create one.
How to view and manage event logs in Event Viewer in Windows XP[^]
You can use WinDbg to find the corresponding code if you have saved your symbols. It is very important that you use the same symbols at the time of the Release build otherwise you will not find the correct crash location.
Debugging Tools for Windows - Overview[^]
Best Wishes,
-David Delaune
|
|
|
|
|
Hi,
Can i use STL queue in MFC application?
How can i use it in my application?
Thanks,
Ratheesh.
|
|
|
|