|
If you wanna fire an event at the end of your worker thread then the best thing is to monitor your thread execution status with GetExitCodeThread and fire the event directly from your control class. In order to do this you have to set the thread's autodelete member to FALSE.
This should do the job:
CWinThread* pThread = AfxBeginThread(...,CREATE_SUSPENDED);
pThread->m_bAutoDelete = FALSE;
pThread->ResumeThread();
DWORD dwExitCode;
while (TRUE)
{
GetExitCodeThread(pThread->m_hThread, dwExitCode);
if (dwExitCode != STILL_ACTIVE)
{
FireYourEvent();
break;
}
else
SleepABitAndPumpMessages();
}
Peter Molnar
|
|
|
|
|
I created a dialog that has sort of a "view" based on tutorial here.The class for "view" i called it COpengl for drawing. I have some controls on the dialog. How do i get the COpengl class (or rather the OnPAint() in this class)to retrieve the current values from the dialog needed for drawing?
|
|
|
|
|
Hi !
First of all, I have to mention that I never developped any libraries. But, for my application I need one, and many questions are raising in my mind. I hope you can help me a little bit.
- The library will be doing some process for the main application, but what has to be done by the library will be specific to a customer, which is why I want to keep the 'customer-dependent' code inside a library. But, my library will use many classes that are part of my main application, and I don't see how I'm supposed to develop a library which will have to know many classes from my application ? Is it possible to do what I want to do ?
- From my main application, will I have to use functions from the library, or can I instanciate classes which would be part of my library (for example, the base class would be declared in my main app, and derived classes would be declared in the library) ?
- Specific to Qt : do I have to do something particular in the code of the library (I've seen some piece of code from libraries for Windows and they had a WIN_DLL type keyword) ?
Well, as you can see, I don't have a very precise idea of what creating a library involves and I would appreciate your help !
Thank you !
Jerome
|
|
|
|
|
Hallo,
you can it use as an normal lib. The only thing what you must make is, include the qtxxx.lib in your makefile (path-variables must be ok). Use any function from the qtlib, is the same as you use the mfc.
Qt had a tool, qmake, which one you can make it. This tool create also your workspace (*.dsp) for you. See the manual for qmake, there can you find any information you want. A hint, use the Qt-Examples. She are very usefull.
Greetings
PS. sorry for my poor english. Is not my natural language
|
|
|
|
|
Hi !
Thank you for your answer, but I realize I didn't make myself clear enough. Actually, I don't want to link my application with a .lib and recompile it, I want my app to dynamically use a library (dll under windows) without having to recompile my main application.
Jerome
|
|
|
|
|
i want to have a toolbar on the right hand and i want to add its buttons from right to left.please tell me how could i do it?
|
|
|
|
|
Does anybody know how to use or interpret the BYTE array which one can get for a GDI+ region using the GetData method ? The MSDN library tells me only "The GetData method gets data that describes this region."
|
|
|
|
|
Hi All?
can anyone tell me how can I connect my Win32 API (NO MFC)application with a .mdb database using DAO or ADO ( I don't want to use ODBC)???
Thanks for any answer!
|
|
|
|
|
I'd use the ATLDBCLI templates. Not MFC, not dependant on MFC, lighter-weight than ADO.
Alternatively, if it's only ever going to be MDB, use the DAO SDK (which should be on the VC6 CD somewhere)
Steve S
|
|
|
|
|
Does DAO SDK works without linking my application with MFC dll??
|
|
|
|
|
Yes, as far as I know there are no dependencies on MFC in the DAO SDK.
Note that this ISN'T the same as the CDaoXXXXX stuff from MFC, of course.
Steve S
|
|
|
|
|
Hi guys,
I need to be able to display jpgs as a background for an MFC dialog based application but have no idea where to start. Any methods are greatly appreciated.
Xtremean
|
|
|
|
|
search in MSDN for IPicture
article by paul dilascia
|
|
|
|
|
If you are using VC7, MFC has a new class called CImage that lets you load any image format.
OR
You could use a the new CDHtmlDialog class and use HTML to display the jpg.
Art
|
|
|
|
|
I've noticed a (bad?) habit from some colleagues of mine to void -cast unused return values, as in
(void)::SystemTimeToFileTime(&st, &ft) I've personally never ever done that in C/C++, but something like it when scripting bash back in my dark Linux days (don't ask...)
Why on earth are they doing it and is it even necessary? I hope someone will say it's not recommended and provide a good link to Bjarne etc...
--
Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so. (Douglas Adams)
|
|
|
|
|
it could be some kind of convention they're using. There're many awkward conventions my friend, most of them nobody knows about; it's like politics.
Phil
|
|
|
|
|
It's basically a semantic marker: it says 'Yes, I know that this function has a return value, but I'm deliberately ignoring it.' Some style manuals suggest doing this, I believe - if a function returns a value, you should either use the value, or cast to void.
From the compiler's perspective, it should compile exactly the same code whether or not this cast is here.
Personally, although I've done it on a couple of occasions, I don't normally bother. It's more typing for no real value.
In the case of SystemTimeToFileTime , the function could fail if the SYSTEMTIME structure contains duff information (e.g. 31st of February, or a year before 1601).
|
|
|
|
|
This style used to be used by UNIX programmers to state "yes i know the function returns 'x', but i have no use for the return value".
This was a bit of a fallout from the belief that if a function returned a value the value should be checked (religiously).
It was most often used for things like printf(), or when the function returned an error code, but that there was nothing usefull the program could do in case of an error (e.g. testing if malloc() returned null).
It is purely stylistic.
...cmk
Rosencrantz: I don't believe in it anyway.
Guildenstern: What
Rosencrantz: England
Guildenstern: Just a conspiracy of cartographers then.
Save the whales - collect the whole set
|
|
|
|
|
While it is stylistic, and I loathe it, many, many years ago, there were C compilers that emitted a warning if the return value from a function wasn't either checked or used to set a variable.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
I'm trying to use CHeaderCtrl standalone (without a CListCtrl) but it insists on making its text bold, which looks totally stupid. I can't for the life of me figure out how to make it use the non-bold system font that it uses when it's part of a CListCtrl (the same one menus, edit controls, etc. use).
The CHeaderCtrl is a member of my CMainFrame class, and I create the control in CMainFrame::OnCreate. I tried calling the control's SetFont member, before and after creating the columns, with and without redraw, and with every type of CFont I could think of, all to no avail. Is this a bug in MFC?
~CK
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
// create header control above CFormView
CRect r;
GetClientRect(r);
r.bottom = HEADER_HEIGHT;
m_Hdr.Create(WS_CHILD | WS_VISIBLE, r, this, 0);
// try to get rid of stupid bold font WHY DOESN'T THIS WORK?!?
CFont *pFont = (CFont *)GetDC()->SelectStockObject(DEFAULT_GUI_FONT);
SetFont(pFont, TRUE);
// populate header
HDITEM hdi;
const cols = 3;
LPCSTR str[cols] = {"Volume", "Pan", "Pitch"};
int wid[cols] = {172, 172, 172};
hdi.mask = HDI_TEXT | HDI_WIDTH | HDI_FORMAT;
hdi.fmt = HDF_LEFT | HDF_STRING;
for (int i = 0; i < cols; i++) {
hdi.pszText = (char *)str[i];
hdi.cchTextMax = strlen(str[i]);
hdi.cxy = wid[i];
m_Hdr.InsertItem(i, &hdi);
}
return 0;
}
|
|
|
|
|
This is because of the setting of "Display properties".
Change your setting of display in the control panel and set the header text font as non-bold font.
|
|
|
|
|
I'm not sure. First of all I don't see a setting for header text in the display properties, not in Windows 2000. I even tried selecting the Windows Classic BIG FONT setting, and it changed a lot of text all over the place, but not CHeaderCtrl's text.
And in any case, it makes no sense that a CHeaderCtrl should use non-bold when it's embedded in a CListCtrl (i.e. in just about every MFC app in the world) and bold when it's embedded in a CFrameWnd.
It seems to me it's either an MFC bug, or there's something magical that CListCtrl does to its CHeaderCtrl that I haven't figured out how to do.
~CK
|
|
|
|
|
Assuming m_Hdr is a member variable of type CHeaderCtrl, in whatever function creates m_Hdr, immediately after m_Hdr.Create(...), add this line:
m_Hdr.SendMessage(WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT));
***NOTE*** that the following does *NOT* work:
m_Hdr.SetFont((CFont *)GetStockObject(DEFAULT_GUI_FONT));
Why? I don't know. Maybe because SetFont posts the message, instead of sending it, so that the temporary font pointer returned by GetStockObject is already garbage by the time the header control receives the message?
~CK
|
|
|
|
|
Hello Guys,
i need some help regarding loading icons from a local directory in VC++, in my app there is a combo box... if i pass an directory name to the app.. then all the file names of the icon's in that directory should be loaded in the Combo Box.
post with some sample code toooo for the above question
Thanks in advance
Hariharan.S.N
ravi
|
|
|
|
|
1. construct the CFileFind class
2. Call FindFile()
3. enter a loop that ends if you can't do 4
4. Call FindNextFile()
5. use CFileFind's get procs to filter out the icons
and do whatever you want with those filenames
Phil
|
|
|
|