|
|
thanks mike, will read them now.
norm
norm
|
|
|
|
|
How do you get Visual C++.NET to recognize float data less than zero? For instance, if the following were typed:
float someint=(9/12); The program sees this as zero and not 0.75.
|
|
|
|
|
put decimal points after the 9 and 12
-c
A conclusion is simply the place where someone got tired of thinking.
|
|
|
|
|
9 and 12 are both integers, so that expression does integer division, thus the result is zero. Write it with floating-point constants:
9.0/12.0
to get the desired result.
--Mike--
"alyson hannigan is so cute it's crazy" -- Googlism
Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
hey everyone, i'm fairly new to MFC so forgive me if this is easy, but my View class is a CListView(in report mode) and i follow some i examples i found to get tabs working, by having a member varible in the View class and setting up the tabs in the view classes OnInitialUpdate, and now i have tabs but the header on the ListView apear over the tabs, which i want the list view to look like its in the tabs. any ideas?
should my View class be derived from tab class and create a ListView class in it? not the other way around? i tried a quick hack at that but got errors, but if that was right i'll have another go.
maybe i could make it draw the listview lower?
anyway thanks in advance.
Luke.
|
|
|
|
|
Hi, everyone!
I am a newbie of MPEG4. First, I want to learn what is MPEG4.
Then I want to write a simple MPEG4 encoder/decoder. (Using C++)
But I can not find any documents and samples at hand.
Anyone know how can I find the resources?
(1. A step by step doc for newbie of MPEG4.)
(2. A simple encoder/decoder sample code.)
Thanks & nice weekend,
George
|
|
|
|
|
|
Thanks, mariano pal!
It helps a lot.
Cheers,
George
|
|
|
|
|
If i were you i would check out XviD.org. It's an opensource mpeg4 codec. You will probably not be able to write your own decoder cause that takes years and years of training. But start by looking at the xvid codec, it'll give you an idea of how hard it is
good luck
-Rune Svendsen
|
|
|
|
|
Thanks, Redeemer-dk!
It is a nice site!
Cheers,
George
|
|
|
|
|
What are the ramifications of creating waitable timers for a scheduling utility (i.e. timers created using CreateWaitableTimer)? For instance, if you have 50 jobs and you create one waitable timer for each one in your scheduler, does this have any problems?
|
|
|
|
|
Each timer is a kernel resource, albeit not a very big one.
Some questions:
- Is this a Windows Service or a standalone app?
- How far ahead are you sceduling? Seconds? Hours? Days?
- Are you queuing jobs, or letting them exist in parallel?
- How are you doing your timer "waits"?
- With
WaitForSingleObject or WaitForMultipleObjects ? With the former, are you creating worker threads to "wait" on the timer firing?
- With the latter, how are you maintaining your "array" of timers?
- What's your timeout for the "waits"? INFINITE (yikes)?
|
|
|
|
|
Anonymous wrote:
What are the ramifications of creating waitable timers for a scheduling utility (i.e. timers created using CreateWaitableTimer)?
I made it once and they have a behaviour worth of note: when you schedule something "on the past" (say, every 5 minutes, since yesterday), they won't lose a notificatio, i.e., you'll have in the previous example, 288 events being instantaneously fired (for all "missed" yesterday events).
I don't know if my example was clear, but it can be a good behaviour or a bad behaviour, depending on your use.
My latest article:
SQL Server DO's and DONT's[^]
|
|
|
|
|
following one book I try to add another toolbar: belows is the new codes: (I had add all necessary resourses)
if (!m_wndBarSim.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_LEFT | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(IDR_TOOLBARSIMULATION))
{
TRACE0("Failed to create second toolbar\n");
return -1; // fail to create
}
It has no problem when combiling. But when run it, always :
" fail to create empty document "
could anyone answer this question?
Thanks
|
|
|
|
|
My app starts an external program for the user. How can my app be notified when the external program exits, without tying up my app? I can't find any functions for "process end" callbacks
|
|
|
|
|
You need a handle to the process, which you can get as a return value from CreateProcess() or ShellExecuteEx(). Call WaitForSingleObject() and pass it the handle, and a timeout of 0. It will return WAIT_TIMEOUT while the process is running, and WAIT_OBJECT_0 when it closes.
--Mike--
"alyson hannigan is so cute it's crazy" -- Googlism
Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
in a reminder app i'm playin with i can't delete from the database and i don't understand. if i un comment the lines (test to read)
I get the required info, which means to me i'm on a recordset, but when i call delete it errors with no current recordset, what am i doing wrong?
BOOL CPageThree::DeleteRemind(CString sec, CString name)
{
CDaoDatabase datab;
CString SqlString;
int iRec = 0;
TRY
{
// Open the database
datab.Open("remind.mdb");
// Allocate the recordset
CDaoRecordset recset( &datab );
// Build the SQL statement
SqlString = "SELECT * "
"FROM Remind WHERE Catagory='";
SqlString += sec;
SqlString += "' AND Extra1='";
SqlString += name;
SqlString += "'";
// Execute it
recset.Open(dbOpenDynaset, SqlString, dbAppendOnly);
// make sure we can make changes and update
if (!recset.CanAppend() || !recset.CanUpdate( ))
AfxMessageBox("can't append from recordset");
// test to read from current recordset
// CString sWarnDate;
// recset.GetFieldValue("WarnDate",sWarnDate);
// delete the current record
recset.Delete();
// Close the database
datab.Close();
}
CATCH(CDBException, e)
{
// If a database exception occured, show error msg
AfxMessageBox("Database error: "+e->m_strError);
return FALSE;
}
END_CATCH;
GetDlgItem(IDC_BUT_DEL)->EnableWindow(FALSE);
InitTree();
return TRUE;
}
p.s am a beginner so be kind
shotgun
|
|
|
|
|
okay i got it, it was my dbAppendOnly, should be dbSeeChanges, of course
shotgun
|
|
|
|
|
How do I find the height in pixels of what a combo box control *should* be? I am creating my own custom control, which includes combo list and list box sub-controls, and I want the user to be able to draw my control onto the dialog and have both sub-controls be the full width, and the list control be as tall as my custom control - the height of the combo box - a small gap between.
So I need to be able to calculate the size that the combo box should be in order to find the position and height of the list box below it....
Thanks!
- Kati
|
|
|
|
|
1. A dialog box derived from CFontDialog doesn't call PreTranslateMessage!?
(Dialogs derived from CDialog or the common control dialogs always do).
This makes it difficult to provide Tooltip support in a CFontDialog derivation.
Does anyone know why - or how to add Tooltips?
2. Changing the Sample Text (Control ID stc5) only works initially. As soon as the font selection
is changed the Sample reverts to "AaBbYy" etc. How/can you subclass this control and "user"
set this text.
3. Ditto the position of this text on the CFontDialog seems to be "hardcoded" independently of Control ID stc5.
Moving the stc5 window in a resizable dialog doesn't move the Sample Text. Why??
gjr
|
|
|
|
|
Hi,
I'm wondering if anyone can solve the closest pair problem in C/C++. "Closest Pair" problem is to find two points that are closest in a set of points. Of course we can use "brute search" by comparing each and every point but I need a faster algorithm than that (just like quicksort is faster than bubblesort).
Thank you
Chris U.
|
|
|
|
|
|
Subject: COM BSTR SysAllocString SysFreeString
simple question on memory allocation and deallocation...
Following is a simple function exposed by an interface:
STDMETHODIMP CQueryGenerator::GenQuery(BSTR bstrParam, BSTR *bstrSQL)
{
// TODO: Add your implementation code here
* bstrSQL = SysAllocString(L"Testing");
return S_OK;
}
Its corresponding IDL definition:
[id(1), helpstring("method GenQuery")] HRESULT GenQuery([in] BSTR bstrParam, [out, retval] BSTR * bstrSQL);
Is it the responsibility of the client to call SysFreeString for the returned string?
Thanks!
norm
|
|
|
|
|
Yes, otherwise you would be stuck with the problem of making two round trips in order for the caller to determine how many characters need to be allocated for the string, like in the Win32 API.
And two round trips is bad in COM, because remember the objects might not be in the same process, or even the same machine.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|